Skip to content

Commit

Permalink
Ignore multiple ESSIDs with -E derv82#166
Browse files Browse the repository at this point in the history
  • Loading branch information
simonblack committed Dec 14, 2018
1 parent 04b818d commit 795e3c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
11 changes: 6 additions & 5 deletions wifite/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 5 additions & 5 deletions wifite/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions wifite/tools/airodump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]), '')
Expand Down
2 changes: 1 addition & 1 deletion wifite/util/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 795e3c1

Please sign in to comment.