diff --git a/wifite/attack/wep.py b/wifite/attack/wep.py index a97ef2e..2421c2a 100755 --- a/wifite/attack/wep.py +++ b/wifite/attack/wep.py @@ -5,8 +5,8 @@ from ..model.attack import Attack from ..tools.airodump import Airodump from ..tools.aireplay import Aireplay, WEPAttackType from ..tools.aircrack import Aircrack +from ..tools.ifconfig import Ifconfig from ..config import Configuration -from ..model.interface import Interface from ..util.color import Color from ..util.input import raw_input from ..model.wep_result import CrackResultWEP @@ -57,7 +57,7 @@ class AttackWEP(Attack): if self.fake_auth(): # We successfully authenticated! # Use our interface's MAC address for the attacks. - client_mac = Interface.get_mac() + client_mac = Ifconfig.get_mac(Configuration.interface) # Keep us authenticated fakeauth_proc = Aireplay(self.target, "fakeauth") elif len(airodump_target.clients) == 0: diff --git a/wifite/model/interface.py b/wifite/model/interface.py deleted file mode 100755 index 61aa6d4..0000000 --- a/wifite/model/interface.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/python2.7 -# -*- coding: utf-8 -*- - -from ..tools.ifconfig import Ifconfig -from ..util.color import Color - -import re - -class Interface(object): - ''' - Represents an 'interface' known by airmon-ng - ''' - - def __init__(self, fields): - ''' - Initializes & stores info about an interface. - - Args: - Fields - list of fields - 0: PHY - 1: INTERFACE - 2: DRIVER - 3: CHIPSET - ''' - if len(fields) == 3: - phy = 'phyX' - match = re.search(' - \[(phy\d+)\]', fields[2]) - if match: - phy = match.groups()[0] - fields[2] = fields[2][:fields[2].rfind(' - [')] - fields.insert(0, phy) - if len(fields) != 4: - raise Exception("Expected 4, got %d in %s" % (len(fields), fields)) - self.phy = fields[0].strip() - self.interface = fields[1].strip() - self.driver = fields[2].strip() - self.chipset = fields[3].strip() - - # Max length of fields. - # Used for printing a table of interfaces. - PHY_LEN = 6 - INTERFACE_LEN = 12 - DRIVER_LEN = 20 - CHIPSET_LEN = 30 - - def __str__(self): - ''' Colored string representation of interface ''' - s = Color.s('{W}%s' % self.phy.ljust(self.PHY_LEN)) - s += Color.s('{G}%s' % self.interface.ljust(self.INTERFACE_LEN)) - s += Color.s('{C}%s' % self.driver.ljust(self.DRIVER_LEN)) - s += Color.s('{W}%s' % self.chipset.ljust(self.CHIPSET_LEN)) - return s - - @staticmethod - def menu_header(): - ''' Colored header row for interfaces ''' - s = ' ' - s += 'PHY'.ljust(Interface.PHY_LEN) - s += 'Interface'.ljust(Interface.INTERFACE_LEN) - s += 'Driver'.ljust(Interface.DRIVER_LEN) - s += 'Chipset'.ljust(Interface.CHIPSET_LEN) - s += '\n' - s += '-' * (Interface.PHY_LEN + Interface.INTERFACE_LEN + Interface.DRIVER_LEN + Interface.CHIPSET_LEN + 3) - return s - - @staticmethod - def get_mac(iface=None): - from ..config import Configuration - from ..util.process import Process - - if iface is None: - Configuration.initialize() - iface = Configuration.interface - if iface is None: - raise Exception('Interface must be defined (-i)') - - Ifconfig.get_mac(iface) - -if __name__ == '__main__': - mac = Interface.get_mac() - print('wlan0mon mac address:', mac) diff --git a/wifite/tools/airmon.py b/wifite/tools/airmon.py index 5f42dc3..b844b02 100755 --- a/wifite/tools/airmon.py +++ b/wifite/tools/airmon.py @@ -1,7 +1,6 @@ #!/usr/bin/python2.7 # -*- coding: utf-8 -*- -from ..model.interface import Interface from ..tools.ifconfig import Ifconfig from ..tools.iwconfig import Iwconfig from ..util.process import Process @@ -23,15 +22,16 @@ class AirmonIface(object): # Max length of fields. # Used for printing a table of interfaces. - PHY_LEN = 6 INTERFACE_LEN = 12 + PHY_LEN = 6 DRIVER_LEN = 20 CHIPSET_LEN = 30 def __str__(self): ''' Colored string representation of interface ''' - s = Color.s('{W}%s' % self.phy.ljust(self.PHY_LEN)) + s = '' s += Color.s('{G}%s' % self.interface.ljust(self.INTERFACE_LEN)) + s += Color.s('{W}%s' % self.phy.ljust(self.PHY_LEN)) s += Color.s('{C}%s' % self.driver.ljust(self.DRIVER_LEN)) s += Color.s('{W}%s' % self.chipset.ljust(self.CHIPSET_LEN)) return s @@ -39,13 +39,13 @@ class AirmonIface(object): @staticmethod def menu_header(): ''' Colored header row for interfaces ''' - s = ' ' - s += 'PHY'.ljust(AirmonIface.PHY_LEN) + s = ' ' # Space for index # s += 'Interface'.ljust(AirmonIface.INTERFACE_LEN) + s += 'PHY'.ljust(AirmonIface.PHY_LEN) s += 'Driver'.ljust(AirmonIface.DRIVER_LEN) s += 'Chipset'.ljust(AirmonIface.CHIPSET_LEN) s += '\n' - s += '-' * (Interface.PHY_LEN + Interface.INTERFACE_LEN + Interface.DRIVER_LEN + Interface.CHIPSET_LEN + 3) + s += '-' * (AirmonIface.INTERFACE_LEN + AirmonIface.PHY_LEN + AirmonIface.DRIVER_LEN + AirmonIface.CHIPSET_LEN + 3) return s diff --git a/wifite/tools/macchanger.py b/wifite/tools/macchanger.py index 43313c8..0619b3f 100755 --- a/wifite/tools/macchanger.py +++ b/wifite/tools/macchanger.py @@ -1,7 +1,6 @@ #!/usr/bin/python2.7 # -*- coding: utf-8 -*- -from ..model.interface import Interface from ..tools.ifconfig import Ifconfig from ..util.color import Color