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
This commit is contained in:
derv82
2018-08-21 13:55:22 -07:00
parent d01470a8e4
commit f641ea53c4
5 changed files with 12 additions and 12 deletions

View File

@@ -61,11 +61,11 @@ class AttackWPA(Attack):
self.success = False self.success = False
return False return False
Color.pl('\n{+} {C}Cracking WPA Handshake:{W} Using {C}aircrack-ng{W} via' + Color.pl('\n{+} {C}Cracking WPA Handshake:{W} Running {C}aircrack-ng{W} with' +
' {C}%s{W} wordlist' % os.path.split(Configuration.wordlist)[-1]) ' {C}%s{W} wordlist' % os.path.split(Configuration.wordlist)[-1])
# Crack it # Crack it
key = Aircrack.crack_handshake(handshake, Configuration.wordlist) key = Aircrack.crack_handshake(handshake, show_command=False)
if key is None: if key is None:
Color.pl('{!} {R}Failed to crack handshake: {O}%s{R} did not contain password{W}' % Configuration.wordlist.split(os.sep)[-1]) Color.pl('{!} {R}Failed to crack handshake: {O}%s{R} did not contain password{W}' % Configuration.wordlist.split(os.sep)[-1])
self.success = False self.success = False

View File

@@ -28,7 +28,7 @@ class Cowpatty(Dependency):
'-s', handshake.essid '-s', handshake.essid
] ]
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
stdout, stderr = process.get_output() stdout, stderr = process.get_output()

View File

@@ -40,7 +40,7 @@ class Hashcat(Dependency):
command.append('--force') command.append('--force')
command.extend(additional_arg) command.extend(additional_arg)
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
stdout, stderr = process.get_output() stdout, stderr = process.get_output()
if ':' not in stdout: if ':' not in stdout:
@@ -150,7 +150,7 @@ class HcxPcapTool(Dependency):
] ]
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
stdout, stderr = process.get_output() stdout, stderr = process.get_output()
@@ -173,7 +173,7 @@ class HcxPcapTool(Dependency):
] ]
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
stdout, stderr = process.get_output() stdout, stderr = process.get_output()

View File

@@ -33,20 +33,20 @@ class John(Dependency):
# Crack john file # Crack john file
command = [ command = [
'john', 'john',
'--format', john_format, '--format=%s' % john_format,
'--wordlist', Configuration.wordlist, '--wordlist', Configuration.wordlist,
john_file john_file
] ]
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
process.wait() process.wait()
# Run again with --show to consistently get the password # Run again with --show to consistently get the password
command = ['john', '--show', john_file] command = ['john', '--show', john_file]
if show_command: if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command)) Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
process = Process(command) process = Process(command)
stdout, stderr = process.get_output() stdout, stderr = process.get_output()

View File

@@ -53,6 +53,7 @@ class CrackHelper:
return return
hs_to_crack = cls.get_user_selection(handshakes) hs_to_crack = cls.get_user_selection(handshakes)
any_pmkid = any([hs['type'] == 'PMKID' for hs in hs_to_crack])
# Tools for cracking & their dependencies. # Tools for cracking & their dependencies.
available_tools = { available_tools = {
@@ -84,6 +85,8 @@ class CrackHelper:
if tool_name not in available_tools: if tool_name not in available_tools:
Color.pl('{!} {R}"%s"{O} tool not found, defaulting to {C}aircrack{W}' % tool_name) Color.pl('{!} {R}"%s"{O} tool not found, defaulting to {C}aircrack{W}' % tool_name)
tool_name = 'aircrack' tool_name = 'aircrack'
elif any_pmkid and tool_name != 'hashcat':
Color.pl('{!} {O}Note: PMKID hashes will be cracked using {C}hashcat{W}')
try: try:
for hs in hs_to_crack: for hs in hs_to_crack:
@@ -251,9 +254,6 @@ class CrackHelper:
@classmethod @classmethod
def crack_pmkid(cls, hs, tool_name): def crack_pmkid(cls, hs, tool_name):
if tool_name != 'hashcat':
Color.pl('{!} {O}Note: PMKIDs can only be cracked using hashcat{W}')
key = Hashcat.crack_pmkid(hs['filename'], verbose=True) key = Hashcat.crack_pmkid(hs['filename'], verbose=True)
if key is not None: if key is not None: