Created
April 15, 2010 16:06
-
-
Save ideamonk/367296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WiFi Hunter | |
# =========== | |
# | |
# Scans for unprotected Access Points in your neighborhood and alerts you | |
# when it finds something good for you :) | |
# -- ideamonk at gmail.com | |
export MPLAYER_VERBOSE=0 | |
refreshReport() | |
{ | |
ap_list=`iwlist wlan0 scanning | grep ESSID` | |
ap_count=`iwlist wlan0 scanning | grep ESSID | wc -l` | |
hole_list=`iwlist wlan0 scanning | grep -e 'Encryption key:off' -B 6 | grep 'ESSID'` | |
hole_count=`iwlist wlan0 scanning | grep 'Encryption key:off' | wc -l` | |
} | |
showReport() | |
{ | |
echo "Total $ap_count APs " | |
echo "APs - " $ap_list | sed -e s/ESSID:// | |
echo $hole_count " Unprotected APs" | |
if [ $hole_count -gt 0 ] ; then | |
echo "Unprotected ones -- " $hole_list | sed -e s/ESSID:// | |
fi | |
echo "------------------------------------------------------------------" | |
} | |
refreshReport | |
showReport | |
echo | |
echo "Scanning now ... " | |
oldcount=0 | |
while [ 1 -eq 1 ] ; do | |
refreshReport | |
if [ $ap_count != $oldcount ] ; then | |
oldcount=$ap_count | |
if [ $hole_count -gt 0 ] ; then | |
mplayer '/usr/share/sounds/ubuntu/stereo/system-ready.ogg' -quiet -msglevel all=-1 >&/dev/null | |
# Yay I can haz stderr redirection too, complete silence :D >& FTW | |
# &> redirection works only with bash though | |
echo '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' | |
echo " --== FOUND SOMETHING ==--" | |
fi | |
showReport | |
echo | |
echo "Scanning for more..." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment