Avoid WPS if no reaver+bully. Use bully if reaver isn't available.

This commit is contained in:
derv82
2018-08-26 22:29:23 -07:00
parent e30a8cad07
commit 5d77cb63a3
7 changed files with 30 additions and 25 deletions

View File

@@ -1,6 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .wep import AttackWEP
from .wpa import AttackWPA
from .wps import AttackWPS
from .pmkid import AttackPMKID
from ..config import Configuration from ..config import Configuration
from ..util.color import Color from ..util.color import Color
@@ -12,6 +16,10 @@ class AttackAll(object):
Attacks all given `targets` (list[wifite.model.target]) until user interruption. Attacks all given `targets` (list[wifite.model.target]) until user interruption.
Returns: Number of targets that were attacked (int) Returns: Number of targets that were attacked (int)
''' '''
if any(t.wps for t in targets) and not AttackWPS.can_attack_wps():
# Warn that WPS attacks are not available.
Color.pl('{!} {O}Note: WPS attacks are not possible because you do not have {C}reaver{O} nor {C}bully{W}')
attacked_targets = 0 attacked_targets = 0
targets_remaining = len(targets) targets_remaining = len(targets)
for index, target in enumerate(targets, start=1): for index, target in enumerate(targets, start=1):
@@ -36,10 +44,6 @@ class AttackAll(object):
Attacks a single `target` (wifite.model.target). Attacks a single `target` (wifite.model.target).
Returns: True if attacks should continue, False otherwise. Returns: True if attacks should continue, False otherwise.
''' '''
from .wep import AttackWEP
from .wpa import AttackWPA
from .wps import AttackWPS
from .pmkid import AttackPMKID
attacks = [] attacks = []
@@ -54,7 +58,7 @@ class AttackAll(object):
# WPA can have multiple attack vectors: # WPA can have multiple attack vectors:
# WPS # WPS
if target.wps != False: if target.wps != False and AttackWPS.can_attack_wps():
if Configuration.wps_pixie: if Configuration.wps_pixie:
attacks.append(AttackWPS(target, pixie_dust=True)) attacks.append(AttackWPS(target, pixie_dust=True))
if Configuration.wps_pin: if Configuration.wps_pin:

View File

@@ -3,9 +3,17 @@
from ..model.attack import Attack from ..model.attack import Attack
from ..util.color import Color from ..util.color import Color
from ..util.process import Process
from ..config import Configuration from ..config import Configuration
from ..tools.bully import Bully
from ..tools.reaver import Reaver
class AttackWPS(Attack): class AttackWPS(Attack):
@staticmethod
def can_attack_wps():
return Reaver.exists() or Bully.exists()
def __init__(self, target, pixie_dust=False): def __init__(self, target, pixie_dust=False):
super(AttackWPS, self).__init__(target) super(AttackWPS, self).__init__(target)
self.success = False self.success = False
@@ -36,16 +44,17 @@ class AttackWPS(Attack):
self.success = False self.success = False
return False return False
if Configuration.use_bully: if Configuration.use_bully and Bully.exists() or not Reaver.exists():
return self.run_bully() return self.run_bully()
else:
elif Reaver.exists():
return self.run_reaver() return self.run_reaver()
return False else:
return False
def run_bully(self): def run_bully(self):
from ..tools.bully import Bully
bully = Bully(self.target, pixie_dust=self.pixie_dust) bully = Bully(self.target, pixie_dust=self.pixie_dust)
bully.run() bully.run()
bully.stop() bully.stop()
@@ -55,8 +64,6 @@ class AttackWPS(Attack):
def run_reaver(self): def run_reaver(self):
from ..tools.reaver import Reaver
reaver = Reaver(self.target, pixie_dust=self.pixie_dust) reaver = Reaver(self.target, pixie_dust=self.pixie_dust)
reaver.run() reaver.run()
self.crack_result = reaver.crack_result self.crack_result = reaver.crack_result

View File

@@ -14,6 +14,12 @@ class Dependency(object):
) )
@classmethod
def exists(cls):
from ..util.process import Process
return Process.exists(cls.dependency_name)
@classmethod @classmethod
def run_dependency_check(cls): def run_dependency_check(cls):
from ..util.color import Color from ..util.color import Color

View File

@@ -8,11 +8,6 @@ class Iwconfig(Dependency):
dependency_name = 'iwconfig' dependency_name = 'iwconfig'
dependency_url = 'apt-get install wireless-tools' dependency_url = 'apt-get install wireless-tools'
@classmethod
def exists(cls):
from ..util.process import Process
return Process.exists('iwconfig')
@classmethod @classmethod
def mode(cls, iface, mode_name): def mode(cls, iface, mode_name):

View File

@@ -14,9 +14,6 @@ class Pyrit(Dependency):
def __init__(self): def __init__(self):
pass pass
@staticmethod
def exists():
return Process.exists('pyrit')
@staticmethod @staticmethod
def bssid_essid_with_handshakes(capfile, bssid=None, essid=None): def bssid_essid_with_handshakes(capfile, bssid=None, essid=None):

View File

@@ -14,9 +14,6 @@ class Tshark(Dependency):
def __init__(self): def __init__(self):
pass pass
@staticmethod
def exists():
return Process.exists('tshark')
@staticmethod @staticmethod
def _extract_src_dst_index_total(line): def _extract_src_dst_index_total(line):
@@ -29,6 +26,7 @@ class Tshark(Dependency):
(src, dst, index, total) = match.groups() (src, dst, index, total) = match.groups()
return src, dst, index, total return src, dst, index, total
@staticmethod @staticmethod
def _build_target_client_handshake_map(output, bssid=None): def _build_target_client_handshake_map(output, bssid=None):
# Map of target_ssid,client_ssid -> handshake #s # Map of target_ssid,client_ssid -> handshake #s

View File

@@ -14,9 +14,6 @@ class Wash(Dependency):
def __init__(self): def __init__(self):
pass pass
@staticmethod
def exists():
return Process.exists('wash')
@staticmethod @staticmethod
def check_for_wps_and_update_targets(capfile, targets): def check_for_wps_and_update_targets(capfile, targets):
@@ -62,6 +59,7 @@ class Wash(Dependency):
else: else:
t.wps = False t.wps = False
if __name__ == '__main__': if __name__ == '__main__':
test_file = './tests/files/contains_wps_network.cap' test_file = './tests/files/contains_wps_network.cap'