Fix tshark ssid discovery

This commit is contained in:
derv82
2017-05-14 10:54:24 -04:00
parent 62503b0d0c
commit c836cb9e6b
8 changed files with 24 additions and 18 deletions

View File

@@ -172,7 +172,7 @@ if __name__ == '__main__':
w.main() w.main()
except Exception, e: except Exception, e:
Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e)) Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e))
if Configuration.verbose > 0: if Configuration.verbose > 0 or True:
Color.pl('\n{!} {O}Full stack trace below') Color.pl('\n{!} {O}Full stack trace below')
from traceback import format_exc from traceback import format_exc
Color.p('\n{!} ') Color.p('\n{!} ')

View File

@@ -201,11 +201,11 @@ class Airodump(object):
if target.essid_len == 0: if target.essid_len == 0:
# Ignore empty/blank ESSIDs # Ignore empty/blank ESSIDs
continue pass
if target.channel == "-1": if target.channel == "-1":
# Ignore -1 channel # Ignore -1 channel
continue pass
targets.append(target) targets.append(target)
return targets return targets

View File

@@ -38,8 +38,9 @@ class AttackWPA(Attack):
output_file_prefix='wpa') as airodump: output_file_prefix='wpa') as airodump:
Color.clear_line() Color.clear_line()
Color.p('\r{+} {C}WPA-handshake attack{W}: ') Color.pattack("WPA", self.target, "Handshake capture", "Waiting for target to appear...")
Color.p('{O}waiting{W} for target to appear...') #Color.p('\r{+} {C}WPA-handshake attack{W}: ')
#Color.p('{O}waiting{W} for target to appear...')
airodump_target = self.wait_for_target(airodump) airodump_target = self.wait_for_target(airodump)
# Get client station MAC addresses # Get client station MAC addresses
@@ -55,9 +56,10 @@ class AttackWPA(Attack):
while True: while True:
if not deauth_proc or deauth_proc.poll() != None: if not deauth_proc or deauth_proc.poll() != None:
# Clear line only if we're not deauthing right now # Clear line only if we're not deauthing right now
Color.p('\r%s\r' % (' ' * 90)) Color.clear_line()
Color.p('\r{+} {C}WPA-handshake attack{W}: ') Color.pattack("WPA", airodump_target, "Handshake capture", "Waiting for handshake...")
Color.p('waiting for {C}handshake{W}...') #Color.p('\r{+} {C}WPA-handshake attack{W}: ')
#Color.p('waiting for {C}handshake{W}...')
time.sleep(1) time.sleep(1)
@@ -97,8 +99,8 @@ class AttackWPA(Attack):
airodump_target = self.wait_for_target(airodump) airodump_target = self.wait_for_target(airodump)
for client in airodump_target.clients: for client in airodump_target.clients:
if client.station not in clients: if client.station not in clients:
Color.pl('\r{+} discovered {G}client{W}:' + Color.clear_line()
' {C}%s{W}%s' % (client.station, ' ' * 10)) Color.pl('\r{+} discovered new {G}client{W}: {C}%s{W}' % client.station)
clients.append(client.station) clients.append(client.station)
# Send deauth to a client or broadcast # Send deauth to a client or broadcast

View File

@@ -82,8 +82,9 @@ class Color(object):
[name] ESSID (MAC @ Pwr) Attack_Type: Progress [name] ESSID (MAC @ Pwr) Attack_Type: Progress
e.g.: [WEP] Router2G (00:11:22 @ 23db) replay attack: 102 IVs e.g.: [WEP] Router2G (00:11:22 @ 23db) replay attack: 102 IVs
''' '''
essid = "{C}%s{W}" % target.essid if target.essid_known else "{O}unknown{W}"
Color.p("\r{+} {G}%s{W} ({C}%s @ %sdb{W}) {G}%s {C}%s{W}: %s " % ( Color.p("\r{+} {G}%s{W} ({C}%s @ %sdb{W}) {G}%s {C}%s{W}: %s " % (
target.essid, target.bssid, target.power, attack_type, attack_name, progress)) essid, target.bssid, target.power, attack_type, attack_name, progress))
if __name__ == '__main__': if __name__ == '__main__':
Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done") Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done")

View File

@@ -59,7 +59,8 @@ class Configuration(object):
Configuration.wordlist = None Configuration.wordlist = None
wordlists = [ wordlists = [
'/usr/share/wfuzz/wordlist/fuzzdb/wordlists-user-passwd/passwds/phpbb.txt', '/usr/share/wfuzz/wordlist/fuzzdb/wordlists-user-passwd/passwds/phpbb.txt',
'/usr/share/fuzzdb/wordlists-user-passwd/passwds/phpbb.txt' '/usr/share/fuzzdb/wordlists-user-passwd/passwds/phpbb.txt',
'/usr/share/sqlmap/txt/wordlist.txt'
] ]
for wlist in wordlists: for wlist in wordlists:
if os.path.exists(wlist): if os.path.exists(wlist):

View File

@@ -90,22 +90,24 @@ class Handshake(object):
cmd = [ cmd = [
'tshark', 'tshark',
'-r', self.capfile, '-r', self.capfile,
'-R', 'wlan.fc.type_subtype == 0x08', '-R', 'wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05',
'-2', # tshark: -R without -2 is deprecated.
'-n' '-n'
] ]
proc = Process(cmd, devnull=False) proc = Process(cmd, devnull=False)
for line in proc.stdout().split('\n'): for line in proc.stdout().split('\n'):
# Extract src, dst, and essid # Extract src, dst, and essid
mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1] mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1]
match = re.search('(%s) -> (%s).*.*SSID=(.*)$' match = re.search('(%s) [^ ]* (%s).*.*SSID=(.*)$'
% (mac_regex, mac_regex), line) % (mac_regex, mac_regex), line)
if match == None: if match == None:
# Line doesn't contain src, dst, ssid # Line doesn't contain src, dst, ssid
continue continue
(src, dst, essid) = match.groups() (src, dst, essid) = match.groups()
if dst.lower() == "ff:ff:ff:ff:ff:ff": continue
if self.bssid: if self.bssid:
# We know the BSSID, only return the ESSID for this BSSID. # We know the BSSID, only return the ESSID for this BSSID.
if self.bssid.lower() == src.lower(): if self.bssid.lower() == src.lower() or self.bssid.lower() == dst.lower():
essids.add((src, essid)) essids.add((src, essid))
else: else:
# We do not know BSSID, add it. # We do not know BSSID, add it.
@@ -263,7 +265,7 @@ class Handshake(object):
hit_Target = False hit_Target = False
else: else:
# Line does not contain AccessPoint # Line does not contain AccessPoint
if hit_target and ', good,' in line: if hit_target and ', good' in line:
bssid_essid_pairs.add( (current_bssid, current_essid) ) bssid_essid_pairs.add( (current_bssid, current_essid) )
return [x for x in bssid_essid_pairs] return [x for x in bssid_essid_pairs]

View File

@@ -52,7 +52,7 @@ class Scanner(object):
Color.p( Color.p(
'\r{+} scanning, found' + '\r{+} scanning, found' +
' {G}%d{W} target(s),' % target_count + ' {G}%d{W} target(s),' % target_count +
' {G}%d{W} clients.' % client_count + ' {G}%d{W} client(s).' % client_count +
' {O}Ctrl+C{W} when ready') ' {O}Ctrl+C{W} when ready')
sleep(1) sleep(1)
except KeyboardInterrupt: except KeyboardInterrupt: