Skip to content

Commit 6adca64

Browse files
committed
2.1.8: Check hashcat tools before trying PMKID attack.
Should resolve #124. Also, capturing PMKID will skip WPA handshake capture.
1 parent 7ed30f0 commit 6adca64

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

wifite/attack/all.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def attack_single(cls, target, targets_remaining):
5555
for attack in attacks:
5656
try:
5757
result = attack.run()
58-
if result and attack.success:
59-
break # We cracked it.
58+
if result:
59+
break # Attack was successful, stop other attacks.
6060
except Exception as e:
6161
Color.pl("\n{!} {R}Error: {O}%s" % str(e))
6262
if Configuration.verbose > 0 or Configuration.print_stack_traces:

wifite/attack/pmkid.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,17 @@ def get_existing_pmkid_file(self, bssid):
5555

5656

5757
def run(self):
58-
# TODO: Check ./hs/ for previously-captured PMKID, skip to crack if found.
58+
# TODO: Check that we have all hashcat programs
59+
dependencies = [
60+
Hashcat.dependency_name,
61+
HcxDumpTool.dependency_name,
62+
HcxPcapTool.dependency_name
63+
]
64+
missing_deps = [dep for dep in dependencies if not Process.exists(dep)]
65+
if len(missing_deps) > 0:
66+
Color.pl('{!} Skipping PMKID attack, missing required tools: {O}%s{W}' % ', '.join(missing_deps))
67+
return False
68+
5969
pmkid_file = None
6070

6171
# Load exisitng has from filesystem
@@ -74,7 +84,8 @@ def run(self):
7484

7585
# Crack it.
7686
self.success = self.crack_pmkid_file(pmkid_file)
77-
return self.success
87+
88+
return True # Even if we don't crack it, capturing a PMKID is "successful"
7889

7990

8091
def capture_pmkid(self):

wifite/attack/wpa.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ def save_handshake(self, handshake):
250250
os.mkdir(Configuration.wpa_handshake_dir)
251251

252252
# Generate filesystem-safe filename from bssid, essid and date
253-
essid_safe = re.sub('[^a-zA-Z0-9]', '', handshake.essid)
253+
if handshake.essid and type(handshake.essid) is str:
254+
essid_safe = re.sub('[^a-zA-Z0-9]', '', handshake.essid)
255+
else:
256+
essid_safe = 'UnknownEssid'
254257
bssid_safe = handshake.bssid.replace(':', '-')
255258
date = time.strftime('%Y-%m-%dT%H-%M-%S')
256259
cap_filename = 'handshake_%s_%s_%s.cap' % (essid_safe, bssid_safe, date)

wifite/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class Configuration(object):
1010
''' Stores configuration variables and functions for Wifite. '''
11-
version = '2.1.7'
11+
version = '2.1.8'
1212

1313
initialized = False # Flag indicating config has been initialized
1414
temp_dir = None # Temporary directory

wifite/tools/dependency.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def run_dependency_check(cls):
3030
from .pyrit import Pyrit
3131
from .tshark import Tshark
3232
from .macchanger import Macchanger
33+
from .hashcat import Hashcat, HcxDumpTool, HcxPcapTool
3334

3435
apps = [
3536
# Aircrack
@@ -40,6 +41,8 @@ def run_dependency_check(cls):
4041
Reaver, Bully,
4142
# Cracking/handshakes
4243
Pyrit, Tshark,
44+
# Hashcat
45+
Hashcat, HcxDumpTool, HcxPcapTool,
4346
# Misc
4447
Macchanger
4548
]
@@ -61,11 +64,11 @@ def fails_dependency_check(cls):
6164
return False
6265

6366
if cls.dependency_required:
64-
Color.pl('{!} {R}error: required app {O}%s{R} was not found' % cls.dependency_name)
65-
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
67+
Color.pp('{!} {R}error: required app {O}%s{R} was not found' % cls.dependency_name)
68+
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
6669
return True
6770

6871
else:
69-
Color.pl('{!} {O}warning: recommended app {R}%s{O} was not found' % cls.dependency_name)
70-
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
72+
Color.p('{!} {O}warning: recommended app {R}%s{O} was not found' % cls.dependency_name)
73+
Color.pl(' {W}install @ {C}%s{W}' % cls.dependency_url)
7174
return False

0 commit comments

Comments
 (0)