Skip to content

Commit 68d238c

Browse files
refactor:(config.py): add random mac logic
1 parent 80ffa3d commit 68d238c

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

wifite/config.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Configuration(object):
4141
pmkid_timeout = None
4242
print_stack_traces = None
4343
random_mac = None
44+
random_mac_vendor = None
4445
require_fakeauth = None
4546
scan_time = None
4647
show_bssids = None
@@ -326,8 +327,8 @@ def get_monitor_mode_interface(cls):
326327
# Interface wasn't defined, select it!
327328
from .tools.airmon import Airmon
328329
cls.interface = Airmon.ask()
329-
if cls.random_mac:
330-
Macchanger.random()
330+
if cls.random_mac or cls.random_mac_vendor:
331+
Macchanger.random(full_random=not cls.random_mac_vendor)
331332

332333
@classmethod
333334
def load_from_arguments(cls):
@@ -578,9 +579,22 @@ def _validate_wpasec_config(cls):
578579
def parse_settings_args(cls, args):
579580
"""Parses basic settings/configurations from arguments."""
580581

581-
if args.random_mac:
582-
cls.random_mac = True
583-
Color.pl('{+} {C}option:{W} using {G}random mac address{W} when scanning & attacking')
582+
if args.random_mac or args.random_mac_vendor:
583+
if args.random_mac and args.random_mac_vendor:
584+
Color.pl('{!} {O}Warning: Cannot use both --random-mac and --random-mac-vendor')
585+
Color.pl('{+} {W}Falling back to {C}--random-mac{W} (full random) for better privacy')
586+
args.random_mac_vendor = False
587+
588+
if args.random_mac:
589+
cls.random_mac = True
590+
cls.random_mac_vendor = False
591+
mode_str = "full random (maximum privacy)"
592+
else:
593+
cls.random_mac_vendor = True
594+
cls.random_mac = False
595+
mode_str = "vendor-preserved (better compatibility)"
596+
597+
Color.pl('{+} {C}option:{W} using {G}random MAC address{W} ({C}%s{W}) when scanning & attacking' % mode_str)
584598

585599
if args.channel:
586600
chn_arg_re = re.compile(r"^\d+((,\d+)|(-\d+,\d+))*(-\d+)?$")

0 commit comments

Comments
 (0)