From 0c5558fb7432bcd1492ca7f0f2a7a5a085bf5229 Mon Sep 17 00:00:00 2001 From: derv82 Date: Tue, 27 Feb 2018 20:07:51 -0500 Subject: [PATCH] Consolidate scan_time and pillage into one argument --- py/Arguments.py | 16 +++++------- py/Configuration.py | 8 ++---- py/Scanner.py | 63 +++++++++++++++++++++++---------------------- 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/py/Arguments.py b/py/Arguments.py index 5560620..6a5bb9e 100644 --- a/py/Arguments.py +++ b/py/Arguments.py @@ -17,12 +17,6 @@ class Arguments(object): # Global variables glob = parser.add_argument_group('SETTINGS') - glob.add_argument('-s', - action='store', - dest='scan_time', - metavar='[scantime]', - type=int, - help=Color.s('Seconds to scan before attacking (default: {G}ask{W})')) glob.add_argument('-i', action='store', dest='interface', @@ -79,9 +73,13 @@ class Arguments(object): help=Color.s('Number of deauth packets to send (default: {G}%d{W})' % Configuration.num_deauths)) glob.add_argument('-p', action='store', - dest='pillage', - type=bool, - help=Color.s('Pillage "All" mode to attack everything (default: {G}ask{W})')) + dest='scan_time', + nargs='?', + const=10, + metavar='scantime', + type=int, + help=Color.s('{G}Pillage{W}: Attack all targets after {C}scantime{W} seconds')) + glob.add_argument('--pillage', help=argparse.SUPPRESS, action='store', dest='scan_time', nargs='?', const=10, type=int) # WEP wep = parser.add_argument_group('WEP-RELATED') diff --git a/py/Configuration.py b/py/Configuration.py index aadccc1..0e78368 100644 --- a/py/Configuration.py +++ b/py/Configuration.py @@ -28,7 +28,7 @@ class Configuration(object): Configuration.verbose = 0 # Verbosity level. - Configuration.scan_time = 0 # Scan time + Configuration.scan_time = 0 # Time to wait before attacking all targets Configuration.all_targets = False # Run attacks against all targets automatically Configuration.tx_power = 0 # Wifi transmit power (0 is default) @@ -37,7 +37,6 @@ class Configuration(object): Configuration.target_essid = None # User-defined AP name Configuration.target_bssid = None # User-defined AP BSSID Configuration.five_ghz = False # Scan 5Ghz channels - Configuration.pillage = False # "All" mode to attack everything Configuration.random_mac = False # Should generate a random Mac address at startup. Configuration.no_deauth = False # Deauth hidden networks & WPA handshake targets Configuration.num_deauths = 1 # Number of deauth packets to send to each target. @@ -143,10 +142,7 @@ class Configuration(object): Color.pl('{+} {C}option:{W} targeting ESSID {G}%s{W}' % args.target_essid) if args.scan_time: Configuration.scan_time = args.scan_time - Color.pl('{+} {C}option:{W} scan time {G}%d{W}' % args.scan_time) - if args.pillage: - Configuration.verbose = args.pillage - Color.pl('{+} {C}option:{W} pillage {G}%d{W}' % args.verbose) + Color.pl('{+} {C}option:{W} ({G}pillage{W}) attack all targets after {G}%d{W}s' % args.scan_time) if args.verbose: Configuration.verbose = args.verbose Color.pl('{+} {C}option:{W} verbosity level {G}%d{W}' % args.verbose) diff --git a/py/Scanner.py b/py/Scanner.py index dc0640e..3bd32fe 100644 --- a/py/Scanner.py +++ b/py/Scanner.py @@ -23,14 +23,13 @@ class Scanner(object): self.targets = [] self.target = None # Specific target (based on ESSID/BSSID) - scan_time = Configuration.scan_time # currently in seconds - Color.pl("") # Loads airodump with interface/channel/etc from Configuration with Airodump() as airodump: try: - # Loop until interrupted (Ctrl+C) or until scan_time is reached (if scan_time was defined) - start_time = time() + # Loop until interrupted (Ctrl+C) + scan_start_time = time() + while True: if airodump.pid.poll() is not None: # Airodump process died! @@ -65,8 +64,10 @@ class Scanner(object): outline += " {G}%s{W}) " % ", ".join([x.essid for x in decloaked]) Color.clear_entire_line() Color.p(outline) - if scan_time > 0 and time() > (start_time + scan_time): + + if Configuration.scan_time > 0 and time() > scan_start_time + Configuration.scan_time: return + sleep(1) except KeyboardInterrupt: pass @@ -157,34 +158,34 @@ class Scanner(object): + " You may need to wait longer," + " or you may have issues with your wifi card") - if not (Configuration.pillage is True): - self.print_targets() - Color.clear_entire_line() - input_str = '{+} select target(s)' - input_str += ' ({G}1-%d{W})' % len(self.targets) - input_str += ' separated by commas, dashes' - input_str += ' or {G}all{W}: ' - - chosen_targets = [] - - for choice in raw_input(Color.s(input_str)).split(','): - if choice == 'all': - chosen_targets = self.targets - break - if '-' in choice: - # User selected a range - (lower,upper) = [int(x) - 1 for x in choice.split('-')] - for i in xrange(lower, min(len(self.targets), upper)): - chosen_targets.append(self.targets[i]) - elif choice.isdigit(): - choice = int(choice) - 1 - chosen_targets.append(self.targets[choice]) - else: - pass - return chosen_targets - else: + if Configuration.scan_time > 0: return self.targets + self.print_targets() + Color.clear_entire_line() + input_str = '{+} select target(s)' + input_str += ' ({G}1-%d{W})' % len(self.targets) + input_str += ' separated by commas, dashes' + input_str += ' or {G}all{W}: ' + + chosen_targets = [] + + for choice in raw_input(Color.s(input_str)).split(','): + if choice == 'all': + chosen_targets = self.targets + break + if '-' in choice: + # User selected a range + (lower,upper) = [int(x) - 1 for x in choice.split('-')] + for i in xrange(lower, min(len(self.targets), upper)): + chosen_targets.append(self.targets[i]) + elif choice.isdigit(): + choice = int(choice) - 1 + chosen_targets.append(self.targets[choice]) + else: + pass + return chosen_targets + if __name__ == '__main__': # Example displays targets and selects the appropriate one Configuration.initialize()