Verbose mode, colored help, highlighted error trace

This commit is contained in:
derv82
2015-08-04 22:05:16 -07:00
parent ac50614e5b
commit 95b7296444
4 changed files with 75 additions and 59 deletions

View File

@@ -131,14 +131,11 @@ class Wifite(object):
""" Displays ASCII art of the highest caliber. """ """ Displays ASCII art of the highest caliber. """
Color.pl("") Color.pl("")
Color.pl("{G} .;' `;, ") Color.pl("{G} .;' `;, ")
Color.pl("{G} .;' ,;' `;, `;, " + Color.pl("{G} .;' ,;' `;, `;, {W}WiFite v%.2f" % Configuration.version)
"{W}WiFite v%.2f" % Configuration.version)
Color.pl("{G}.;' ,;' ,;' `;, `;, `;, ") Color.pl("{G}.;' ,;' ,;' `;, `;, `;, ")
Color.pl("{G}:: :: : {GR}( ){G} : :: :: " + Color.pl("{G}:: :: : {GR}( ){G} : :: :: {W}Automated Wireless Auditor")
"{W}automated wireless auditor")
Color.pl("{G}':. ':. ':. {GR}/_\\{G} ,:' ,:' ,:' ") Color.pl("{G}':. ':. ':. {GR}/_\\{G} ,:' ,:' ,:' ")
Color.pl("{G} ':. ':. {GR}/___\\{G} ,:' ,:' " + Color.pl("{G} ':. ':. {GR}/___\\{G} ,:' ,:' {C}https://github.com/derv82/wifite2{W}")
"{W}designed for Linux")
Color.pl("{G} ':. {GR}/_____\\{G} ,:' ") Color.pl("{G} ':. {GR}/_____\\{G} ,:' ")
Color.pl("{G} {GR}/ \\{G} ") Color.pl("{G} {GR}/ \\{G} ")
Color.pl("{W}") Color.pl("{W}")
@@ -175,9 +172,16 @@ if __name__ == '__main__':
w.main() w.main()
except Exception, e: except Exception, e:
Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e)) Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e))
if Configuration.verbose > 0:
Color.pl('\n{!} {O}Full stack trace below')
from traceback import format_exc from traceback import format_exc
print '\n ' Color.p('\n{!} ')
print format_exc().replace('\n', '\n ') err = format_exc().strip()
err = err.replace('\n', '\n{!} {C} ')
err = err.replace(' File', '{W}File')
err = err.replace(' Exception: ', '{R}Exception: {O}')
Color.pl(err)
Color.pl('\n{!} {R}Exiting{W}\n')
except KeyboardInterrupt: except KeyboardInterrupt:
Color.pl('\n{!} {O}interrupted{W}') Color.pl('\n{!} {O}interrupted{W}')
Configuration.exit_gracefully(0) Configuration.exit_gracefully(0)

View File

@@ -179,19 +179,22 @@ class Airmon(object):
% iface); % iface);
return iface return iface
a = Airmon()
count = len(a.interfaces)
if count == 0:
# No interfaces found
Color.pl('\n{!} {O}airmon-ng did not find {R}any{O} wireless interfaces')
Color.pl('{!} {O}make sure your wireless device is connected')
Color.pl('{!} {O}see {C}http://www.aircrack-ng.org/doku.php?id=airmon-ng{O} for more info{W}')
raise Exception('airmon-ng did not find any wireless interfaces')
Color.pl('') Color.pl('')
a = Airmon()
a.print_menu() a.print_menu()
Color.pl('') Color.pl('')
count = len(a.interfaces) if count == 1:
if count == 0:
# No interfaces found
Color.pl('{!} {O}airmon-ng did not find {R}any{O} wireless interfaces')
raise Exception('airmon-ng did not find any wireless interfaces')
elif count == 1:
# Only one interface, assume this is the one to use # Only one interface, assume this is the one to use
choice = 1 choice = 1
else: else:

