Skip to content

Commit

Permalink
Fixup in bully and reaver (few fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimocoder committed Jan 10, 2024
1 parent 9275b07 commit c3ac5fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
9 changes: 2 additions & 7 deletions wifite/tools/hashcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ class HcxDumpTool(Dependency):
dependency_url = 'apt install hcxdumptool'

def __init__(self, target, pcapng_file):
# Create filterlist
filterlist = Configuration.temp('pmkid.filterlist')
with open(filterlist, 'w') as filter_handle:
filter_handle.write(target.bssid.replace(':', ''))

if os.path.exists(pcapng_file):
os.remove(pcapng_file)

Expand Down Expand Up @@ -180,7 +175,7 @@ def get_pmkid_hash(self, pcapng_file):
if os.path.exists(self.pmkid_file):
os.remove(self.pmkid_file)

command = ['hcxpcapngtool', f'--pmkid={self.pmkid_file}', pcapng_file]
command = 'hcxpcapngtool -o ' + self.pmkid_file + " " + pcapng_file
hcxpcap_proc = Process(command)
hcxpcap_proc.wait()

Expand All @@ -197,7 +192,7 @@ def get_pmkid_hash(self, pcapng_file):
matching_pmkid_hash = None
for line in output.split('\n'):
fields = line.split('*')
if len(fields) >= 3 and fields[1].lower() == self.bssid:
if len(fields) >= 3 and fields[3].lower() == self.bssid:
# Found it
matching_pmkid_hash = line
break
Expand Down
30 changes: 6 additions & 24 deletions wifite/tools/reaver.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time

import contextlib
from .dependency import Dependency
from .airodump import Airodump
from .bully import Bully # for PSK retrieval
from ..model.attack import Attack
from .dependency import Dependency
from ..config import Configuration
from ..model.attack import Attack
from ..model.wps_result import CrackResultWPS
from ..util.color import Color
from ..util.process import Process
from ..util.timer import Timer

import os
import time
import re


class Reaver(Attack, Dependency):
dependency_required = False
Expand Down Expand Up @@ -52,14 +47,12 @@ def __init__(self, target, pixie_dust=True, null_pin=False):
'--channel', self.target.channel,
'-vv',
'-N',
'-O', 'reaver_output.pcap'
]

if pixie_dust:
self.reaver_cmd.extend(['--pixie-dust', '1'])
self.reaver_cmd.extend(['-K']) # Pixie-dust attack

if null_pin:
# self.reaver_cmd.extend(['-O', 'reaver_output.pcap']) # This is for logging output
self.reaver_cmd.extend(['-p', '']) # NULL PIN attack parameter

self.reaver_proc = None
Expand Down Expand Up @@ -186,17 +179,6 @@ def parse_crack_result(self, stdout):
else:
self.pattack('{G}Cracked WPS PIN: {C}%s' % pin, newline=True)

# Try to derive PSK from PIN using Bully
self.pattack('{W}Retrieving PSK using {C}bully{W}...')
psk = None
with contextlib.suppress(KeyboardInterrupt):
psk = Bully.get_psk_from_pin(self.target, pin)
if psk is None:
Color.pl('')
self.pattack('{R}Failed {O}to get PSK using bully', newline=True)
else:
self.pattack('{G}Cracked WPS PSK: {C}%s' % psk, newline=True)

crack_result = CrackResultWPS(self.target.bssid, ssid, pin, psk)
crack_result.dump()
return crack_result
Expand Down

0 comments on commit c3ac5fb

Please sign in to comment.