Cleaning up --help, banner, small fixes
This commit is contained in:
@@ -28,13 +28,13 @@ class Arguments(object):
|
|||||||
glob = parser.add_argument_group('SETTINGS')
|
glob = parser.add_argument_group('SETTINGS')
|
||||||
self._add_global_args(glob)
|
self._add_global_args(glob)
|
||||||
|
|
||||||
wep_group = parser.add_argument_group('WEP-RELATED')
|
wep_group = parser.add_argument_group('WEP')
|
||||||
self._add_wep_args(wep_group)
|
self._add_wep_args(wep_group)
|
||||||
|
|
||||||
wpa_group = parser.add_argument_group('WPA-RELATED')
|
wpa_group = parser.add_argument_group('WPA')
|
||||||
self._add_wpa_args(wpa_group)
|
self._add_wpa_args(wpa_group)
|
||||||
|
|
||||||
wps_group = parser.add_argument_group('WPS-RELATED')
|
wps_group = parser.add_argument_group('WPS')
|
||||||
self._add_wps_args(wps_group)
|
self._add_wps_args(wps_group)
|
||||||
|
|
||||||
commands_group = parser.add_argument_group('COMMANDS')
|
commands_group = parser.add_argument_group('COMMANDS')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ try:
|
|||||||
from config import Configuration
|
from config import Configuration
|
||||||
except (ValueError, ImportError) as e:
|
except (ValueError, ImportError) as e:
|
||||||
raise Exception('You may need to run wifite from the root directory (which includes README.md)')
|
raise Exception('You may need to run wifite from the root directory (which includes README.md)')
|
||||||
|
|
||||||
from util.scanner import Scanner
|
from util.scanner import Scanner
|
||||||
from util.process import Process
|
from util.process import Process
|
||||||
from util.color import Color
|
from util.color import Color
|
||||||
@@ -15,9 +16,9 @@ from attack.wps import AttackWPS
|
|||||||
from model.result import CrackResult
|
from model.result import CrackResult
|
||||||
from model.handshake import Handshake
|
from model.handshake import Handshake
|
||||||
|
|
||||||
from json import loads
|
import json
|
||||||
import os
|
import os
|
||||||
from sys import exit
|
import sys
|
||||||
|
|
||||||
class Wifite(object):
|
class Wifite(object):
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ class Wifite(object):
|
|||||||
|
|
||||||
if missing_required:
|
if missing_required:
|
||||||
Color.pl('{!} {R}required app(s) were not found, exiting.{W}')
|
Color.pl('{!} {R}required app(s) were not found, exiting.{W}')
|
||||||
exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
if missing_optional:
|
if missing_optional:
|
||||||
Color.pl('{!} {O}recommended app(s) were not found')
|
Color.pl('{!} {O}recommended app(s) were not found')
|
||||||
@@ -71,17 +72,22 @@ class Wifite(object):
|
|||||||
|
|
||||||
def display_cracked(self):
|
def display_cracked(self):
|
||||||
''' Show cracked targets from cracked.txt '''
|
''' Show cracked targets from cracked.txt '''
|
||||||
Color.pl('{+} displaying {C}cracked target(s){W}')
|
|
||||||
name = CrackResult.cracked_file
|
name = CrackResult.cracked_file
|
||||||
if not os.path.exists(name):
|
if not os.path.exists(name):
|
||||||
Color.pl('{!} {O}file {C}%s{O} not found{W}' % name)
|
Color.pl('{!} {O}file {C}%s{O} not found{W}' % name)
|
||||||
return
|
return
|
||||||
|
|
||||||
with open(name, 'r') as fid:
|
with open(name, 'r') as fid:
|
||||||
json = loads(fid.read())
|
cracked_targets = json.loads(fid.read())
|
||||||
for idx, item in enumerate(json, start=1):
|
|
||||||
Color.pl('\n{+} Cracked target #%d:' % (idx))
|
if len(cracked_targets) == 0:
|
||||||
|
Color.pl('{!} {R}no results found in {O}%s{W}' % name)
|
||||||
|
else:
|
||||||
|
Color.pl('{+} displaying {G}%d {C}cracked target(s){W}\n' % len(cracked_targets))
|
||||||
|
for item in cracked_targets:
|
||||||
cr = CrackResult.load(item)
|
cr = CrackResult.load(item)
|
||||||
cr.dump()
|
cr.dump()
|
||||||
|
Color.pl('')
|
||||||
|
|
||||||
def check_handshake(self, capfile):
|
def check_handshake(self, capfile):
|
||||||
''' Analyzes .cap file for handshake '''
|
''' Analyzes .cap file for handshake '''
|
||||||
@@ -95,6 +101,7 @@ class Wifite(object):
|
|||||||
Color.pl('{!} {R}no .cap files found in {O}"./hs"{W}\n')
|
Color.pl('{!} {R}no .cap files found in {O}"./hs"{W}\n')
|
||||||
else:
|
else:
|
||||||
capfiles = [capfile]
|
capfiles = [capfile]
|
||||||
|
|
||||||
for capfile in capfiles:
|
for capfile in capfiles:
|
||||||
Color.pl('{+} checking for handshake in .cap file {C}%s{W}' % capfile)
|
Color.pl('{+} checking for handshake in .cap file {C}%s{W}' % capfile)
|
||||||
if not os.path.exists(capfile):
|
if not os.path.exists(capfile):
|
||||||
@@ -189,7 +196,7 @@ class Wifite(object):
|
|||||||
|
|
||||||
def print_banner(self):
|
def print_banner(self):
|
||||||
""" Displays ASCII art of the highest caliber. """
|
""" Displays ASCII art of the highest caliber. """
|
||||||
Color.pl(r'''
|
Color.pl('''\
|
||||||
{G} . {GR}{D} {W}{G} . {W}
|
{G} . {GR}{D} {W}{G} . {W}
|
||||||
{G}.´ · .{GR}{D} {W}{G}. · `. {G}wifite {D}%s{W}
|
{G}.´ · .{GR}{D} {W}{G}. · `. {G}wifite {D}%s{W}
|
||||||
{G}: : : {GR}{D} (¯) {W}{G} : : : {W}{D}automated wireless auditor
|
{G}: : : {GR}{D} (¯) {W}{G} : : : {W}{D}automated wireless auditor
|
||||||
@@ -222,11 +229,14 @@ class Wifite(object):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
w = Wifite()
|
w = Wifite()
|
||||||
try:
|
|
||||||
w.print_banner()
|
w.print_banner()
|
||||||
|
|
||||||
|
try:
|
||||||
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 or True:
|
if Configuration.verbose > 0 or True:
|
||||||
Color.pl('\n{!} {O}Full stack trace below')
|
Color.pl('\n{!} {O}Full stack trace below')
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
@@ -236,7 +246,10 @@ if __name__ == '__main__':
|
|||||||
err = err.replace(' File', '{W}File')
|
err = err.replace(' File', '{W}File')
|
||||||
err = err.replace(' Exception: ', '{R}Exception: {O}')
|
err = err.replace(' Exception: ', '{R}Exception: {O}')
|
||||||
Color.pl(err)
|
Color.pl(err)
|
||||||
|
|
||||||
Color.pl('\n{!} {R}Exiting{W}\n')
|
Color.pl('\n{!} {R}Exiting{W}\n')
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
Color.pl('\n{!} {O}interrupted, shutting down...{W}')
|
Color.pl('\n{!} {O}interrupted, shutting down...{W}')
|
||||||
|
|
||||||
Configuration.exit_gracefully(0)
|
Configuration.exit_gracefully(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user