Various UI improvements, definitely works now

This commit is contained in:
derv82
2015-05-31 15:03:20 -07:00
parent 1d6d0aedb3
commit 50538168e2
5 changed files with 48 additions and 14 deletions

View File

@@ -45,9 +45,12 @@ class Aircrack(object):
hex_key = ''
ascii_key = ''
while len(hex_raw) > 0:
# HEX
if hex_key != '':
hex_key += ':'
hex_key += hex_raw[0:2]
# ASCII
# Convert hex to decimal
code = int(hex_raw[0:2], 16)
if code < 32 or code > 127:
@@ -55,10 +58,15 @@ class Aircrack(object):
ascii_key = None
continue
elif ascii_key == None:
# We can't generate an Ascii key
continue
# Convert decimal to char
ascii_key += chr(code)
# Trim first two characters
hex_raw = hex_raw[2:]
continue
return (hex_key, ascii_key)
if __name__ == '__main__':

View File

@@ -95,10 +95,21 @@ class Airodump(object):
return result
def delete_airodump_temp_files(self):
''' Deletes airodump* files in the temp directory '''
'''
Deletes airodump* files in the temp directory.
Also deletes replay_*.cap and *.xor files in pwd.
'''
# Remove all temp files
for fil in self.find_files():
os.remove(fil)
# Remove .cap and .xor files from pwd
for fil in os.listdir('.'):
if fil.startswith('replay_') and fil.endswith('.cap'):
os.remove(fil)
if fil.endswith('.xor'):
os.remove(fil)
def get_targets(self):
''' Parses airodump's CSV file, returns list of Targets '''
# Find the .CSV file

View File

@@ -33,6 +33,7 @@ class AttackWEP(Attack):
ivs_only=True, # Only capture IVs packets
output_file_prefix='wep') as airodump:
Color.p('\r{+} {O}waiting{W} for target to appear...')
airodump_target = self.wait_for_target(airodump)
if self.fake_auth():
@@ -88,26 +89,24 @@ class AttackWEP(Attack):
Color.pl('{+} {C}%s{W} WEP attack {G}successful{W}'
% attack_name)
print ''
if essid:
Color.pl('{+} ESSID: {C}%s{W}' % essid)
Color.pl('{+} BSSID: {C}%s{W}' % bssid)
Color.pl('{+} Hex Key: {G}%s{W}' % hex_key)
if ascii_key:
Color.pl('{+} Ascii Key: {G}%s{W}' % ascii_key)
if aireplay:
aireplay.stop()
self.crack_result = CrackResultWEP(bssid, \
essid, \
hex_key, \
ascii_key)
self.crack_result.dump()
return True
if aircrack and aircrack.is_running():
# Aircrack is running in the background.
Color.p('and {C}cracking{W}')
# Check number of IVs, crack if necessary
if airodump_target.ivs > Configuration.wep_crack_at_ivs:
if not aircrack:
# Aircrack hasn't started yet. Start it.
ivs_file = airodump.find_files(endswith='.ivs')[0]
Color.pl('\n{+} started {C}cracking{W}')
aircrack = Aircrack(ivs_file)
elif not aircrack.is_running():
@@ -124,7 +123,7 @@ class AttackWEP(Attack):
if aircrack.pid.running_time() > Configuration.wep_restart_aircrack:
aircrack.stop()
ivs_file = airodump.find_files(endswith='.ivs')[0]
Color.pl('{+} {C}aircrack{W} running more than' +
Color.pl('\n{+} {C}aircrack{W} ran for more than' +
' {C}%d{W} seconds, restarting'
% Configuration.wep_restart_aircrack)
aircrack = Aircrack(ivs_file)
@@ -153,7 +152,7 @@ class AttackWEP(Attack):
print aireplay.get_output()
break
# Check if IVS stopped flowing (same for > N seconds)
# Check if IVs stopped flowing (same for > N seconds)
if airodump_target.ivs > previous_ivs:
time_unchanged_ivs = time.time()
elif Configuration.wep_restart_stale_ivs > 0:
@@ -161,12 +160,13 @@ class AttackWEP(Attack):
if stale_seconds > Configuration.wep_restart_stale_ivs:
# No new IVs within threshold, restart aireplay
aireplay.stop()
Color.pl('{!} restarting {C}aireplay{W} after' +
Color.pl('\n{!} restarting {C}aireplay{W} after' +
' {C}%d{W} seconds of no new IVs'
% stale_seconds)
aireplay = Aireplay(self.target, \
wep_attack_type, \
client_mac=client_mac)
time_unchanged_ivs = time.time()
previous_ivs = airodump_target.ivs
time.sleep(1)
@@ -179,7 +179,7 @@ class AttackWEP(Attack):
Returns: True if successful,
False is unsuccesful.
'''
Color.p('{+} attempting {G}fake-authentication{W} with {C}%s{W}...'
Color.p('\r{+} attempting {G}fake-authentication{W} with {C}%s{W}...'
% self.target.bssid)
start_time = time.time()
aireplay = Aireplay(self.target, 'fakeauth')

View File

@@ -34,10 +34,10 @@ class Configuration(object):
Configuration.wep_timeout = 600 # Seconds to wait before failing
Configuration.wep_crack_at_ivs = 10000 # Minimum IVs to start cracking
Configuration.require_fakeauth = False
Configuration.wep_restart_stale_ivs = 30 # Seconds to wait before restarting
Configuration.wep_restart_stale_ivs = 11 # Seconds to wait before restarting
# Aireplay if IVs don't increaes.
# "0" means never restart.
Configuration.wep_restart_aircrack = 180 # Seconds to give aircrack to crack
Configuration.wep_restart_aircrack = 30 # Seconds to give aircrack to crack
# before restarting the process.
# WEP-specific attacks
Configuration.wep_fragment = True

View File

@@ -1,5 +1,7 @@
#!/usr/bin/python
from Color import Color
import time
class CrackResultWEP(object):
@@ -10,3 +12,16 @@ class CrackResultWEP(object):
self.ascii_key = ascii_key
self.time = time.time()
def dump(self):
if self.essid:
Color.pl('{+} ESSID: {C}%s{W}' % self.essid)
Color.pl('{+} BSSID: {C}%s{W}' % self.bssid)
Color.pl('{+} Encryption: {C}WEP{W}')
Color.pl('{+} Hex Key: {G}%s{W}' % self.hex_key)
if self.ascii_key:
Color.pl('{+} Ascii Key: {G}%s{W}' % self.ascii_key)
if __name__ == '__main__':
crw = CrackResultWEP('AA:BB:CC:DD:EE:FF', 'Test Router', '00:01:02:03:04', 'abcde')
crw.dump()