opexxx

weape.sh

Sep 10th, 2013
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.33 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # wEAPe - Wireless EAP Extractor
  3. # Daniel Compton
  4. # 08/2013
  5. # Daniel Compton
  6. # www.commonexploits.com
  7. # Twitter = @commonexploits
  8. # Tested on Bactrack 5 & Kali Nessus version 4 & 5
  9.  
  10.  
  11. # Script begins
  12. #===============================================================================
  13.  
  14. VERSION="0.2"
  15.  
  16. clear
  17. echo ""
  18. echo -e "\e[00;32m#############################################################\e[00m"
  19. echo ""
  20. echo -e "   wEAPe Wireless EAP Extractor $VERSION "
  21. echo ""
  22. echo -e "   EAP Domain Username Extractor"
  23. echo ""
  24. echo -e "\e[00;32m#############################################################\e[00m"
  25. echo ""
  26.  
  27. #Dependency checking
  28.  
  29. #Check for tshark
  30. which tshark>/dev/null
  31. if [ $? -eq 0 ]
  32.         then
  33.                 echo ""
  34. else
  35.                 echo ""
  36.             echo -e "\e[01;31m[!]\e[00m Unable to find the required Tshark program, install and try again"
  37.         exit 1
  38. fi
  39.  
  40.  
  41. #Check for Airmon-ng
  42. which airmon-ng >/dev/null
  43. if [ $? -eq 0 ]
  44.         then
  45.                 echo ""
  46. else
  47.                 echo ""
  48.         echo -e "\e[01;31m[!]\e[00m Unable to find the required Airmon-NG program, install and try again"
  49.         exit 1
  50. fi
  51.  
  52. #Dependency checking
  53.  
  54. #Check for Airodump-NG
  55. which airodump-ng >/dev/null
  56. if [ $? -eq 0 ]
  57.         then
  58.                 echo ""
  59. else
  60.                 echo ""
  61.         echo -e "\e[01;31m[!]\e[00m Unable to find the required Airodump-ng program, install and try again"
  62.         exit 1
  63. fi
  64.  
  65.  
  66. #Check for screen
  67. which screen >/dev/null
  68. if [ $? -eq 0 ]
  69.         then
  70.                 echo ""
  71. else
  72.                 echo ""
  73.         echo -e "\e[01;31m[!]\e[00m Unable to find the required Screen program, install and try again"
  74.         exit 1
  75. fi
  76.  
  77. echo -e "\e[01;33m[-]\e[00m In order to extract EAP packets you will need to associate (not authenticate) with the access point of interest"
  78. echo ""
  79. echo -e "\e[01;33m[-]\e[00m Your wireless network card must support packet injection."
  80. echo ""
  81. sleep 3
  82. echo -e "\e[01;32m[-]\e[00m Now checking your wireless card..."
  83. echo ""
  84. # fix for occasional RFKILL errors
  85. rfkill unblock all >/dev/null
  86.  
  87. # check for wifi mon interface
  88. MONCHK=$(airmon-ng |grep -i "mon" |wc -l)
  89. if [ "$MONCHK" = 0 ]
  90.     then
  91.     echo ""
  92.     echo -e "\e[01;31m[!]\e[00m Unable to find any wireless interfaces in monitor mode."
  93.     echo ""
  94.     echo -e "\e[01;32m[-]\e[00m The following interfaces exist:"
  95.     echo "--------------------------------------------------------"
  96.     airmon-ng
  97.         echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  98.         echo -e "\e[01;31m[?]\e[00m Enter the interface you would like to put into monitor mode and press ENTER. i.e wlan0"
  99.         echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  100.     echo ""
  101.     read WLANTMP
  102.     echo ""
  103.     echo -e "\e[01;32m[-]\e[00m Now attempting to put your adaptor "$WLANTMP" into monitor mode...please wait"
  104.     echo ""
  105.     sleep 2
  106.     airmon-ng stop "$WLANTMP" >/dev/null
  107.     sleep 3
  108.     airmon-ng start "$WLANTMP" >/dev/null
  109.     echo ""
  110.     echo -e "\e[01;33m[-]\e[00m If an "SIOCSIFFLAGS:" error was displayed against "$WLANTMP", then you card/driver is not compatable"
  111.     echo ""
  112.     echo -e "\e[01;32m[-]\e[00m Press Enter to continue if you did not see the "SIOCSIFFLAGS" error."
  113.     echo ""
  114.     read ENTERKEY
  115.     sleep 3
  116.     airmon-ng |grep -i "mon" >/dev/null
  117.         if [ $? = 0 ]
  118.             then
  119.                 MADEMON=$(airmon-ng |grep -i "mon" |awk '{print $1}')
  120.                 echo -e "\e[01;32m[+]\e[00m Success, created "$MADEMON" interface in monitor mode."
  121.                 echo ""
  122.                 MONINT="$MADEMON"
  123.         else
  124.             echo ""
  125.             echo -e "\e[01;31m[!]\e[00m Unable to create a monitor interface, script will exit."
  126.             echo ""
  127.             echo -e "\e[01;31m[!]\e[00m Your card or driver may not be compatable. Fix and run the script again"
  128.             echo ""
  129.             exit 1
  130.         fi
  131.  
  132. elif [ "$MONCHK" = 1 ]
  133.     then
  134.     echo ""
  135.     MONINT=$(airmon-ng |grep "mon" |awk '{print $1}')
  136.     echo -e "\e[01;32m[+]\e[00m I found "$MONINT" interface, I will use that for the script."
  137.     echo ""
  138. else
  139.     echo ""
  140.     echo -e "\e[01;32m[-]\e[00m Multiple interfaces exist in monitor mode:"
  141.         echo "-------------------------------------------------------------------"
  142.     airmon-ng |grep -i "mon"
  143.     echo ""
  144.     echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  145.         echo -e "\e[01;31m[?]\e[00m Enter the interface you would like to use and press ENTER. i.e mon0"
  146.         echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  147.         echo ""
  148.     read MONINT
  149.     echo ""
  150. fi
  151. sleep 3
  152. clear
  153. echo ""
  154. echo -e "\e[01;33m[-]\e[00m You need to associate with the access point in question before any information can be extracted"
  155. echo ""
  156. echo -e "\e[01;33m[-]\e[00m Note: it should be access points that only have MGT within the AUTH column, which means it is using 802.1x"
  157. echo ""
  158. echo -e "\e[01;33m[-]\e[00m Also it should be an access point with traffic or is likely to have traffic. check under Data column"
  159. echo ""
  160. echo -e "\e[01;33m[-]\e[00m You will be presented a list all wireless networks. When you have identified the SSID of interest press CTRL C"
  161. echo ""
  162. echo -e "\e[01;32m[-]\e[00m Press ENTER to continue"
  163. echo ""
  164. read ENTERKEY
  165. airodump-ng $MONINT
  166.  
  167. echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  168. echo -e "\e[01;31m[?]\e[00m Please enter the BSSID from above for the access point of interest (not SSID) i.e '00:AE:x:x:x:x:x'"
  169. echo -e "\e[1;31m------------------------------------------------------------------------------------------------------------------\e[00m"
  170. echo ""
  171. read BSSIDTMP
  172. BSSID=$(echo "$BSSIDTMP"| sed -e 's/^[ \t]*//' |sed 's/[ \t]*$//')
  173. echo -e "\e[1;31m---------------------------------------------------------------------------------------\e[00m"
  174. echo -e "\e[01;31m[?]\e[00m Please enter the channel number of of the access point of interest i.e 6"
  175. echo -e "\e[1;31m---------------------------------------------------------------------------------------\e[00m"
  176. echo ""
  177. read CHAN
  178. echo ""
  179. echo -e "\e[01;32m[-]\e[00m I will now run a background process to assoicate with this access point..."
  180. echo ""
  181. screen -d -m -S eappeap_dump airodump-ng -i $MONINT -c $CHAN --bssid $BSSID
  182. echo ""
  183. echo -e "\e[01;32m[-]\e[00m Now sniffing traffic looking for EAP packets.."
  184. echo ""
  185. echo -e "\e[01;33m[-]\e[00m Note this can take some time as it depends on finding EAP traffic and users authenticating."
  186. echo ""
  187. echo -e "\e[01;32m[-]\e[00m Leave script running and users will appear if they authenticate, CTRL C to cancel"
  188. echo ""
  189. echo -e "\e[01;32m-------------------------------------------------------------------------------------\e[00m"
  190. echo -e "\e[01;32m[+]\e[00m Capturing Traffic, press CTRL C once you have seen sufficent usernames"
  191. echo -e "\e[01;32m-------------------------------------------------------------------------------------\e[00m"
  192. tshark -i "$MONINT" -R eap -V 2>&1 |grep "Identity: *[a-z]\|*[A-Z]\|*[0-9]"
  193. echo ""
  194. echo -e "\e[01;33m[-]\e[00m All airodump-ng processes are being stopped.."
  195. echo ""
  196. killall airodump-ng >/dev/null 2>&1
  197. exit 0
  198. # Script end
Advertisement
Add Comment
Please, Sign In to add comment