Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion wifite/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ def _add_global_args(self, glob):
'--random-mac',
action='store_true',
dest='random_mac',
help=Color.s('Randomize wireless card MAC address (default: {G}off{W})'))
help=Color.s('Randomize wireless card MAC address completely (better privacy) (default: {G}off{W})'))

glob.add_argument('--random-mac-vendor',
action='store_true',
dest='random_mac_vendor',
help=Color.s('Randomize wireless card MAC address but keep vendor bytes (better compatibility) (default: {G}off{W})'))

glob.add_argument('-p',
action='store',
Expand Down
24 changes: 19 additions & 5 deletions wifite/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Configuration(object):
pmkid_timeout = None
print_stack_traces = None
random_mac = None
random_mac_vendor = None
require_fakeauth = None
scan_time = None
show_bssids = None
Expand Down Expand Up @@ -326,8 +327,8 @@ def get_monitor_mode_interface(cls):
# Interface wasn't defined, select it!
from .tools.airmon import Airmon
cls.interface = Airmon.ask()
if cls.random_mac:
Macchanger.random()
if cls.random_mac or cls.random_mac_vendor:
Macchanger.random(full_random=not cls.random_mac_vendor)

@classmethod
def load_from_arguments(cls):
Expand Down Expand Up @@ -578,9 +579,22 @@ def _validate_wpasec_config(cls):
def parse_settings_args(cls, args):
"""Parses basic settings/configurations from arguments."""

if args.random_mac:
cls.random_mac = True
Color.pl('{+} {C}option:{W} using {G}random mac address{W} when scanning & attacking')
if args.random_mac or args.random_mac_vendor:
if args.random_mac and args.random_mac_vendor:
Color.pl('{!} {O}Warning: Cannot use both --random-mac and --random-mac-vendor')
Color.pl('{+} {W}Falling back to {C}--random-mac{W} (full random) for better privacy')
args.random_mac_vendor = False

if args.random_mac:
cls.random_mac = True
cls.random_mac_vendor = False
mode_str = "full random (maximum privacy)"
else:
cls.random_mac_vendor = True
cls.random_mac = False
mode_str = "vendor-preserved (better compatibility)"

Color.pl('{+} {C}option:{W} using {G}random MAC address{W} ({C}%s{W}) when scanning & attacking' % mode_str)

if args.channel:
chn_arg_re = re.compile(r"^\d+((,\d+)|(-\d+,\d+))*(-\d+)?$")
Expand Down
6 changes: 4 additions & 2 deletions wifite/tools/macchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def reset(cls):
Color.pl('\r{+} {C}macchanger{W}: reset mac address back to {C}%s{W} on {C}%s{W}' % (new_mac, iface))

@classmethod
def random(cls):
def random(cls, full_random=True):
from ..util.process import Process
if not Process.exists('macchanger'):
Color.pl('{!} {R}macchanger: {O}not installed')
Expand All @@ -72,7 +72,9 @@ def random(cls):

# -r to use random MAC address
# -e to keep vendor bytes the same
if cls.down_macch_up(iface, ['-e']):
option = "-r" if full_random else "-e"

if cls.down_macch_up(iface, [option]):
cls.is_changed = True
new_mac = Ip.get_mac(iface)

Expand Down
Loading