Skip to content

Commit f641ea5

Browse files
committed
Fix but when cracking with John, small fixes.
* --crack commands printed consistently (same color/format). * Only warn about PMKID -> hashcat once if any selected handshakes are PMKIDs
1 parent d01470a commit f641ea5

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

wifite/attack/wpa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def run(self):
6161
self.success = False
6262
return False
6363

64-
Color.pl('\n{+} {C}Cracking WPA Handshake:{W} Using {C}aircrack-ng{W} via' +
64+
Color.pl('\n{+} {C}Cracking WPA Handshake:{W} Running {C}aircrack-ng{W} with' +
6565
' {C}%s{W} wordlist' % os.path.split(Configuration.wordlist)[-1])
6666

6767
# Crack it
68-
key = Aircrack.crack_handshake(handshake, Configuration.wordlist)
68+
key = Aircrack.crack_handshake(handshake, show_command=False)
6969
if key is None:
7070
Color.pl('{!} {R}Failed to crack handshake: {O}%s{R} did not contain password{W}' % Configuration.wordlist.split(os.sep)[-1])
7171
self.success = False

wifite/tools/cowpatty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def crack_handshake(handshake, show_command=False):
2828
'-s', handshake.essid
2929
]
3030
if show_command:
31-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
31+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
3232
process = Process(command)
3333
stdout, stderr = process.get_output()
3434

wifite/tools/hashcat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def crack_handshake(handshake, show_command=False):
4040
command.append('--force')
4141
command.extend(additional_arg)
4242
if show_command:
43-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
43+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
4444
process = Process(command)
4545
stdout, stderr = process.get_output()
4646
if ':' not in stdout:
@@ -150,7 +150,7 @@ def generate_hccapx_file(handshake, show_command=False):
150150
]
151151

152152
if show_command:
153-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
153+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
154154

155155
process = Process(command)
156156
stdout, stderr = process.get_output()
@@ -173,7 +173,7 @@ def generate_john_file(handshake, show_command=False):
173173
]
174174

175175
if show_command:
176-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
176+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
177177

178178
process = Process(command)
179179
stdout, stderr = process.get_output()

wifite/tools/john.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ def crack_handshake(handshake, show_command=False):
3333
# Crack john file
3434
command = [
3535
'john',
36-
'--format', john_format,
36+
'--format=%s' % john_format,
3737
'--wordlist', Configuration.wordlist,
3838
john_file
3939
]
4040

4141
if show_command:
42-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
42+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
4343
process = Process(command)
4444
process.wait()
4545

4646
# Run again with --show to consistently get the password
4747
command = ['john', '--show', john_file]
4848
if show_command:
49-
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
49+
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
5050
process = Process(command)
5151
stdout, stderr = process.get_output()
5252

wifite/util/crack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def run(cls):
5353
return
5454

5555
hs_to_crack = cls.get_user_selection(handshakes)
56+
any_pmkid = any([hs['type'] == 'PMKID' for hs in hs_to_crack])
5657

5758
# Tools for cracking & their dependencies.
5859
available_tools = {
@@ -84,6 +85,8 @@ def run(cls):
8485
if tool_name not in available_tools:
8586
Color.pl('{!} {R}"%s"{O} tool not found, defaulting to {C}aircrack{W}' % tool_name)
8687
tool_name = 'aircrack'
88+
elif any_pmkid and tool_name != 'hashcat':
89+
Color.pl('{!} {O}Note: PMKID hashes will be cracked using {C}hashcat{W}')
8790

8891
try:
8992
for hs in hs_to_crack:
@@ -251,9 +254,6 @@ def crack_4way(cls, hs, tool):
251254

252255
@classmethod
253256
def crack_pmkid(cls, hs, tool_name):
254-
if tool_name != 'hashcat':
255-
Color.pl('{!} {O}Note: PMKIDs can only be cracked using hashcat{W}')
256-
257257
key = Hashcat.crack_pmkid(hs['filename'], verbose=True)
258258

259259
if key is not None:

0 commit comments

Comments
 (0)