Avoid WPS if no reaver+bully. Use bully if reaver isn't available.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .wep import AttackWEP
|
||||
from .wpa import AttackWPA
|
||||
from .wps import AttackWPS
|
||||
from .pmkid import AttackPMKID
|
||||
from ..config import Configuration
|
||||
from ..util.color import Color
|
||||
|
||||
@@ -12,6 +16,10 @@ class AttackAll(object):
|
||||
Attacks all given `targets` (list[wifite.model.target]) until user interruption.
|
||||
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
|
||||
targets_remaining = len(targets)
|
||||
for index, target in enumerate(targets, start=1):
|
||||
@@ -36,10 +44,6 @@ class AttackAll(object):
|
||||
Attacks a single `target` (wifite.model.target).
|
||||
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 = []
|
||||
|
||||
@@ -54,7 +58,7 @@ class AttackAll(object):
|
||||
# WPA can have multiple attack vectors:
|
||||
|
||||
# WPS
|
||||
if target.wps != False:
|
||||
if target.wps != False and AttackWPS.can_attack_wps():
|
||||
if Configuration.wps_pixie:
|
||||
attacks.append(AttackWPS(target, pixie_dust=True))
|
||||
if Configuration.wps_pin:
|
||||
|
||||
@@ -3,9 +3,17 @@
|
||||
|
||||
from ..model.attack import Attack
|
||||
from ..util.color import Color
|
||||
from ..util.process import Process
|
||||
from ..config import Configuration
|
||||
from ..tools.bully import Bully
|
||||
from ..tools.reaver import Reaver
|
||||
|
||||
class AttackWPS(Attack):
|
||||
|
||||
@staticmethod
|
||||
def can_attack_wps():
|
||||
return Reaver.exists() or Bully.exists()
|
||||
|
||||
def __init__(self, target, pixie_dust=False):
|
||||
super(AttackWPS, self).__init__(target)
|
||||
self.success = False
|
||||
@@ -36,16 +44,17 @@ class AttackWPS(Attack):
|
||||
self.success = False
|
||||
return False
|
||||
|
||||
if Configuration.use_bully:
|
||||
if Configuration.use_bully and Bully.exists() or not Reaver.exists():
|
||||
return self.run_bully()
|
||||
else:
|
||||
|
||||
elif Reaver.exists():
|
||||
return self.run_reaver()
|
||||
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def run_bully(self):
|
||||
from ..tools.bully import Bully
|
||||
bully = Bully(self.target, pixie_dust=self.pixie_dust)
|
||||
bully.run()
|
||||
bully.stop()
|
||||
@@ -55,8 +64,6 @@ class AttackWPS(Attack):
|
||||
|
||||
|
||||
def run_reaver(self):
|
||||
from ..tools.reaver import Reaver
|
||||
|
||||
reaver = Reaver(self.target, pixie_dust=self.pixie_dust)
|
||||
reaver.run()
|
||||
self.crack_result = reaver.crack_result
|
||||
|
||||
Reference in New Issue
Block a user