2.1.8: Check hashcat tools before trying PMKID attack.
Should resolve #124. Also, capturing PMKID will skip WPA handshake capture.
This commit is contained in:
@@ -55,8 +55,8 @@ class AttackAll(object):
|
|||||||
for attack in attacks:
|
for attack in attacks:
|
||||||
try:
|
try:
|
||||||
result = attack.run()
|
result = attack.run()
|
||||||
if result and attack.success:
|
if result:
|
||||||
break # We cracked it.
|
break # Attack was successful, stop other attacks.
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Color.pl("\n{!} {R}Error: {O}%s" % str(e))
|
Color.pl("\n{!} {R}Error: {O}%s" % str(e))
|
||||||
if Configuration.verbose > 0 or Configuration.print_stack_traces:
|
if Configuration.verbose > 0 or Configuration.print_stack_traces:
|
||||||
|
|||||||
@@ -55,7 +55,17 @@ class AttackPMKID(Attack):
|
|||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# TODO: Check ./hs/ for previously-captured PMKID, skip to crack if found.
|
# TODO: Check that we have all hashcat programs
|
||||||
|
dependencies = [
|
||||||
|
Hashcat.dependency_name,
|
||||||
|
HcxDumpTool.dependency_name,
|
||||||
|
HcxPcapTool.dependency_name
|
||||||
|
]
|
||||||
|
missing_deps = [dep for dep in dependencies if not Process.exists(dep)]
|
||||||
|
if len(missing_deps) > 0:
|
||||||
|
Color.pl('{!} Skipping PMKID attack, missing required tools: {O}%s{W}' % ', '.join(missing_deps))
|
||||||
|
return False
|
||||||
|
|
||||||
pmkid_file = None
|
pmkid_file = None
|
||||||
|
|
||||||
# Load exisitng has from filesystem
|
# Load exisitng has from filesystem
|
||||||
@@ -74,7 +84,8 @@ class AttackPMKID(Attack):
|
|||||||
|
|
||||||
# Crack it.
|
# Crack it.
|
||||||
self.success = self.crack_pmkid_file(pmkid_file)
|
self.success = self.crack_pmkid_file(pmkid_file)
|
||||||
return self.success
|
|
||||||
|
return True # Even if we don't crack it, capturing a PMKID is "successful"
|
||||||
|
|
||||||
|
|
||||||
def capture_pmkid(self):
|
def capture_pmkid(self):
|
||||||
|
|||||||
@@ -250,7 +250,10 @@ class AttackWPA(Attack):
|
|||||||
os.mkdir(Configuration.wpa_handshake_dir)
|
os.mkdir(Configuration.wpa_handshake_dir)
|
||||||
|
|
||||||
# Generate filesystem-safe filename from bssid, essid and date
|
# Generate filesystem-safe filename from bssid, essid and date
|
||||||
essid_safe = re.sub('[^a-zA-Z0-9]', '', handshake.essid)
|
if handshake.essid and type(handshake.essid) is str:
|
||||||
|
essid_safe = re.sub('[^a-zA-Z0-9]', '', handshake.essid)
|
||||||
|
else:
|
||||||
|
essid_safe = 'UnknownEssid'
|
||||||
bssid_safe = handshake.bssid.replace(':', '-')
|
bssid_safe = handshake.bssid.replace(':', '-')
|
||||||
date = time.strftime('%Y-%m-%dT%H-%M-%S')
|
date = time.strftime('%Y-%m-%dT%H-%M-%S')
|
||||||
cap_filename = 'handshake_%s_%s_%s.cap' % (essid_safe, bssid_safe, date)
|
cap_filename = 'handshake_%s_%s_%s.cap' % (essid_safe, bssid_safe, date)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from .tools.macchanger import Macchanger
|
|||||||
|
|
||||||
class Configuration(object):
|
class Configuration(object):
|
||||||
''' Stores configuration variables and functions for Wifite. '''
|
''' Stores configuration variables and functions for Wifite. '''
|
||||||
version = '2.1.7'
|
version = '2.1.8'
|
||||||
|
|
||||||
initialized = False # Flag indicating config has been initialized
|
initialized = False # Flag indicating config has been initialized
|
||||||
temp_dir = None # Temporary directory
|
temp_dir = None # Temporary directory
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Dependency(object):
|
|||||||
from .pyrit import Pyrit
|
from .pyrit import Pyrit
|
||||||
from .tshark import Tshark
|
from .tshark import Tshark
|
||||||
from .macchanger import Macchanger
|
from .macchanger import Macchanger
|
||||||
|
from .hashcat import Hashcat, HcxDumpTool, HcxPcapTool
|
||||||
|
|
||||||
apps = [
|
apps = [
|
||||||
# Aircrack
|
# Aircrack
|
||||||
@@ -40,6 +41,8 @@ class Dependency(object):
|
|||||||
Reaver, Bully,
|
Reaver, Bully,
|
||||||
# Cracking/handshakes
|
# Cracking/handshakes
|
||||||
Pyrit, Tshark,
|
Pyrit, Tshark,
|
||||||
|
# Hashcat
|
||||||
|
Hashcat, HcxDumpTool, HcxPcapTool,
|
||||||
# Misc
|
# Misc
|
||||||
Macchanger
|
Macchanger
|
||||||
]
|
]
|
||||||
@@ -61,11 +64,11 @@ class Dependency(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if cls.dependency_required:
|
if cls.dependency_required:
|
||||||
Color.pl('{!} {R}error: required app {O}%s{R} was not found' % cls.dependency_name)
|
Color.pp('{!} {R}error: required app {O}%s{R} was not found' % cls.dependency_name)
|
||||||
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
|
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Color.pl('{!} {O}warning: recommended app {R}%s{O} was not found' % cls.dependency_name)
|
Color.p('{!} {O}warning: recommended app {R}%s{O} was not found' % cls.dependency_name)
|
||||||
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
|
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user