Fixing WPA deauth

And the same-line-overwrite visual issue. ugh.
This commit is contained in:
derv82
2015-06-01 03:21:43 -07:00
parent 10c81feb9c
commit c298be6bd2
2 changed files with 19 additions and 5 deletions

View File

@@ -31,7 +31,8 @@ class AttackWPA(Attack):
Color.p('\r{+} {O}waiting{W} for target to appear...')
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
handshake = None
@@ -41,10 +42,13 @@ class AttackWPA(Attack):
deauth_proc = None
while True:
time.sleep(1)
Color.clear_line()
if not deauth_proc or deauth_proc.poll() != None:
# Clear line only if we're not deauthing right now
Color.p('\r%s\r' % (' ' * 70))
Color.p('\r{+} waiting for {C}handshake{W}...')
time.sleep(1)
# Find .cap file
cap_files = airodump.find_files(endswith='.cap')
if len(cap_files) == 0:
@@ -71,16 +75,25 @@ class AttackWPA(Attack):
# Deauth process is still running
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
if time.time()-time_since_deauth > Configuration.wpa_deauth_timeout:
# We are N seconds since last deauth was sent,
# And the deauth process is not running.
if len(clients) == 0 or client_index >= len(clients):
deauth_proc = self.deauth(airodump_target.bssid)
deauth_proc = self.deauth(bssid)
client_index = 0
else:
client = clients[client_index]
deauth_proc = self.deauth(client.bssid)
deauth_proc = self.deauth(bssid, client)
client_index += 1
time_since_deauth = time.time()
continue

View File

@@ -63,6 +63,7 @@ class Color(object):
spaces = ' ' * Color.last_sameline_length
sys.stdout.write('\r%s\r' % spaces)
sys.stdout.flush()
Color.last_sameline_length = 0
if __name__ == '__main__':
Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done")