Cleaning up imports, fixing a few bugs.

This commit is contained in:
derv82
2018-03-17 04:32:00 -04:00
parent f4a11f9acb
commit 7b9a023bd6
12 changed files with 48 additions and 37 deletions

View File

@@ -34,6 +34,7 @@ class AttackWEP(Attack):
aircrack = None # Aircrack process, not started yet aircrack = None # Aircrack process, not started yet
fakeauth_proc = None fakeauth_proc = None
replay_file = None replay_file = None
airodump_target = None
attacks_remaining = list(Configuration.wep_attacks) attacks_remaining = list(Configuration.wep_attacks)
while len(attacks_remaining) > 0: while len(attacks_remaining) > 0:
@@ -245,6 +246,9 @@ class AttackWEP(Attack):
Ask user what attack to perform next (re-orders attacks_remaining, returns False), Ask user what attack to perform next (re-orders attacks_remaining, returns False),
or if we should stop attacking this target (returns True). or if we should stop attacking this target (returns True).
''' '''
if target is None:
Color.pl("")
return True
target_name = target.essid if target.essid_known else target.bssid target_name = target.essid if target.essid_known else target.bssid
Color.pl("\n\n{!} {O}Interrupted") Color.pl("\n\n{!} {O}Interrupted")
@@ -322,9 +326,11 @@ class AttackWEP(Attack):
if __name__ == '__main__': if __name__ == '__main__':
from Target import Target Configuration.initialize(True)
from ..model.target import Target
fields = "A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 6, 54e,WEP, WEP, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, ".split(',') fields = "A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 6, 54e,WEP, WEP, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, ".split(',')
target = Target(fields) target = Target(fields)
wep = AttackWEP(target) wep = AttackWEP(target)
wep.run() wep.run()
Configuration.exit_gracefully(0)

View File

@@ -293,8 +293,14 @@ class AttackWPA(Attack):
Aireplay.deauth(target.bssid, client_mac=client, timeout=2) Aireplay.deauth(target.bssid, client_mac=client, timeout=2)
if __name__ == '__main__': if __name__ == '__main__':
from Target import Target Configuration.initialize(True)
from ..model.target import Target
fields = "A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 11, 54e,WPA, WPA, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, ".split(',') fields = "A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 11, 54e,WPA, WPA, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, ".split(',')
target = Target(fields) target = Target(fields)
wpa = AttackWPA(target) wpa = AttackWPA(target)
wpa.run() try:
wpa.run()
except KeyboardInterrupt:
Color.pl("")
pass
Configuration.exit_gracefully(0)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.util.color import Color from ..util.color import Color
import re import re
@@ -78,9 +78,8 @@ class Interface(object):
@staticmethod @staticmethod
def get_mac(iface=None): def get_mac(iface=None):
from Configuration import Configuration from ..config import Configuration
from Process import Process from ..util.process import Process
import re
if iface is None: if iface is None:
Configuration.initialize() Configuration.initialize()

View File

