Various UI improvements, definitely works now
This commit is contained in:
@@ -45,9 +45,12 @@ class Aircrack(object):
|
|||||||
hex_key = ''
|
hex_key = ''
|
||||||
ascii_key = ''
|
ascii_key = ''
|
||||||
while len(hex_raw) > 0:
|
while len(hex_raw) > 0:
|
||||||
|
# HEX
|
||||||
if hex_key != '':
|
if hex_key != '':
|
||||||
hex_key += ':'
|
hex_key += ':'
|
||||||
hex_key += hex_raw[0:2]
|
hex_key += hex_raw[0:2]
|
||||||
|
|
||||||
|
# ASCII
|
||||||
# Convert hex to decimal
|
# Convert hex to decimal
|
||||||
code = int(hex_raw[0:2], 16)
|
code = int(hex_raw[0:2], 16)
|
||||||
if code < 32 or code > 127:
|
if code < 32 or code > 127:
|
||||||
@@ -55,10 +58,15 @@ class Aircrack(object):
|
|||||||
ascii_key = None
|
ascii_key = None
|
||||||
continue
|
continue
|
||||||
elif ascii_key == None:
|
elif ascii_key == None:
|
||||||
|
# We can't generate an Ascii key
|
||||||
continue
|
continue
|
||||||
# Convert decimal to char
|
# Convert decimal to char
|
||||||
ascii_key += chr(code)
|
ascii_key += chr(code)
|
||||||
|
|
||||||
|
# Trim first two characters
|
||||||
hex_raw = hex_raw[2:]
|
hex_raw = hex_raw[2:]
|
||||||
|
continue
|
||||||
|
|
||||||
return (hex_key, ascii_key)
|
return (hex_key, ascii_key)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -95,10 +95,21 @@ class Airodump(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def delete_airodump_temp_files(self):
|
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():
|
for fil in self.find_files():
|
||||||
os.remove(fil)
|
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):
|
def get_targets(self):
|
||||||
''' Parses airodump's CSV file, returns list of Targets '''
|
''' Parses airodump's CSV file, returns list of Targets '''
|
||||||
# Find the .CSV file
|
# Find the .CSV file
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class AttackWEP(Attack):
|
|||||||
ivs_only=True, # Only capture IVs packets
|
ivs_only=True, # Only capture IVs packets
|
||||||
output_file_prefix='wep') as airodump:
|
output_file_prefix='wep') as airodump:
|
||||||
|
|
||||||
|
Color.p('\r{+} {O}waiting{W} for target to appear...')
|
||||||
airodump_target = self.wait_for_target(airodump)
|
airodump_target = self.wait_for_target(airodump)
|
||||||
|
|
||||||
if self.fake_auth():
|
if self.fake_auth():
|
||||||
@@ -88,26 +89,24 @@ class AttackWEP(Attack):
|
|||||||
Color.pl('{+} {C}%s{W} WEP attack {G}successful{W}'
|
Color.pl('{+} {C}%s{W} WEP attack {G}successful{W}'
|
||||||
% attack_name)
|
% attack_name)
|
||||||
print ''
|
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:
|
if aireplay:
|
||||||
aireplay.stop()
|
aireplay.stop()
|
||||||
self.crack_result = CrackResultWEP(bssid, \
|
self.crack_result = CrackResultWEP(bssid, \
|
||||||
essid, \
|
essid, \
|
||||||
hex_key, \
|
hex_key, \
|
||||||
ascii_key)
|
ascii_key)
|
||||||
|
self.crack_result.dump()
|
||||||
return True
|
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
|
# Check number of IVs, crack if necessary
|
||||||
if airodump_target.ivs > Configuration.wep_crack_at_ivs:
|
if airodump_target.ivs > Configuration.wep_crack_at_ivs:
|
||||||
if not aircrack:
|
if not aircrack:
|
||||||
# Aircrack hasn't started yet. Start it.
|
# Aircrack hasn't started yet. Start it.
|
||||||
ivs_file = airodump.find_files(endswith='.ivs')[0]
|
ivs_file = airodump.find_files(endswith='.ivs')[0]
|
||||||
Color.pl('\n{+} started {C}cracking{W}')
|
|
||||||
aircrack = Aircrack(ivs_file)
|
aircrack = Aircrack(ivs_file)
|
||||||
|
|
||||||
elif not aircrack.is_running():
|
elif not aircrack.is_running():
|
||||||
@@ -124,7 +123,7 @@ class AttackWEP(Attack):
|
|||||||
if aircrack.pid.running_time() > Configuration.wep_restart_aircrack:
|
if aircrack.pid.running_time() > Configuration.wep_restart_aircrack:
|
||||||
aircrack.stop()
|
aircrack.stop()
|
||||||
ivs_file = airodump.find_files(endswith='.ivs')[0]
|
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'
|
' {C}%d{W} seconds, restarting'
|
||||||
% Configuration.wep_restart_aircrack)
|
% Configuration.wep_restart_aircrack)
|
||||||
aircrack = Aircrack(ivs_file)
|
aircrack = Aircrack(ivs_file)
|
||||||
@@ -153,7 +152,7 @@ class AttackWEP(Attack):
|
|||||||
print aireplay.get_output()
|
print aireplay.get_output()
|
||||||
break
|
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:
|
if airodump_target.ivs > previous_ivs:
|
||||||
time_unchanged_ivs = time.time()
|
time_unchanged_ivs = time.time()
|
||||||
elif Configuration.wep_restart_stale_ivs > 0:
|
elif Configuration.wep_restart_stale_ivs > 0:
|
||||||
@@ -161,12 +160,13 @@ class AttackWEP(Attack):
|
|||||||
if stale_seconds > Configuration.wep_restart_stale_ivs:
|
if stale_seconds > Configuration.wep_restart_stale_ivs:
|
||||||
# No new IVs within threshold, restart aireplay
|
# No new IVs within threshold, restart aireplay
|
||||||
aireplay.stop()
|
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'
|
' {C}%d{W} seconds of no new IVs'
|
||||||
% stale_seconds)
|
% stale_seconds)
|
||||||
aireplay = Aireplay(self.target, \
|
aireplay = Aireplay(self.target, \
|
||||||
wep_attack_type, \
|
wep_attack_type, \
|
||||||
client_mac=client_mac)
|
client_mac=client_mac)
|
||||||
|
time_unchanged_ivs = time.time()
|
||||||
previous_ivs = airodump_target.ivs
|
previous_ivs = airodump_target.ivs
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -179,7 +179,7 @@ class AttackWEP(Attack):
|
|||||||
Returns: True if successful,
|
Returns: True if successful,
|
||||||
False is unsuccesful.
|
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)
|
% self.target.bssid)
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
aireplay = Aireplay(self.target, 'fakeauth')
|
aireplay = Aireplay(self.target, 'fakeauth')
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ class Configuration(object):
|
|||||||
Configuration.wep_timeout = 600 # Seconds to wait before failing
|
Configuration.wep_timeout = 600 # Seconds to wait before failing
|
||||||
Configuration.wep_crack_at_ivs = 10000 # Minimum IVs to start cracking
|
Configuration.wep_crack_at_ivs = 10000 # Minimum IVs to start cracking
|
||||||
Configuration.require_fakeauth = False
|
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.
|
# Aireplay if IVs don't increaes.
|
||||||
# "0" means never restart.
|
# "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.
|
# before restarting the process.
|
||||||
# WEP-specific attacks
|
# WEP-specific attacks
|
||||||
Configuration.wep_fragment = True
|
Configuration.wep_fragment = True
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from Color import Color
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class CrackResultWEP(object):
|
class CrackResultWEP(object):
|
||||||
@@ -10,3 +12,16 @@ class CrackResultWEP(object):
|
|||||||
self.ascii_key = ascii_key
|
self.ascii_key = ascii_key
|
||||||
self.time = time.time()
|
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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user