Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
derv82
GitHub Repository: derv82/wifite2
Path: blob/master/wifite/tools/cowpatty.py
412 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
from .dependency import Dependency
5
from ..config import Configuration
6
from ..util.color import Color
7
from ..util.process import Process
8
from ..tools.hashcat import HcxPcapTool
9
10
import os
11
import re
12
13
14
class Cowpatty(Dependency):
15
''' Wrapper for Cowpatty program. '''
16
dependency_required = False
17
dependency_name = 'cowpatty'
18
dependency_url = 'https://tools.kali.org/wireless-attacks/cowpatty'
19
20
21
@staticmethod
22
def crack_handshake(handshake, show_command=False):
23
# Crack john file
24
command = [
25
'cowpatty',
26
'-f', Configuration.wordlist,
27
'-r', handshake.capfile,
28
'-s', handshake.essid
29
]
30
if show_command:
31
Color.pl('{+} {D}Running: {W}{P}%s{W}' % ' '.join(command))
32
process = Process(command)
33
stdout, stderr = process.get_output()
34
35
key = None
36
for line in stdout.split('\n'):
37
if 'The PSK is "' in line:
38
key = line.split('"', 1)[1][:-2]
39
break
40
41
return key
42
43