@@ -50,20 +50,20 @@ class CrackResult(object):
def load(json): def load(json):
''' Returns an instance of the appropriate object given a json instance ''' ''' Returns an instance of the appropriate object given a json instance '''
if json['type'] == 'WPA': if json['type'] == 'WPA':
from CrackResultWPA import CrackResultWPA from .wpa_result import CrackResultWPA
result = CrackResultWPA(json['bssid'], result = CrackResultWPA(json['bssid'],
json['essid'], json['essid'],
json['handshake_file'], json['handshake_file'],
json['key']) json['key'])
elif json['type'] == 'WEP': elif json['type'] == 'WEP':
from CrackResultWEP import CrackResultWEP from .wep_result import CrackResultWEP
result = CrackResultWEP(json['bssid'], result = CrackResultWEP(json['bssid'],
json['essid'], json['essid'],
json['hex_key'], json['hex_key'],
json['ascii_key']) json['ascii_key'])
elif json['type'] == 'WPS': elif json['type'] == 'WPS':
from CrackResultWPS import CrackResultWPS from .wps_result import CrackResultWPS
result = CrackResultWPS(json['bssid'], result = CrackResultWPS(json['bssid'],
json['essid'], json['essid'],
json['pin'], json['pin'],

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.util.color import Color from ..util.color import Color
import re import re

View File

@@ -314,7 +314,7 @@ class Aireplay(Thread):
if out.strip() == 'Wrote packet to: %s' % forged_file: if out.strip() == 'Wrote packet to: %s' % forged_file:
return forged_file return forged_file
else: else:
from Color import Color from ..util.color import Color
Color.pl('{!} {R}failed to forge packet from .xor file{W}') Color.pl('{!} {R}failed to forge packet from .xor file{W}')
Color.pl('output:\n"%s"' % out) Color.pl('output:\n"%s"' % out)
return None return None
@@ -385,7 +385,7 @@ if __name__ == '__main__':
t = WEPAttackType(t) t = WEPAttackType(t)
print t.name, type(t.name), t.value print t.name, type(t.name), t.value
from Target import Target from ..model.target import Target
fields = 'A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 6, 54e, WEP, WEP, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, '.split(',') fields = 'A4:2B:8C:16:6B:3A, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 6, 54e, WEP, WEP, , -58, 2, 0, 0. 0. 0. 0, 9, Test Router Please Ignore, '.split(',')
t = Target(fields) t = Target(fields)

View File

@@ -1,11 +1,11 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.util.process import Process from .tshark import Tshark
from wifite.config import Configuration from ..util.process import Process
from wifite.model.target import Target from ..config import Configuration
from wifite.model.client import Client from ..model.target import Target
from wifite.tools.tshark import Tshark from ..model.client import Client
import os, time import os, time
@@ -278,7 +278,7 @@ class Airodump(object):
self.decloaking = True self.decloaking = True
self.decloaked_times[target.bssid] = now self.decloaked_times[target.bssid] = now
if Configuration.verbose > 1: if Configuration.verbose > 1:
from Color import Color from ..util.color import Color
verbout = " [?] Deauthing %s" % target.bssid verbout = " [?] Deauthing %s" % target.bssid
verbout += " (broadcast & %d clients)" % len(target.clients) verbout += " (broadcast & %d clients)" % len(target.clients)
Color.pe("\n{C}" + verbout + "{W}") Color.pe("\n{C}" + verbout + "{W}")
@@ -296,7 +296,7 @@ if __name__ == '__main__':
from time import sleep from time import sleep
sleep(7) sleep(7)
from Color import Color from ..util.color import Color
targets = airodump.get_targets() targets = airodump.get_targets()
for idx, target in enumerate(targets, start=1): for idx, target in enumerate(targets, start=1):

View File

@@ -217,7 +217,7 @@ class Bully(Attack):
if __name__ == '__main__': if __name__ == '__main__':
stdout = " [*] Pin is '11867722', key is '9a6f7997'" stdout = " [*] Pin is '11867722', key is '9a6f7997'"
Configuration.initialize(False) Configuration.initialize(False)
from Target import Target from ..model.target import Target
fields = 'AA:BB:CC:DD:EE:FF,2015-05-27 19:28:44,2015-05-27 19:28:46,1,54,WPA2,CCMP TKIP,PSK,-58,2,0,0.0.0.0,9,HOME-ABCD,'.split(',') fields = 'AA:BB:CC:DD:EE:FF,2015-05-27 19:28:44,2015-05-27 19:28:46,1,54,WPA2,CCMP TKIP,PSK,-58,2,0,0.0.0.0,9,HOME-ABCD,'.split(',')
target = Target(fields) target = Target(fields)
b = Bully(target) b = Bully(target)

View File

@@ -1,8 +1,8 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.model.interface import Interface from ..model.interface import Interface
from wifite.util.color import Color from ..util.color import Color
class Macchanger(object): class Macchanger(object):
is_init = False is_init = False
@@ -12,7 +12,7 @@ class Macchanger(object):
@classmethod @classmethod
def init(cls): def init(cls):
if cls.is_init: return if cls.is_init: return
from Configuration import Configuration from ..config import Configuration
iface = Configuration.interface iface = Configuration.interface
if type(iface) == Interface: if type(iface) == Interface:
iface = iface.name iface = iface.name
@@ -21,8 +21,8 @@ class Macchanger(object):
@classmethod @classmethod
def down_macch_up(cls, macch_option): def down_macch_up(cls, macch_option):
cls.init() cls.init()
from Process import Process from ..util.process import Process
from Configuration import Configuration from ..config import Configuration
iface = Configuration.interface iface = Configuration.interface
cmd = ["ifconfig", iface, "down"] cmd = ["ifconfig", iface, "down"]
@@ -61,7 +61,7 @@ class Macchanger(object):
# --permanent to reset to permanent MAC address # --permanent to reset to permanent MAC address
if not cls.down_macch_up("-p"): return if not cls.down_macch_up("-p"): return
Color.pl("\r{+} {C}macchanger{W}: Resetting MAC address...") Color.pl("\r{+} {C}macchanger{W}: Resetting MAC address...")
from Configuration import Configuration from ..config import Configuration
new_mac = Interface.get_mac(Configuration.interface) new_mac = Interface.get_mac(Configuration.interface)
Color.clear_entire_line() Color.clear_entire_line()
Color.pl("\r{+} {C}macchanger{W}: Reset MAC address back to {C}%s{W}" % new_mac) Color.pl("\r{+} {C}macchanger{W}: Reset MAC address back to {C}%s{W}" % new_mac)
@@ -71,7 +71,7 @@ class Macchanger(object):
# Use --permanent to use random MAC address # Use --permanent to use random MAC address
if not cls.down_macch_up("-r"): return if not cls.down_macch_up("-r"): return
cls.is_changed = True cls.is_changed = True
from Configuration import Configuration from ..config import Configuration
new_mac = Interface.get_mac(Configuration.interface) new_mac = Interface.get_mac(Configuration.interface)
Color.clear_entire_line() Color.clear_entire_line()
Color.pl("\r{+} {C}macchanger{W}: Changed MAC address to {C}%s{W}" % new_mac) Color.pl("\r{+} {C}macchanger{W}: Changed MAC address to {C}%s{W}" % new_mac)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.util.process import Process from ..util.process import Process
import re import re
class Tshark(object): class Tshark(object):
@@ -63,7 +63,7 @@ if __name__ == '__main__':
test_file = './tests/files/contains_wps_network.cap' test_file = './tests/files/contains_wps_network.cap'
target_bssid = 'A4:2B:8C:16:6B:3A' target_bssid = 'A4:2B:8C:16:6B:3A'
from Target import Target from ..model.target import Target
fields = [ fields = [
'A4:2B:8C:16:6B:3A', # BSSID 'A4:2B:8C:16:6B:3A', # BSSID
'2015-05-27 19:28:44', '2015-05-27 19:28:46', # Dates '2015-05-27 19:28:44', '2015-05-27 19:28:46', # Dates

View File

@@ -4,8 +4,8 @@
import time import time
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from wifite.util.color import Color from ..util.color import Color
from wifite.config import Configuration from ..config import Configuration
class Process(object): class Process(object):

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from wifite.tools.airodump import Airodump from ..tools.airodump import Airodump
from wifite.util.color import Color from ..util.color import Color
from wifite.model.target import Target from ..model.target import Target
from wifite.config import Configuration from ..config import Configuration
from time import sleep, time from time import sleep, time
@@ -120,7 +120,7 @@ class Scanner(object):
# 1) We have less targets than before, so we can't overwrite the previous list # 1) We have less targets than before, so we can't overwrite the previous list
# 2) The terminal can't display the targets without scrolling. # 2) The terminal can't display the targets without scrolling.
# Clear the screen. # Clear the screen.
from Process import Process from ..util.process import Process
Process.call('clear') Process.call('clear')
else: else:
# We can fit the targets in the terminal without scrolling # We can fit the targets in the terminal without scrolling