--crack supports hashcat, aircrack, john, cowpatty, and pyrit.

* Still not "print" option for --crack.
* Checks hashcat for devices, uses --force if no devices are found.
* Interrupting --crack stops entire process, not just a single crack attempt
* Changed wordlist location, hopefully completes #102.
This commit is contained in:
derv82
2018-08-20 19:33:42 -07:00
parent a063f08388
commit 4173ef46e5
10 changed files with 346 additions and 124 deletions

53
wifite/tools/john.py Normal file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .dependency import Dependency
from ..config import Configuration
from ..util.color import Color
from ..util.process import Process
from ..tools.hashcat import HcxPcapTool
import os
class John(Dependency):
''' Wrapper for John program. '''
dependency_required = False
dependency_name = 'john'
dependency_url = 'http://www.openwall.com/john/'
@staticmethod
def crack_handshake(handshake, show_command=False):
john_file = HcxPcapTool.generate_john_file(handshake, show_command=show_command)
# Crack john file
command = [
'john',
'--format=wpapsk', # wpapsk-cuda or wpapsk-opencl
'--wordlist', Configuration.wordlist,
john_file
]
if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
process = Process(command)
process.wait()
# Show the password (if found)
command = ['john', '--show', john_file]
if show_command:
Color.pl('{+} {D}{C}Running %s{W}' % ' '.join(command))
process = Process(command)
stdout, stderr = process.get_output()
key = None
if not '0 password hashes cracked' in stdout:
for line in stdout.split('\n'):
if handshake.capfile in line:
key = line.split(':')[1]
break
if os.path.exists(john_file):
os.remove(john_file)
return key