Results 1 to 8 of 8

Thread: Trouble Making SoftAP Script Work

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    42

    Default Trouble Making SoftAP Script Work

    First off i want to say i did not make this script, i did find it off this forum. Second, I'm having trouble having clients connect. Clients take forever to connect, and when they do they are not getting Ip addresses.

    Any help is much appreciated.

    Backtrack 2.6.28.1
    Orinoco Gold b/g using ath5k drivers

    Latest Aircrack-ng
    planning on updating 2.6.28.3 (due to updated ath5k mesh driver fix)

    Code:

    #!/bin/bash

    modprobe tun
    airmon-ng stop mon0
    airmon-ng start wlan0

    # -=SoftAP Options=-

    xterm -e airbase-ng -P -C 5 -c 6 -e Linksys -a 00:14:6C:F0:AD:00 wlan0 &


    ifconfig at0 up
    sleep 1
    ifconfig at0 192.168.1.129 netmask 255.255.255.128
    route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.129

    # monitor
    xterm -e airodump-ng -c 6 --bssid 00:14:6C:F0:AD:00 mon0 &

    xterm -e tshark -i 3 "not broadcast and not multicast" & # at0 = 3


    #kill all dns
    killall dnsmasq

    #DHCP KillAll
    killall dhcp

    ## make sure we clean our dhcpd.leases
    echo > '/var/state/dhcp/dhcpd.leases'

    # start dhcp server for subnet
    dhcpd -cf dhcpd.conf at0

    ## solve our dns forwarder
    dnsmasq restart


    # create custom dhcpd.conf for WLAN
    #cat > dhcpd.conf << EOF
    #ddns-update-style ad-hoc;
    #default-lease-time 600;
    #max-lease-time 7200;
    #subnet 192.168.1.128 netmask 255.255.255.128 {
    #option subnet-mask 255.255.255.128;
    #option broadcast-address 192.168.1.255;
    #option routers 192.168.1.129;
    #option domain-name-servers 208.67.222.222;
    #range 192.168.1.130 192.168.1.140;
    #}
    #EOF

    ###########IP TABLES################


    # iptables cleanup
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain

    # iptables
    iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE # gateway to ext. router
    iptables --append FORWARD --in-interface at0 -j ACCEPT # rogue gateway
    iptables -t nat -A PREROUTING -s 192.168.1.128/25 -d 192.168.1.0/25 -j DROP # protect LAN from WLAN (DROP/REJECT)
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1 # DNS --to 208.67.222.222
    echo 1 > /proc/sys/net/ipv4/ip_forward


    #DriftNet

    #driftnet -i wlan0

  2. #2

    Default

    Are you writing the variables for the dhcpd.conf file yourself? What is in your dhcpd.conf file?

    I ask this because in the script you posted, all the parameters for the dhcpcd.conf file are commented out, so it appears that the script is not writing anything to it.

  3. #3
    Junior Member
    Join Date
    Jul 2008
    Posts
    42

    Default

    sorry about that


    ddns-update-style ad-hoc;
    default-lease-time 600;
    max-lease-time 7200;
    subnet 192.168.1.128 netmask 255.255.255.128 {
    option subnet-mask 255.255.255.128;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.129;
    option domain-name-servers 208.67.222.222;
    range 192.168.1.130 192.168.1.140;
    }

  4. #4

    Default

    Sorry, I've never used SoftAP, that dhcp comment thing was my one shot! Your cat line and EOF line need to be uncommented also.

    Good Luck...

  5. #5
    Junior Member
    Join Date
    Jul 2008
    Posts
    42

    Default

    Quote Originally Posted by cybrsnpr View Post
    Sorry, I've never used SoftAP, that dhcp comment thing was my one shot! Your cat line and EOF line need to be uncommented also.

    Good Luck...
    lol, thanks. Im thinking im gonna try it with the madwifi drivers, right now im using the ath5k and i think that might be the cause...

    but still unsure

  6. #6
    Just burned his ISO
    Join Date
    Feb 2009
    Posts
    3

    Default

    sorry for bumping a old thread but im having DNS issues and im hoping somone can help.

    im using the below code with a linksys wusb54g wificard (rt2570 chipset) and the code works fine my psp gets a IP and the AP shows up but when i try to goto google all i get is
    Code:
    0.000000 192.168.1.140 -> 208.67.222.222 DNS Standard query A google.com
    in tshark, im no linux guru but it looks to me like the SoftAP isnt connecting to OpenDNS and OpenDNS isnt responding back. any help?

    also if it helps any heres my LAN setup

    (grr 15 post rule)
    mcd2012.freesitespace.net/download/Images/temp/settings.jpg

    ive got backtrack3 running in vmware on my main comp. eth0 of the backtrack is assigned a ip (192.168.2.7) and is connected to the internet my router is using OpenDNS and is a DHCP server and uses a static ip.

    if you need anymore info just let me know

    Code:
    modprobe tun
    airmon-ng stop mon0
    airmon-ng start rausb0
    
    # -=SoftAP Options=-
    
    xterm -e airbase-ng -P -C 5 -c 6 -e SoftAP -a 00:14:6C:F0:AD:00 rausb0 &
    
    sleep 3
    ifconfig at0 up
    sleep 3
    ifconfig at0 192.168.1.129 netmask 255.255.255.128
    route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.129
    
    # monitor
    xterm -e airodump-ng -c 6 --bssid 00:14:6C:F0:AD:00 mon0 &
    
    xterm -e tshark -i 3 "not broadcast and not multicast" & # at0 = 3
    
    
    #kill all dns
    killall dnsmasq
    
    #DHCP KillAll
    killall dhcp
    killall dhcpd
    killall dhcpcd
    
    ## make sure we clean our dhcpd.leases
    echo > '/var/state/dhcp/dhcpd.leases'
    
    # start dhcp server for subnet
    dhcpd -cf dhcpd.conf at0
    
    ## solve our dns forwarder
    dnsmasq restart
    
    
    # create custom dhcpd.conf for WLAN
    cat > dhcpd.conf << EOF
    ddns-update-style ad-hoc;
    default-lease-time 600;
    max-lease-time 7200;
    subnet 192.168.1.128 netmask 255.255.255.128 {
    option subnet-mask 255.255.255.128;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.129;
    option domain-name-servers 208.67.222.222;
    range 192.168.1.130 192.168.1.140;
    }
    EOF
    
    ###########IP TABLES################
    
    
    # iptables cleanup
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain
    
    # iptables
    iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE # gateway to ext. router
    iptables --append FORWARD --in-interface at0 -j ACCEPT # rogue gateway
    iptables -t nat -A PREROUTING -s 192.168.1.128/25 -d 192.168.1.0/25 -j DROP # protect LAN from WLAN (DROP/REJECT)
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 208.67.222.222
    echo 1 > /proc/sys/net/ipv4/ip_forward
    
    
    #DriftNet
    
    driftnet -i at0

  7. #7
    Member
    Join Date
    Feb 2010
    Posts
    204

    Default

    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 208.67.222.222

    shouldnt that line be saying forward to eth0 or 192.168.1.1 or whatever your router is? and then let the router send out the request

  8. #8
    Just burned his ISO
    Join Date
    Feb 2009
    Posts
    3

    Default

    thanks its working now

    amazing how something so simple can ruin your day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •