From 084a658d14e536c5a52b2e0cb77e0b0b5734b3b7 Mon Sep 17 00:00:00 2001 From: Radu Nicolau Date: Fri, 19 Oct 2018 10:56:06 +0300 Subject: [PATCH 1/2] util/crack: Fix python3 --crack crash Wifite would crash if run with python3 and the parameter --crack if a dependency was missing, just after selecting a target. This was caused by popping from a dictionary while iterating on it, an operation forbidden in python3. Issue described in #157 Signed-off-by: Radu Nicolau --- wifite/util/crack.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/wifite/util/crack.py b/wifite/util/crack.py index 68ee19bb6..e4d5037be 100755 --- a/wifite/util/crack.py +++ b/wifite/util/crack.py @@ -30,6 +30,14 @@ class CrackHelper: 'PMKID': 'PMKID Hash' } + # Tools for cracking & their dependencies. + possible_tools = [ + ('aircrack', [Aircrack]), + ('hashcat', [Hashcat, HcxPcapTool]), + ('john', [John, HcxPcapTool]), + ('cowpatty', [Cowpatty]) + ] + @classmethod def run(cls): Configuration.initialize(False) @@ -52,23 +60,18 @@ def run(cls): hs_to_crack = cls.get_user_selection(handshakes) all_pmkid = all([hs['type'] == 'PMKID' for hs in hs_to_crack]) - # Tools for cracking & their dependencies. - available_tools = { - 'aircrack': [Aircrack], - 'hashcat': [Hashcat, HcxPcapTool], - 'john': [John, HcxPcapTool], - 'cowpatty': [Cowpatty] - } # Identify missing tools missing_tools = [] - for tool, dependencies in available_tools.items(): + available_tools = [] + for tool, dependencies in cls.possible_tools: missing = [ dep for dep in dependencies if not Process.exists(dep.dependency_name) ] if len(missing) > 0: - available_tools.pop(tool) - missing_tools.append( (tool, missing) ) + missing_tools.append((tool, missing)) + else: + available_tools.append(tool) if len(missing_tools) > 0: Color.pl('\n{!} {O}Unavailable tools (install to enable):{W}') @@ -81,7 +84,7 @@ def run(cls): tool_name = 'hashcat' else: Color.p('\n{+} Enter the {C}cracking tool{W} to use ({C}%s{W}): {G}' % ( - '{W}, {C}'.join(available_tools.keys()))) + '{W}, {C}'.join(available_tools))) tool_name = raw_input() if tool_name not in available_tools: Color.pl('{!} {R}"%s"{O} tool not found, defaulting to {C}aircrack{W}' % tool_name) From 48db21f135b698246295c72d79469c2084c614c5 Mon Sep 17 00:00:00 2001 From: Radu Nicolau Date: Tue, 12 Feb 2019 16:53:18 +0200 Subject: [PATCH 2/2] model/handshake: Handshake detection for aircrack-ng 1.5.x Aircrack-ng changed the message for failure to crack a handshake using a dictionary from 'passphrase not in dictionary' to 'KEY NOT FOUND' from version 1.5 onwards. This update detects the new message to confirm an existing handshake. Issue described in #189 Signed-off-by: Radu Nicolau --- wifite/model/handshake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifite/model/handshake.py b/wifite/model/handshake.py index 630357047..eb8b69a57 100755 --- a/wifite/model/handshake.py +++ b/wifite/model/handshake.py @@ -121,7 +121,7 @@ def aircrack_handshakes(self): command = 'echo "" | aircrack-ng -a 2 -w - -b %s "%s"' % (self.bssid, self.capfile) (stdout, stderr) = Process.call(command) - if 'passphrase not in dictionary' in stdout.lower(): + if 'passphrase not in dictionary' in stdout.lower() or 'key not found' in stdout.lower(): return [(self.bssid, None)] else: return []