View File

@@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import argparse import argparse
from Color import Color
class Arguments(object): class Arguments(object):
''' Holds arguments used by the Wifite ''' ''' Holds arguments used by the Wifite '''
@@ -10,11 +11,8 @@ class Arguments(object):
def get_arguments(self, Configuration): def get_arguments(self, Configuration):
''' Returns parser.args() containing all program arguments ''' ''' Returns parser.args() containing all program arguments '''
description = 'Wrapper script around aircrack-ng and reaver' parser = argparse.ArgumentParser(usage=argparse.SUPPRESS,
description += ' https://github.com/derv82/wifite2' formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=80, width=130))
parser = argparse.ArgumentParser(
description=description,
usage=argparse.SUPPRESS)
# Global variables # Global variables
glob = parser.add_argument_group('SETTINGS') glob = parser.add_argument_group('SETTINGS')
@@ -23,129 +21,135 @@ class Arguments(object):
dest='interface', dest='interface',
metavar='[interface]', metavar='[interface]',
type=str, type=str,
help='Wireless interface to use (default: ask)') help=Color.s('Wireless interface to use (default: {G}ask{W})'))
glob.add_argument('-c', glob.add_argument('-c',
action='store', action='store',
dest='channel', dest='channel',
metavar='[channel]', metavar='[channel]',
type=int, type=int,
help='Wireless channel to scan (default: all channels)') help=Color.s('Wireless channel to scan (default: {G}all channels{W})'))
glob.add_argument('-b', glob.add_argument('-b',
action='store', action='store',
dest='target_bssid', dest='target_bssid',
metavar='[bssid]', metavar='[bssid]',
type=str, type=str,
help='BSSID (e.g. AA:BB:CC:DD:EE:FF) of access point to attack') help=Color.s('BSSID (e.g. {GR}AA:BB:CC:DD:EE:FF{W}) of access point to attack'))
glob.add_argument('-e', glob.add_argument('-e',
action='store', action='store',
dest='target_essid', dest='target_essid',
metavar='[essid]', metavar='[essid]',
type=str, type=str,
help='ESSID (name) of access point to attack') help=Color.s('ESSID (name) of access point to attack'))
glob.add_argument('-v',
'--verbose',
action='count',
default=0,
dest='verbose',
help=Color.s('Verbose mode, prints more lines (default: {G}quiet{W})'))
# WEP # WEP
wep = parser.add_argument_group('WEP-RELATED') wep = parser.add_argument_group('WEP-RELATED')
wep.add_argument('--wep', wep.add_argument('--wep',
action='store_true', action='store_true',
dest='wep_filter', dest='wep_filter',
help='Filter to display WEP-encrypted networks (default: off)') help=Color.s('Filter to display WEP-encrypted networks (default: {G}off{W})'))
wep.add_argument('--require-fakeauth', wep.add_argument('--require-fakeauth',
action='store_true', action='store_true',
dest='require_fakeauth', dest='require_fakeauth',
help='Fails attacks if fake-auth fails (default: off)') help=Color.s('Fails attacks if fake-auth fails (default: {G}off{W})'))
wep.add_argument('-pps', wep.add_argument('-pps',
action='store', action='store',
dest='wep_pps', dest='wep_pps',
metavar='[pps]', metavar='[pps]',
type=int, type=int,
help='Packets Per Second to replay (default: %d pps)' help=Color.s('Packets Per Second to replay (default: {G}%d pps{W})')
% Configuration.wep_pps) % Configuration.wep_pps)
wep.add_argument('-wept', wep.add_argument('-wept',
action='store', action='store',
dest='wep_timeout', dest='wep_timeout',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Seconds to wait before failing (default: %d ivs)' help=Color.s('Seconds to wait before failing (default: {G}%d ivs{W})')
% Configuration.wep_timeout) % Configuration.wep_timeout)
wep.add_argument('-wepc', wep.add_argument('-wepc',
action='store', action='store',
dest='wep_crack_at_ivs', dest='wep_crack_at_ivs',
metavar='[ivs]', metavar='[ivs]',
type=int, type=int,
help='Start cracking at this many IVs (default: %d ivs)' help=Color.s('Start cracking at this many IVs (default: {G}%d ivs{W})')
% Configuration.wep_crack_at_ivs) % Configuration.wep_crack_at_ivs)
wep.add_argument('-weprs', wep.add_argument('-weprs',
action='store', action='store',
dest='wep_restart_stale_ivs', dest='wep_restart_stale_ivs',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Restart aireplay if no new IVs appear (default: %ds)' help=Color.s('Restart aireplay if no new IVs appear (default: {G}%d sec{W})')
% Configuration.wep_restart_stale_ivs) % Configuration.wep_restart_stale_ivs)
wep.add_argument('-weprc', wep.add_argument('-weprc',
action='store', action='store',
dest='wep_restart_aircrack', dest='wep_restart_aircrack',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Restart aircrack after this delay (default: %ds)' help=Color.s('Restart aircrack after this delay (default: {G}%d sec{W})')
% Configuration.wep_restart_aircrack) % Configuration.wep_restart_aircrack)
wep.add_argument('-arpreplay', wep.add_argument('-arpreplay',
action='store_true', action='store_true',
dest='wep_attack_replay', dest='wep_attack_replay',
help='use ARP-replay WEP attack (default: on)') help=Color.s('Use ARP-replay WEP attack (default: {G}on{W})'))
wep.add_argument('-fragment', wep.add_argument('-fragment',
action='store_true', action='store_true',
dest='wep_attack_fragment', dest='wep_attack_fragment',
help='use fragmentation WEP attack (default: on)') help=Color.s('Use fragmentation WEP attack (default: {G}on{W})'))
wep.add_argument('-chopchop', wep.add_argument('-chopchop',
action='store_true', action='store_true',
dest='wep_attack_chopchop', dest='wep_attack_chopchop',
help='use chop-chop WEP attack (default: on)') help=Color.s('Use chop-chop WEP attack (default: {G}on{W})'))
wep.add_argument('-caffelatte', wep.add_argument('-caffelatte',
action='store_true', action='store_true',
dest='wep_attack_caffe', dest='wep_attack_caffe',
help='use caffe-latte WEP attack (default: on)') help=Color.s('Use caffe-latte WEP attack (default: {G}on{W})'))
wep.add_argument('-p0841', wep.add_argument('-p0841',
action='store_true', action='store_true',
dest='wep_attack_p0841', dest='wep_attack_p0841',
help='use p0841 WEP attack (default: on)') help=Color.s('Use p0841 WEP attack (default: {G}on{W})'))
wep.add_argument('-hirte', wep.add_argument('-hirte',
action='store_true', action='store_true',
dest='wep_attack_hirte', dest='wep_attack_hirte',
help='use ARP-replay WEP attack (default: on)') help=Color.s('Use ARP-replay WEP attack (default: {G}on{W})'))
# WPA # WPA
wpa = parser.add_argument_group('WPA-RELATED') wpa = parser.add_argument_group('WPA-RELATED')
wpa.add_argument('--wpa', wpa.add_argument('--wpa',
action='store_true', action='store_true',
dest='wpa_filter', dest='wpa_filter',
help='Filter to display WPA-encrypted networks (includes WPS)') help=Color.s('Filter to display WPA-encrypted networks (includes WPS)'))
wpa.add_argument('-wpadt', wpa.add_argument('-wpadt',
action='store', action='store',
dest='wpa_deauth_timeout', dest='wpa_deauth_timeout',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Time to wait before failing a Deauth (default: %ds)' help=Color.s('Time to wait before failing a Deauth (default: {G}%d sec{W})')
% Configuration.wpa_deauth_timeout) % Configuration.wpa_deauth_timeout)
wpa.add_argument('-wpat', wpa.add_argument('-wpat',
action='store', action='store',
dest='wpa_attack_timeout', dest='wpa_attack_timeout',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Time to wait before failing WPA attack (default: %ds)' help=Color.s('Time to wait before failing WPA attack (default: {G}%d sec{W})')
% Configuration.wpa_attack_timeout) % Configuration.wpa_attack_timeout)
wpa.add_argument('-hs', wpa.add_argument('-hs',
action='store', action='store',
dest='wpa_handshake_dir', dest='wpa_handshake_dir',
metavar='[dir]', metavar='[dir]',
type=str, type=str,
help='Directory to store handshake files (default: %s)' help=Color.s('Directory to store handshake files (default: {G}%s{W})')
% Configuration.wpa_handshake_dir) % Configuration.wpa_handshake_dir)
wpa.add_argument('--dict', wpa.add_argument('--dict',
action='store', action='store',
dest='wordlist', dest='wordlist',
metavar='[file]', metavar='[file]',
type=str, type=str,
help='File containing passwords for cracking (default: %s)' help=Color.s('File containing passwords for cracking (default: {G}%s{W})')
% Configuration.wordlist) % Configuration.wordlist)
# WPS # WPS
@@ -153,86 +157,86 @@ class Arguments(object):
wps.add_argument('--wps', wps.add_argument('--wps',
action='store_true', action='store_true',
dest='wps_filter', dest='wps_filter',
help='Filter to display WPS-enabled networks') help=Color.s('Filter to display WPS-enabled networks'))
wps.add_argument('--reaver', wps.add_argument('--reaver',
action='store_true', action='store_true',
dest='reaver_only', dest='reaver_only',
help='ONLY use Reaver on WPS networks (default: off)') help=Color.s('ONLY use Reaver on WPS networks (default: {G}off{W})'))
wps.add_argument('--no-reaver', wps.add_argument('--no-reaver',
action='store_true', action='store_true',
dest='no_reaver', dest='no_reaver',
help='Do NOT use Reaver on WPS networks (default: off)') help=Color.s('Do NOT use Reaver on WPS networks (default: {G}off{W})'))
wps.add_argument('--pixie', wps.add_argument('--pixie',
action='store_true', action='store_true',
dest='pixie_only', dest='pixie_only',
help='Only use the WPS Pixie-Dust attack (default: off)') help=Color.s('Only use the WPS Pixie-Dust attack (default: {G}off{W})'))
wps.add_argument('--pixiet', wps.add_argument('--pixiet',
action='store', action='store',
dest='wps_pixie_timeout', dest='wps_pixie_timeout',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Time to wait before stopping PixieDust (default: %ds)' help=Color.s('Time to wait before stopping PixieDust (default: {G}%d sec{W})')
% Configuration.wps_pixie_timeout) % Configuration.wps_pixie_timeout)
wps.add_argument('-wpst', wps.add_argument('-wpst',
action='store', action='store',
dest='wps_pin_timeout', dest='wps_pin_timeout',
metavar='[seconds]', metavar='[seconds]',
type=int, type=int,
help='Time to wait before stopping PIN attack (default: %ds)' help=Color.s('Time to wait before stopping PIN attack (default: {G}%d sec{W})')
% Configuration.wps_pin_timeout) % Configuration.wps_pin_timeout)
wps.add_argument('-wpsmr', wps.add_argument('-wpsmr',
action='store', action='store',
dest='wps_max_retries', dest='wps_max_retries',
metavar='[retries]', metavar='[retries]',
type=int, type=int,
help='Maximum number of Retries before stopping (default: %d)' help=Color.s('Maximum number of Retries before stopping (default: {G}%d{W})')
% Configuration.wps_max_retries) % Configuration.wps_max_retries)
wps.add_argument('-wpsmf', wps.add_argument('-wpsmf',
action='store', action='store',
dest='wps_fail_threshold', dest='wps_fail_threshold',
metavar='[fails]', metavar='[fails]',
type=int, type=int,
help='Maximum number of Failures before stopping (default: %d)' help=Color.s('Maximum number of Failures before stopping (default: {G}%d{W})')
% Configuration.wps_fail_threshold) % Configuration.wps_fail_threshold)
wps.add_argument('-wpsmt', wps.add_argument('-wpsmt',
action='store', action='store',
dest='wps_timeout_threshold', dest='wps_timeout_threshold',
metavar='[timeouts]', metavar='[timeouts]',
type=int, type=int,
help='Maximum number of Timeouts before stopping (default: %d)' help=Color.s('Maximum number of Timeouts before stopping (default: {G}%d{W})')
% Configuration.wps_timeout_threshold) % Configuration.wps_timeout_threshold)
wps.add_argument('--ignore-ratelimit', wps.add_argument('--ignore-ratelimit',
action='store_false', action='store_false',
dest='wps_ignore_rate_limit', dest='wps_ignore_rate_limit',
help='Continues attack if WPS is rate-limited (default: off)') help=Color.s('Continues attack if WPS is rate-limited (default: {G}off{W})'))
# Commands # Commands
commands = parser.add_argument_group('COMMANDS') commands = parser.add_argument_group('COMMANDS')
commands.add_argument('--cracked', commands.add_argument('--cracked',
action='store_true', action='store_true',
dest='cracked', dest='cracked',
help='Display previously-cracked access points') help=Color.s('Display previously-cracked access points'))
commands.add_argument('--check-hs', commands.add_argument('--check-hs',
action='store', action='store',
metavar='[file]', metavar='[file]',
dest='check_handshake', dest='check_handshake',
help='Check a .cap file for WPA handshakes') help=Color.s('Check a .cap file for WPA handshakes'))
commands.add_argument('--crack-wpa', commands.add_argument('--crack-wpa',
action='store', action='store',
type=str, type=str,
dest='crack_wpa', dest='crack_wpa',
metavar='[file]', metavar='[file]',
help='Crack a .cap file containing a WPA handshake') help=Color.s('Crack a .cap file containing a WPA handshake'))
commands.add_argument('--crack-wep', commands.add_argument('--crack-wep',
action='store', action='store',
type=str, type=str,
dest='crack_wep', dest='crack_wep',
metavar='[file]', metavar='[file]',
help='Crack a .cap file containing WEP IVS') help=Color.s('Crack a .cap file containing WEP IVS'))
commands.add_argument('--update', commands.add_argument('--update',
action='store_true', action='store_true',
dest='update', dest='update',
help='Update to latest version of Wifite (on github)') help=Color.s('Update to latest version of Wifite (on github)'))
return parser.parse_args() return parser.parse_args()

View File

@@ -23,6 +23,8 @@ class Configuration(object):
return return
Configuration.initialized = True Configuration.initialized = True
Configuration.verbose = 0 # Verbosity level.
Configuration.tx_power = 0 # Wifi transmit power (0 is default) Configuration.tx_power = 0 # Wifi transmit power (0 is default)
Configuration.interface = None Configuration.interface = None
Configuration.target_channel = None # User-defined channel to scan Configuration.target_channel = None # User-defined channel to scan
@@ -114,6 +116,9 @@ class Configuration(object):
if args.target_essid: if args.target_essid:
Configuration.target_essid = args.target_essid Configuration.target_essid = args.target_essid
Color.pl('{+} {C}option:{W} targeting ESSID {G}%s{W}' % args.target_essid) Color.pl('{+} {C}option:{W} targeting ESSID {G}%s{W}' % args.target_essid)
if args.verbose:
Configuration.verbose = args.verbose
Color.pl('{+} {C}option:{W} verbosity level {G}%d{W}' % args.verbose)
# WEP # WEP