From adc7d37318216af8d3e29480920915ca1a356509 Mon Sep 17 00:00:00 2001 From: derv82 Date: Thu, 19 Apr 2018 12:59:11 -0400 Subject: [PATCH] Don't kill+restart aircrack after 30s, wait 60s for target, Also detect enabled/disabled interfaces when putting in/out of monitor mode. --- wifite/attack/wep.py | 2 ++ wifite/model/attack.py | 2 +- wifite/tools/aireplay.py | 2 +- wifite/tools/airmon.py | 22 +++++++++++++++++----- wifite/tools/ifconfig.py | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/wifite/attack/wep.py b/wifite/attack/wep.py index 2421c2a..1812303 100755 --- a/wifite/attack/wep.py +++ b/wifite/attack/wep.py @@ -137,6 +137,7 @@ class AttackWEP(Attack): self.fake_auth() aircrack = Aircrack(ivs_file) + ''' elif Configuration.wep_restart_aircrack > 0 and \ aircrack.pid.running_time() > Configuration.wep_restart_aircrack: # Restart aircrack after X seconds @@ -144,6 +145,7 @@ class AttackWEP(Attack): ivs_file = airodump.find_files(endswith='.ivs')[0] Color.pl('\n{+} {C}aircrack{W} ran for more than {C}%d{W} seconds, restarting' % Configuration.wep_restart_aircrack) aircrack = Aircrack(ivs_file) + ''' if not aireplay.is_running(): diff --git a/wifite/model/attack.py b/wifite/model/attack.py index a915c21..5a61994 100755 --- a/wifite/model/attack.py +++ b/wifite/model/attack.py @@ -6,7 +6,7 @@ import time class Attack(object): '''Contains functionality common to all attacks.''' - target_wait = 20 + target_wait = 60 def __init__(self, target): self.target = target diff --git a/wifite/tools/aireplay.py b/wifite/tools/aireplay.py index 565bb31..282ed0a 100755 --- a/wifite/tools/aireplay.py +++ b/wifite/tools/aireplay.py @@ -222,7 +222,7 @@ class Aireplay(Thread): if pps == "0": self.status = "Waiting for packet..." else: - self.status = "Replaying packet @ %s/sec" % pps + self.status = "Replaying @ %s/sec" % pps pass def __del__(self): diff --git a/wifite/tools/airmon.py b/wifite/tools/airmon.py index b844b02..790a843 100755 --- a/wifite/tools/airmon.py +++ b/wifite/tools/airmon.py @@ -213,7 +213,7 @@ class Airmon(object): airmon_output = Process(['airmon-ng', 'stop', iface]).stdout() - disabled_iface = Airmon._parse_airmon_stop(airmon_output) + (disabled_iface, enabled_iface) = Airmon._parse_airmon_stop(airmon_output) if not disabled_iface and iface in Airmon.BAD_DRIVERS: Color.p('{O}"bad driver" detected{W} ') @@ -224,6 +224,8 @@ class Airmon(object): else: Color.pl('{O}could not disable on {R}%s{W}' % iface) + return (disabled_iface, enabled_iface) + @staticmethod def _parse_airmon_stop(airmon_output): @@ -235,17 +237,25 @@ class Airmon(object): # airmon-ng 1.2rc1 output: wlan0mon (removed) removed_re = re.compile(r'([a-zA-Z0-9]+).*\(removed\)') + # Enabled interface: (mac80211 station mode vif enabled on [phy4]wlan0) + enabled_re = re.compile(r'\s*\(mac80211 station mode (?:vif )?enabled on (?:\[\w+\])?(\w+)\)\s*') + disabled_iface = None + enabled_iface = None for line in airmon_output.split('\n'): matches = disabled_re.match(line) if matches: - return matches.group(1) + disabled_iface = matches.group(1) matches = removed_re.match(line) if matches: - return matches.group(1) + disabled_iface = matches.group(1) - return None + matches = enabled_re.match(line) + if matches: + enabled_iface = matches.group(1) + + return (disabled_iface, enabled_iface) @staticmethod @@ -386,4 +396,6 @@ class Airmon(object): if __name__ == '__main__': Airmon.terminate_conflicting_processes() iface = Airmon.ask() - Airmon.stop(iface) + (disabled_iface, enabled_iface) = Airmon.stop(iface) + print("Disabled:", disabled_iface) + print("Enabled:", enabled_iface) diff --git a/wifite/tools/ifconfig.py b/wifite/tools/ifconfig.py index 5a9cb0c..6d53dfe 100755 --- a/wifite/tools/ifconfig.py +++ b/wifite/tools/ifconfig.py @@ -10,11 +10,12 @@ class Ifconfig(object): '''Put interface up''' from ..util.process import Process - command = ['ifconfig', interface, 'up'] + command = ['ifconfig', interface] if type(args) is list: command.extend(args) elif type(args) is 'str': command.append(args) + command.append('up') pid = Process(command) pid.wait()