Lots of changes to improve WEP, but don't actually improve WEP.
This commit is contained in:
@@ -10,7 +10,9 @@ import os
|
||||
class Aircrack(object):
|
||||
def __init__(self, ivs_file=None):
|
||||
|
||||
self.cracked_file = Configuration.temp() + 'wepkey.txt'
|
||||
self.cracked_file = os.path.abspath(
|
||||
os.path.join(
|
||||
Configuration.temp(), 'wepkey.txt'))
|
||||
|
||||
# Delete previous cracked files
|
||||
if os.path.exists(self.cracked_file):
|
||||
@@ -20,8 +22,11 @@ class Aircrack(object):
|
||||
'aircrack-ng',
|
||||
'-a', '1',
|
||||
'-l', self.cracked_file,
|
||||
ivs_file
|
||||
]
|
||||
if type(ivs_file) is str:
|
||||
ivs_file = [ivs_file]
|
||||
|
||||
command.extend(ivs_file)
|
||||
|
||||
self.pid = Process(command, devnull=True)
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class Aireplay(Thread):
|
||||
matches = offset_re.match(line)
|
||||
if matches:
|
||||
self.xor_percent = matches.group(1)
|
||||
self.status = "Generating .xor (%s)..." % matches.group(1)
|
||||
self.status = "Generating .xor (%s)..." % self.xor_percent
|
||||
|
||||
# (DONE) Saving keystream in replay_dec-0516-202246.xor
|
||||
saving_re = re.compile(r"Saving keystream in (.*\.xor)")
|
||||
@@ -207,7 +207,7 @@ class Aireplay(Thread):
|
||||
saving_re = re.compile(r"Saving keystream in (.*\.xor)")
|
||||
matches = saving_re.match(line)
|
||||
if matches:
|
||||
self.status = 'saving keystream to %s' % saving_re.group(1)
|
||||
self.status = 'saving keystream to %s' % matches.group(1)
|
||||
|
||||
# XX:XX:XX Now you can build a packet with packetforge-ng out of that 1500 bytes keystream
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class Airodump(object):
|
||||
|
||||
def __init__(self, interface=None, channel=None, encryption=None,\
|
||||
wps=False, target_bssid=None, output_file_prefix='airodump',\
|
||||
ivs_only=False, skip_wps=False):
|
||||
ivs_only=False, skip_wps=False, delete_existing_files=True):
|
||||
'''Sets up airodump arguments, doesn't start process yet.'''
|
||||
|
||||
Configuration.initialize()
|
||||
@@ -46,6 +46,8 @@ class Airodump(object):
|
||||
self.decloaked_bssids = set()
|
||||
self.decloaked_times = {} # Map of BSSID(str) -> epoch(int) of last deauth
|
||||
|
||||
self.delete_existing_files = delete_existing_files
|
||||
|
||||
|
||||
def __enter__(self):
|
||||
'''
|
||||
@@ -53,7 +55,8 @@ class Airodump(object):
|
||||
Called at start of 'with Airodump(...) as x:'
|
||||
Actually starts the airodump process.
|
||||
'''
|
||||
self.delete_airodump_temp_files()
|
||||
if self.delete_existing_files:
|
||||
self.delete_airodump_temp_files(self.output_file_prefix)
|
||||
|
||||
self.csv_file_prefix = Configuration.temp() + self.output_file_prefix
|
||||
|
||||
@@ -88,30 +91,35 @@ class Airodump(object):
|
||||
# Kill the process
|
||||
self.pid.interrupt()
|
||||
|
||||
# Delete temp files
|
||||
self.delete_airodump_temp_files()
|
||||
if self.delete_existing_files:
|
||||
self.delete_airodump_temp_files(self.output_file_prefix)
|
||||
|
||||
|
||||
def find_files(self, endswith=None):
|
||||
return self.find_files_by_output_prefix(self.output_file_prefix, endswith=endswith)
|
||||
|
||||
@classmethod
|
||||
def find_files_by_output_prefix(cls, output_file_prefix, endswith=None):
|
||||
''' Finds all files in the temp directory that start with the output_file_prefix '''
|
||||
result = []
|
||||
temp = Configuration.temp()
|
||||
for fil in os.listdir(temp):
|
||||
if not fil.startswith(self.output_file_prefix):
|
||||
if not fil.startswith(output_file_prefix):
|
||||
continue
|
||||
|
||||
if not endswith or fil.endswith(endswith):
|
||||
if endswith is None or fil.endswith(endswith):
|
||||
result.append(os.path.join(temp, fil))
|
||||
|
||||
return result
|
||||
|
||||
def delete_airodump_temp_files(self):
|
||||
@classmethod
|
||||
def delete_airodump_temp_files(cls, output_file_prefix):
|
||||
'''
|
||||
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 cls.find_files_by_output_prefix(output_file_prefix):
|
||||
os.remove(fil)
|
||||
|
||||
# Remove .cap and .xor files from pwd
|
||||
@@ -119,12 +127,18 @@ class Airodump(object):
|
||||
if fil.startswith('replay_') and fil.endswith('.cap') or fil.endswith('.xor'):
|
||||
os.remove(fil)
|
||||
|
||||
# Remove replay/cap/xor files from temp
|
||||
temp_dir = Configuration.temp()
|
||||
for fil in os.listdir(temp_dir):
|
||||
if fil.startswith('replay_') and fil.endswith('.cap') or fil.endswith('.xor'):
|
||||
os.remove(os.path.join(temp_dir, fil))
|
||||
|
||||
def get_targets(self, apply_filter=True):
|
||||
''' Parses airodump's CSV file, returns list of Targets '''
|
||||
|
||||
# Find the .CSV file
|
||||
csv_filename = None
|
||||
for fil in self.find_files(endswith='-01.csv'):
|
||||
for fil in self.find_files(endswith='.csv'):
|
||||
csv_filename = fil # Found the file
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user