Created PMKID argument group (#136)

* Added PMKID argument group
This commit is contained in:
WhiteOnBlackCode
2018-09-09 19:47:54 +03:00
committed by derv
parent 710dd98b66
commit 355f891d0f
2 changed files with 34 additions and 29 deletions

View File

@@ -31,6 +31,7 @@ class Arguments(object):
self._add_wep_args(parser.add_argument_group(Color.s('{C}WEP{W}'))) self._add_wep_args(parser.add_argument_group(Color.s('{C}WEP{W}')))
self._add_wpa_args(parser.add_argument_group(Color.s('{C}WPA{W}'))) self._add_wpa_args(parser.add_argument_group(Color.s('{C}WPA{W}')))
self._add_wps_args(parser.add_argument_group(Color.s('{C}WPS{W}'))) self._add_wps_args(parser.add_argument_group(Color.s('{C}WPS{W}')))
self._add_pmkid_args(parser.add_argument_group(Color.s('{C}PMKID{W}')))
self._add_eviltwin_args(parser.add_argument_group(Color.s('{C}EVIL TWIN{W}'))) self._add_eviltwin_args(parser.add_argument_group(Color.s('{C}EVIL TWIN{W}')))
self._add_command_args(parser.add_argument_group(Color.s('{C}COMMANDS{W}'))) self._add_command_args(parser.add_argument_group(Color.s('{C}COMMANDS{W}')))
@@ -292,23 +293,6 @@ class Arguments(object):
wpa.add_argument('-wpa', help=argparse.SUPPRESS, action='store_true', wpa.add_argument('-wpa', help=argparse.SUPPRESS, action='store_true',
dest='wpa_filter') dest='wpa_filter')
wpa.add_argument('--pmkid',
action='store_true',
dest='use_pmkid_only',
help=Color.s('{O}Only{W} use {C}PMKID capture{W}, avoids other WPS & ' +
'WPA attacks (default: {G}off{W})'))
# Alias
wpa.add_argument('-pmkid', action='store_true', dest='use_pmkid_only',
help=argparse.SUPPRESS)
wpa.add_argument('--pmkid-timeout',
action='store',
dest='pmkid_timeout',
metavar='[sec]',
type=int,
help=self._verbose('Time to wait for PMKID capture ' +
'(default: {G}%d{W} seconds)' % self.config.pmkid_timeout))
wpa.add_argument('--hs-dir', wpa.add_argument('--hs-dir',
action='store', action='store',
dest='wpa_handshake_dir', dest='wpa_handshake_dir',
@@ -443,6 +427,22 @@ class Arguments(object):
wps.add_argument('-wpsto', help=argparse.SUPPRESS, action='store', wps.add_argument('-wpsto', help=argparse.SUPPRESS, action='store',
dest='wps_timeout_threshold', type=int) dest='wps_timeout_threshold', type=int)
def _add_pmkid_args(self, pmkid):
pmkid.add_argument('--pmkid',
action='store_true',
dest='use_pmkid_only',
help=Color.s('{O}Only{W} use {C}PMKID capture{W}, avoids other WPS & ' +
'WPA attacks (default: {G}off{W})'))
# Alias
pmkid.add_argument('-pmkid', help=argparse.SUPPRESS, action='store_true', dest='use_pmkid_only')
pmkid.add_argument('--pmkid-timeout',
action='store',
dest='pmkid_timeout',
metavar='[sec]',
type=int,
help=Color.s('Time to wait for PMKID capture ' +
'(default: {G}%d{W} seconds)' % self.config.pmkid_timeout))
def _add_command_args(self, commands): def _add_command_args(self, commands):
commands.add_argument('--cracked', commands.add_argument('--cracked',
@@ -470,7 +470,7 @@ class Arguments(object):
if __name__ == '__main__': if __name__ == '__main__':
from .util.color import Color from .util.color import Color
from config import Configuration from .config import Configuration
Configuration.initialize(False) Configuration.initialize(False)
a = Arguments(Configuration) a = Arguments(Configuration)
args = a.args args = a.args

View File

@@ -78,6 +78,8 @@ class Configuration(object):
cls.wpa_handshake_dir = 'hs' # Dir to store handshakes cls.wpa_handshake_dir = 'hs' # Dir to store handshakes
cls.wpa_strip_handshake = False # Strip non-handshake packets cls.wpa_strip_handshake = False # Strip non-handshake packets
cls.ignore_old_handshakes = False # Always fetch a new handshake cls.ignore_old_handshakes = False # Always fetch a new handshake
# PMKID variables
cls.use_pmkid_only = False # Only use PMKID Capture+Crack attack cls.use_pmkid_only = False # Only use PMKID Capture+Crack attack
cls.pmkid_timeout = 30 # Time to wait for PMKID capture cls.pmkid_timeout = 30 # Time to wait for PMKID capture
@@ -141,6 +143,7 @@ class Configuration(object):
cls.parse_wep_args(args) cls.parse_wep_args(args)
cls.parse_wpa_args(args) cls.parse_wpa_args(args)
cls.parse_wps_args(args) cls.parse_wps_args(args)
cls.parse_pmkid_args(args)
cls.parse_encryption() cls.parse_encryption()
# EvilTwin # EvilTwin
@@ -308,14 +311,6 @@ class Configuration(object):
Color.pl('{+} {C}option:{W} will {O}ignore{W} existing handshakes ' + Color.pl('{+} {C}option:{W} will {O}ignore{W} existing handshakes ' +
'(force capture)') '(force capture)')
if args.use_pmkid_only:
cls.use_pmkid_only = True
Color.pl('{+} {C}option:{W} will ONLY use {C}PMKID{W} attack on WPA networks')
if args.pmkid_timeout:
cls.pmkid_timeout = args.pmkid_timeout
Color.pl('{+} {C}option:{W} will wait {G}%d{W} seconds during {C}PMKID{W} capture')
if args.wpa_handshake_dir: if args.wpa_handshake_dir:
cls.wpa_handshake_dir = args.wpa_handshake_dir cls.wpa_handshake_dir = args.wpa_handshake_dir
Color.pl('{+} {C}option:{W} will store handshakes to ' + Color.pl('{+} {C}option:{W} will store handshakes to ' +
@@ -360,7 +355,7 @@ class Configuration(object):
'(no {O}Pixie-Dust{W}) on targets') '(no {O}Pixie-Dust{W}) on targets')
if args.use_bully: if args.use_bully:
from tools.bully import Bully from .tools.bully import Bully
if not Bully.exists(): if not Bully.exists():
Color.pl('{!} {R}Bully not found. Defaulting to {O}reaver{W}') Color.pl('{!} {R}Bully not found. Defaulting to {O}reaver{W}')
cls.use_bully = False cls.use_bully = False
@@ -388,6 +383,16 @@ class Configuration(object):
cls.wps_ignore_lock = True cls.wps_ignore_lock = True
Color.pl('{+} {C}option:{W} will {O}ignore{W} WPS lock-outs') Color.pl('{+} {C}option:{W} will {O}ignore{W} WPS lock-outs')
@classmethod
def parse_pmkid_args(cls, args):
if args.use_pmkid_only:
cls.use_pmkid_only = True
Color.pl('{+} {C}option:{W} will ONLY use {C}PMKID{W} attack on WPA networks')
if args.pmkid_timeout:
cls.pmkid_timeout = args.pmkid_timeout
Color.pl('{+} {C}option:{W} will wait {G}%d seconds{W} during {C}PMKID{W} capture' % args.pmkid_timeout)
@classmethod @classmethod
def parse_encryption(cls): def parse_encryption(cls):
'''Adjusts encryption filter (WEP and/or WPA and/or WPS)''' '''Adjusts encryption filter (WEP and/or WPA and/or WPS)'''
@@ -410,9 +415,9 @@ class Configuration(object):
def parse_wep_attacks(cls): def parse_wep_attacks(cls):
'''Parses and sets WEP-specific args (-chopchop, -fragment, etc)''' '''Parses and sets WEP-specific args (-chopchop, -fragment, etc)'''
cls.wep_attacks = [] cls.wep_attacks = []
import sys from sys import argv
seen = set() seen = set()
for arg in sys.argv: for arg in argv:
if arg in seen: continue if arg in seen: continue
seen.add(arg) seen.add(arg)
if arg == '-arpreplay': cls.wep_attacks.append('replay') if arg == '-arpreplay': cls.wep_attacks.append('replay')