From 795e3c12924e599365aadab2867f9441c17c9216 Mon Sep 17 00:00:00 2001 From: Simon Black Date: Fri, 14 Dec 2018 03:10:00 -0500 Subject: [PATCH] Ignore multiple ESSIDs with -E #166 --- wifite/args.py | 11 ++++++----- wifite/config.py | 10 +++++----- wifite/tools/airodump.py | 6 ++++-- wifite/util/scanner.py | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/wifite/args.py b/wifite/args.py index 6941aef4a..52278384d 100755 --- a/wifite/args.py +++ b/wifite/args.py @@ -125,14 +125,15 @@ def _add_global_args(self, glob): dest='target_essid', type=str) glob.add_argument('-E', - action='store', - dest='ignore_essid', + action='append', + dest='ignore_essids', metavar='[text]', type=str, default=None, - help=self._verbose('Hides targets with ESSIDs that match the given text')) - glob.add_argument('--ignore-essid', help=argparse.SUPPRESS, action='store', - dest='ignore_essid', type=str) + help=self._verbose('Hides targets with ESSIDs that match the given text. ' + 'Can be used more than once.')) + glob.add_argument('--ignore-essid', help=argparse.SUPPRESS, action='append', + dest='ignore_essids', type=str) glob.add_argument('--clients-only', action='store_true', diff --git a/wifite/config.py b/wifite/config.py index 7ac60c829..9743e60d3 100755 --- a/wifite/config.py +++ b/wifite/config.py @@ -42,7 +42,7 @@ def initialize(cls, load_interface=True): cls.target_channel = None # User-defined channel to scan cls.target_essid = None # User-defined AP name cls.target_bssid = None # User-defined AP BSSID - cls.ignore_essid = None # ESSIDs to ignore + cls.ignore_essids = None # ESSIDs to ignore cls.clients_only = False # Only show targets that have associated clients cls.five_ghz = False # Scan 5Ghz channels cls.show_bssids = False # Show BSSIDs in targets list @@ -245,10 +245,10 @@ def parse_settings_args(cls, args): cls.target_essid = args.target_essid Color.pl('{+} {C}option:{W} targeting ESSID {G}%s{W}' % args.target_essid) - if args.ignore_essid is not None: - cls.ignore_essid = args.ignore_essid - Color.pl('{+} {C}option:{W} {O}ignoring ESSIDs that include {R}%s{W}' % ( - args.ignore_essid)) + if args.ignore_essids is not None: + cls.ignore_essids = args.ignore_essids + Color.pl('{+} {C}option: {O}ignoring ESSID(s): {R}%s{W}' % + ', '.join(args.ignore_essids)) if args.clients_only == True: cls.clients_only = True diff --git a/wifite/tools/airodump.py b/wifite/tools/airodump.py index 51d7a7983..0c7445cde 100755 --- a/wifite/tools/airodump.py +++ b/wifite/tools/airodump.py @@ -275,11 +275,13 @@ def filter_targets(targets, skip_wps=False): i = 0 while i < len(result): - if result[i].essid is not None and Configuration.ignore_essid is not None and Configuration.ignore_essid.lower() in result[i].essid.lower(): + if result[i].essid is not None and\ + Configuration.ignore_essids is not None and\ + result[i].essid in Configuration.ignore_essids: result.pop(i) elif bssid and result[i].bssid.lower() != bssid.lower(): result.pop(i) - elif essid and result[i].essid and result[i].essid.lower() != essid.lower(): + elif essid and result[i].essid and result[i].essid != essid: result.pop(i) elif manufacturer and result[i].bssid: o = Configuration.manufacturers.get(''.join(result[i].bssid.split(':')[:3]), '') diff --git a/wifite/util/scanner.py b/wifite/util/scanner.py index 1c7e6f095..d9039c82f 100755 --- a/wifite/util/scanner.py +++ b/wifite/util/scanner.py @@ -93,7 +93,7 @@ def found_target(self): if bssid and target.bssid and bssid.lower() == target.bssid.lower(): self.target = target break - if essid and target.essid and essid.lower() == target.essid.lower(): + if essid and target.essid and essid == target.essid: self.target = target break