Fixing WPA deauth
And the same-line-overwrite visual issue. ugh.
This commit is contained in:
@@ -31,7 +31,8 @@ class AttackWPA(Attack):
|
|||||||
Color.p('\r{+} {O}waiting{W} for target to appear...')
|
Color.p('\r{+} {O}waiting{W} for target to appear...')
|
||||||
airodump_target = self.wait_for_target(airodump)
|
airodump_target = self.wait_for_target(airodump)
|
||||||
|
|
||||||
clients = airodump_target.clients
|
# Get client station MAC addresses
|
||||||
|
clients = [c.station for c in airodump_target.clients]
|
||||||
client_index = 0
|
client_index = 0
|
||||||
|
|
||||||
handshake = None
|
handshake = None
|
||||||
@@ -41,10 +42,13 @@ class AttackWPA(Attack):
|
|||||||
deauth_proc = None
|
deauth_proc = None
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
if not deauth_proc or deauth_proc.poll() != None:
|
||||||
Color.clear_line()
|
# Clear line only if we're not deauthing right now
|
||||||
|
Color.p('\r%s\r' % (' ' * 70))
|
||||||
Color.p('\r{+} waiting for {C}handshake{W}...')
|
Color.p('\r{+} waiting for {C}handshake{W}...')
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
# Find .cap file
|
# Find .cap file
|
||||||
cap_files = airodump.find_files(endswith='.cap')
|
cap_files = airodump.find_files(endswith='.cap')
|
||||||
if len(cap_files) == 0:
|
if len(cap_files) == 0:
|
||||||
@@ -71,16 +75,25 @@ class AttackWPA(Attack):
|
|||||||
# Deauth process is still running
|
# Deauth process is still running
|
||||||
time_since_deauth = time.time()
|
time_since_deauth = time.time()
|
||||||
|
|
||||||
|
# Look for new clients
|
||||||
|
airodump_target = self.wait_for_target(airodump)
|
||||||
|
for client in airodump_target.clients:
|
||||||
|
if client.station not in clients:
|
||||||
|
Color.pl('\r{+} discovered {G}client{W}:' +
|
||||||
|
' {C}%s{W}' % client.station)
|
||||||
|
Color.p(' ' * len(' [+] waiting for handshake... '))
|
||||||
|
clients.append(client.station)
|
||||||
|
|
||||||
# Send deauth to a client or broadcast
|
# Send deauth to a client or broadcast
|
||||||
if time.time()-time_since_deauth > Configuration.wpa_deauth_timeout:
|
if time.time()-time_since_deauth > Configuration.wpa_deauth_timeout:
|
||||||
# We are N seconds since last deauth was sent,
|
# We are N seconds since last deauth was sent,
|
||||||
# And the deauth process is not running.
|
# And the deauth process is not running.
|
||||||
if len(clients) == 0 or client_index >= len(clients):
|
if len(clients) == 0 or client_index >= len(clients):
|
||||||
deauth_proc = self.deauth(airodump_target.bssid)
|
deauth_proc = self.deauth(bssid)
|
||||||
client_index = 0
|
client_index = 0
|
||||||
else:
|
else:
|
||||||
client = clients[client_index]
|
client = clients[client_index]
|
||||||
deauth_proc = self.deauth(client.bssid)
|
deauth_proc = self.deauth(bssid, client)
|
||||||
client_index += 1
|
client_index += 1
|
||||||
time_since_deauth = time.time()
|
time_since_deauth = time.time()
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class Color(object):
|
|||||||
spaces = ' ' * Color.last_sameline_length
|
spaces = ' ' * Color.last_sameline_length
|
||||||
sys.stdout.write('\r%s\r' % spaces)
|
sys.stdout.write('\r%s\r' % spaces)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
Color.last_sameline_length = 0
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done")
|
Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done")
|
||||||
|
|||||||
Reference in New Issue
Block a user