Uses Wash to detect WPS, small improvements
This commit is contained in:
@@ -4,6 +4,7 @@ from Process import Process
|
|||||||
from Configuration import Configuration
|
from Configuration import Configuration
|
||||||
from Target import Target
|
from Target import Target
|
||||||
from Client import Client
|
from Client import Client
|
||||||
|
from Wash import Wash
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -129,6 +130,10 @@ class Airodump(object):
|
|||||||
|
|
||||||
targets.append(target)
|
targets.append(target)
|
||||||
|
|
||||||
|
# Check targets for WPS
|
||||||
|
capfile = csv_filename[:-3] + 'cap'
|
||||||
|
Wash.check_for_wps_and_update_targets(capfile, targets)
|
||||||
|
|
||||||
# Sort by power
|
# Sort by power
|
||||||
targets.sort(key=lambda x: x.power, reverse=True)
|
targets.sort(key=lambda x: x.power, reverse=True)
|
||||||
|
|
||||||
@@ -140,13 +145,17 @@ class Airodump(object):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
''' Example usage. wlan0mon should be in Monitor Mode '''
|
''' Example usage. wlan0mon should be in Monitor Mode '''
|
||||||
with Airodump('wlan0mon', channel=6) as airodump:
|
with Airodump('wlan0mon', channel=6) as airodump:
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
sleep(7)
|
sleep(7)
|
||||||
|
|
||||||
|
from Color import Color
|
||||||
|
|
||||||
targets = airodump.get_targets()
|
targets = airodump.get_targets()
|
||||||
for t in targets:
|
Target.print_header()
|
||||||
print 'Target>', t
|
for (index, target) in enumerate(targets):
|
||||||
|
index += 1
|
||||||
|
Color.pl(' {G}%s %s' % (str(index).rjust(3), target))
|
||||||
|
|
||||||
Configuration.delete_temp()
|
Configuration.delete_temp()
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ class Client(object):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
fields = '54:35:30:23:62:8E, 2015-05-27 19:43:47, 2015-05-27 19:43:47, -67, 2, (not associated) ,HOME-1102'.split(',')
|
fields = 'AA:BB:CC:DD:EE:FF, 2015-05-27 19:43:47, 2015-05-27 19:43:47, -67, 2, (not associated) ,HOME-ABCD'.split(',')
|
||||||
c = Client(fields)
|
c = Client(fields)
|
||||||
print c
|
print c
|
||||||
|
|||||||
80
py/Target.py
80
py/Target.py
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from Color import Color
|
||||||
|
|
||||||
class Target(object):
|
class Target(object):
|
||||||
'''
|
'''
|
||||||
Holds details for a "Target" aka Access Point (e.g. router).
|
Holds details for a "Target" aka Access Point (e.g. router).
|
||||||
@@ -45,32 +47,82 @@ class Target(object):
|
|||||||
self.beacons = int(fields[9].strip())
|
self.beacons = int(fields[9].strip())
|
||||||
self.ivs = int(fields[10].strip())
|
self.ivs = int(fields[10].strip())
|
||||||
|
|
||||||
|
self.essid_known = True
|
||||||
self.essid_len = int(fields[12].strip())
|
self.essid_len = int(fields[12].strip())
|
||||||
self.essid = fields[13].strip()
|
self.essid = fields[13].strip()
|
||||||
if self.essid == '\\x00' * self.essid_len:
|
if self.essid == '\\x00' * self.essid_len:
|
||||||
# Don't display "\x00..." for hidden ESSIDs
|
# Don't display "\x00..." for hidden ESSIDs
|
||||||
self.essid = '(hidden, length: %s)' % self.essid_len
|
self.essid = '(%s)' % self.bssid
|
||||||
|
self.essid_known = False
|
||||||
|
|
||||||
|
self.wps = False
|
||||||
|
|
||||||
self.clients = []
|
self.clients = []
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' String representation of this Target '''
|
''' *Colored* string representation of this Target '''
|
||||||
result = ''
|
|
||||||
for (key,value) in self.__dict__.iteritems():
|
max_essid_len = 25
|
||||||
if key == 'clients': continue
|
essid = self.essid
|
||||||
result += key + ': ' + str(value)
|
# Trim ESSID (router name) if needed
|
||||||
result += ', '
|
if len(essid) > max_essid_len:
|
||||||
for client in self.clients:
|
essid = essid[0:max_essid_len-3] + '...'
|
||||||
result += 'client: %s' % client.station
|
else:
|
||||||
result += ','
|
essid = essid.rjust(max_essid_len)
|
||||||
if result.endswith(', '):
|
|
||||||
result = result[:-2]
|
if self.essid_known:
|
||||||
|
# Known ESSID
|
||||||
|
essid = Color.s("{C}%s" % essid)
|
||||||
|
else:
|
||||||
|
# Unknown ESSID
|
||||||
|
essid = Color.s("{O}%s" % essid)
|
||||||
|
|
||||||
|
channel = str(self.channel)
|
||||||
|
if len(channel) == 1:
|
||||||
|
channel = Color.s("{G} %s" % channel)
|
||||||
|
|
||||||
|
encryption = self.encryption.rjust(4)
|
||||||
|
if 'WEP' in encryption:
|
||||||
|
encryption = Color.s("{G}%s" % encryption)
|
||||||
|
elif 'WPA' in encryption:
|
||||||
|
encryption = Color.s("{O}%s" % encryption)
|
||||||
|
|
||||||
|
power = '%sdb' % str(self.power).rjust(3)
|
||||||
|
if self.power > 50:
|
||||||
|
color ='G'
|
||||||
|
elif self.power > 35:
|
||||||
|
color = 'O'
|
||||||
|
else:
|
||||||
|
color = 'R'
|
||||||
|
power = Color.s('{%s}%s' % (color, power))
|
||||||
|
|
||||||
|
wps = Color.s('{R} no')
|
||||||
|
if self.wps:
|
||||||
|
wps = Color.s('{G} yes')
|
||||||
|
|
||||||
|
clients = ' '
|
||||||
|
if len(self.clients) == 1:
|
||||||
|
clients = Color.s('{G}client ')
|
||||||
|
elif len(self.clients) > 1:
|
||||||
|
clients = Color.s('{G}clients')
|
||||||
|
|
||||||
|
result = '%s %s %s %s %s %s' % (essid, channel,
|
||||||
|
encryption, power,
|
||||||
|
wps, clients)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def print_header():
|
||||||
|
print ' NUM ESSID CH ENCR POWER WPS? CLIENT'
|
||||||
|
print ' --- ------------------------- -- ---- ----- ---- ------'
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
fields = '00:AC:E0:71:74:E0, 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-74E2, '.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(',')
|
||||||
t = Target(fields)
|
t = Target(fields)
|
||||||
print t
|
t.clients.append("asdf")
|
||||||
|
t.clients.append("asdf")
|
||||||
|
Target.print_header()
|
||||||
|
Color.pl(' {G}%s %s' % ('1'.rjust(3), t))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user