Gracefully handle airodump crashing.
Apparently Airodump is capturing the SIGINT on some Ctrl+C presses. Wifite will print out that airodump crashed w/ the return code & command executed. Wifite will not change the list of targets if airodump crashes (to avoid wps:n/a).
This commit is contained in:
@@ -125,6 +125,7 @@ class Airodump(object):
|
|||||||
|
|
||||||
def get_targets(self, apply_filter=True):
|
def get_targets(self, apply_filter=True):
|
||||||
''' 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
|
||||||
csv_filename = None
|
csv_filename = None
|
||||||
for fil in self.find_files(endswith='-01.csv'):
|
for fil in self.find_files(endswith='-01.csv'):
|
||||||
@@ -157,6 +158,9 @@ class Airodump(object):
|
|||||||
# We decloaked a target!
|
# We decloaked a target!
|
||||||
self.decloaked_targets.append(new_target)
|
self.decloaked_targets.append(new_target)
|
||||||
|
|
||||||
|
if self.pid.poll() is not None:
|
||||||
|
raise Exception('Airodump has stopped')
|
||||||
|
|
||||||
self.targets = targets
|
self.targets = targets
|
||||||
self.deauth_hidden_targets()
|
self.deauth_hidden_targets()
|
||||||
|
|
||||||
|
|||||||
@@ -23,19 +23,19 @@ class Scanner(object):
|
|||||||
self.targets = []
|
self.targets = []
|
||||||
self.target = None # Specific target (based on ESSID/BSSID)
|
self.target = None # Specific target (based on ESSID/BSSID)
|
||||||
|
|
||||||
|
self.err_msg = None
|
||||||
|
|
||||||
Color.pl("")
|
Color.pl("")
|
||||||
# Loads airodump with interface/channel/etc from Configuration
|
# Loads airodump with interface/channel/etc from Configuration
|
||||||
with Airodump() as airodump:
|
try:
|
||||||
try:
|
with Airodump() as airodump:
|
||||||
# Loop until interrupted (Ctrl+C)
|
# Loop until interrupted (Ctrl+C)
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
if airodump.pid.poll() is not None:
|
if airodump.pid.poll() is not None:
|
||||||
# Airodump process died!
|
# Airodump process died
|
||||||
raise Exception(
|
self.err_msg = '\r{!} {R}Airodump exited unexpectedly (Code: %d){O} Command: {W}%s' % (airodump.pid.poll(), " ".join(airodump.pid.command))
|
||||||
"Airodump exited unexpectedly! " +
|
raise KeyboardInterrupt
|
||||||
"Command ran: %s"
|
|
||||||
% ' '.join(airodump.pid.command))
|
|
||||||
|
|
||||||
self.targets = airodump.get_targets()
|
self.targets = airodump.get_targets()
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ class Scanner(object):
|
|||||||
Color.clear_entire_line()
|
Color.clear_entire_line()
|
||||||
Color.p(outline)
|
Color.p(outline)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def found_target(self):
|
def found_target(self):
|
||||||
'''
|
'''
|
||||||
@@ -145,6 +145,9 @@ class Scanner(object):
|
|||||||
''' Asks user to select target(s) '''
|
''' Asks user to select target(s) '''
|
||||||
|
|
||||||
if len(self.targets) == 0:
|
if len(self.targets) == 0:
|
||||||
|
if self.err_msg is not None:
|
||||||
|
Color.pl(self.err_msg)
|
||||||
|
|
||||||
# TODO Print a more-helpful reason for failure.
|
# TODO Print a more-helpful reason for failure.
|
||||||
# 1. Link to wireless drivers wiki,
|
# 1. Link to wireless drivers wiki,
|
||||||
# 2. How to check if your device supporst monitor mode,
|
# 2. How to check if your device supporst monitor mode,
|
||||||
@@ -155,6 +158,10 @@ class Scanner(object):
|
|||||||
|
|
||||||
self.print_targets()
|
self.print_targets()
|
||||||
Color.clear_entire_line()
|
Color.clear_entire_line()
|
||||||
|
|
||||||
|
if self.err_msg is not None:
|
||||||
|
Color.pl(self.err_msg)
|
||||||
|
|
||||||
input_str = '{+} select target(s)'
|
input_str = '{+} select target(s)'
|
||||||
input_str += ' ({G}1-%d{W})' % len(self.targets)
|
input_str += ' ({G}1-%d{W})' % len(self.targets)
|
||||||
input_str += ' separated by commas, dashes'
|
input_str += ' separated by commas, dashes'
|
||||||
|
|||||||
Reference in New Issue
Block a user