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
fakeauth_proc = None
replay_file = None
airodump_target = None
attacks_remaining = list(Configuration.wep_attacks)
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),
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
Color.pl("\n\n{!} {O}Interrupted")
@@ -322,9 +326,11 @@ class AttackWEP(Attack):
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(',')
target = Target(fields)
wep = AttackWEP(target)
wep.run()
Configuration.exit_gracefully(0)

View File

@@ -293,8 +293,14 @@ class AttackWPA(Attack):
Aireplay.deauth(target.bssid, client_mac=client, timeout=2)
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(',')
target = Target(fields)
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
# -*- coding: utf-8 -*-
from wifite.util.color import Color
from ..util.color import Color
import re
@@ -78,9 +78,8 @@ class Interface(object):
@staticmethod
def get_mac(iface=None):
from Configuration import Configuration
from Process import Process
import re
from ..config import Configuration
from ..util.process import Process
if iface is None:
Configuration.initialize()

View File

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

View File

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

View File

@@ -314,7 +314,7 @@ class Aireplay(Thread):
if out.strip() == 'Wrote packet to: %s' % forged_file:
return forged_file
else:
from Color import Color
from ..util.color import Color
Color.pl('{!} {R}failed to forge packet from .xor file{W}')
Color.pl('output:\n"%s"' % out)
return None
@@ -385,7 +385,7 @@ if __name__ == '__main__':
t = WEPAttackType(t)
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(',')
t = Target(fields)

View File

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

View File

@@ -217,7 +217,7 @@ class Bully(Attack):
if __name__ == '__main__':
stdout = " [*] Pin is '11867722', key is '9a6f7997'"
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(',')
target = Target(fields)
b = Bully(target)

View File

@@ -1,8 +1,8 @@
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
from wifite.model.interface import Interface
from wifite.util.color import Color
from ..model.interface import Interface
from ..util.color import Color
class Macchanger(object):
is_init = False
@@ -12,7 +12,7 @@ class Macchanger(object):
@classmethod
def init(cls):
if cls.is_init: return
from Configuration import Configuration
from ..config import Configuration
iface = Configuration.interface
if type(iface) == Interface:
iface = iface.name
@@ -21,8 +21,8 @@ class Macchanger(object):
@classmethod
def down_macch_up(cls, macch_option):
cls.init()
from Process import Process
from Configuration import Configuration
from ..util.process import Process
from ..config import Configuration
iface = Configuration.interface
cmd = ["ifconfig", iface, "down"]
@@ -61,7 +61,7 @@ class Macchanger(object):
# --permanent to reset to permanent MAC address
if not cls.down_macch_up("-p"): return
Color.pl("\r{+} {C}macchanger{W}: Resetting MAC address...")
from Configuration import Configuration
from ..config import Configuration
new_mac = Interface.get_mac(Configuration.interface)
Color.clear_entire_line()
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
if not cls.down_macch_up("-r"): return
cls.is_changed = True
from Configuration import Configuration
from ..config import Configuration
new_mac = Interface.get_mac(Configuration.interface)
Color.clear_entire_line()
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
# -*- coding: utf-8 -*-
from wifite.util.process import Process
from ..util.process import Process
import re
class Tshark(object):
@@ -63,7 +63,7 @@ if __name__ == '__main__':
test_file = './tests/files/contains_wps_network.cap'
target_bssid = 'A4:2B:8C:16:6B:3A'
from Target import Target
from ..model.target import Target
fields = [
'A4:2B:8C:16:6B:3A', # BSSID
'2015-05-27 19:28:44', '2015-05-27 19:28:46', # Dates

View File

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

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
from wifite.tools.airodump import Airodump
from wifite.util.color import Color
from wifite.model.target import Target
from wifite.config import Configuration
from ..tools.airodump import Airodump
from ..util.color import Color
from ..model.target import Target
from ..config import Configuration
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
# 2) The terminal can't display the targets without scrolling.
# Clear the screen.
from Process import Process
from ..util.process import Process
Process.call('clear')
else:
# We can fit the targets in the terminal without scrolling