Various small fixes + tweaks

This commit is contained in:
derv82
2017-05-14 09:34:09 -04:00
parent b0bd0342d7
commit 62503b0d0c
7 changed files with 36 additions and 23 deletions

View File

@@ -77,8 +77,8 @@ class AttackWEP(Attack):
while True: while True:
airodump_target = self.wait_for_target(airodump) airodump_target = self.wait_for_target(airodump)
Color.p('\r{+} running {C}%s{W} WEP attack ({G}%d IVs{W}) ' Color.pattack("WEP", airodump_target, "%s attack" % attack_name, "%d IVs" % airodump_target.ivs)
% (attack_name, airodump_target.ivs)) #Color.p('\r{+} running {C}%s{W} WEP attack ({G}%d IVs{W}) ' % (attack_name, airodump_target.ivs))
# Check if we cracked it. # Check if we cracked it.
if aircrack and aircrack.is_cracked(): if aircrack and aircrack.is_cracked():
@@ -219,8 +219,7 @@ class AttackWEP(Attack):
attacks_remaining = Configuration.wep_attacks[attack_index + 1:] attacks_remaining = Configuration.wep_attacks[attack_index + 1:]
Color.pl("{+} {G}%d{W} attacks remain ({C}%s{W})" % (len(attacks_remaining), ', '.join(attacks_remaining))) Color.pl("{+} {G}%d{W} attacks remain ({C}%s{W})" % (len(attacks_remaining), ', '.join(attacks_remaining)))
prompt = Color.s('{+} type {G}c{W} to {G}continue{W}' + prompt = Color.s('{+} type {G}c{W} to {G}continue{W} or {R}s{W} to {R}stop{W}: ')
' or {R}s{W} to {R}stop{W}: ')
if raw_input(prompt).lower().startswith('s'): if raw_input(prompt).lower().startswith('s'):
return False return False
else: else:

View File

@@ -62,6 +62,7 @@ class AttackWPS(Attack):
'-b', self.target.bssid, '-b', self.target.bssid,
'-c', self.target.channel, '-c', self.target.channel,
'-K', '1', # pixie-dust attack '-K', '1', # pixie-dust attack
'--session', '/dev/null', # Don't restart session
'-vv' # (very) verbose '-vv' # (very) verbose
] ]
@@ -126,7 +127,7 @@ class AttackWPS(Attack):
elif 'Detected AP rate limiting,' in stdout_last_line: elif 'Detected AP rate limiting,' in stdout_last_line:
if Configuration.wps_skip_rate_limit: if Configuration.wps_skip_rate_limit:
Color.pl('{R}failed: {O}hit WPS rate-limit{W}') Color.pl('{R}failed: {O}hit WPS rate-limit{W}')
Color.pl('{!} {O}use {R}--skip-rate-limit{O} to ignore' + Color.pl('{!} {O}use {R}--ignore-ratelimit{O} to ignore' +
' this kind of failure in the future{W}') ' this kind of failure in the future{W}')
break break
step = '({C}step -/8{W}) waiting for AP rate limit' step = '({C}step -/8{W}) waiting for AP rate limit'
@@ -184,7 +185,7 @@ class AttackWPS(Attack):
'-i', Configuration.interface, '-i', Configuration.interface,
'-b', self.target.bssid, '-b', self.target.bssid,
'-c', self.target.channel, '-c', self.target.channel,
'-a', # Automatically restart session '--session', '/dev/null', # Don't restart session
'-vv' # verbose '-vv' # verbose
] ]
reaver = Process(command, stdout=stdout_write, stderr=Process.devnull()) reaver = Process(command, stdout=stdout_write, stderr=Process.devnull())
@@ -273,7 +274,7 @@ class AttackWPS(Attack):
if Configuration.wps_skip_rate_limit: if Configuration.wps_skip_rate_limit:
Color.pl(state) Color.pl(state)
Color.pl('{!} {R}hit rate limit, stopping{W}\n') Color.pl('{!} {R}hit rate limit, stopping{W}\n')
Color.pl('{!} {O}use {R}--skip-rate-limit{O} to ignore' + Color.pl('{!} {O}use {R}--ignore-ratelimit{O} to ignore' +
' this kind of failure in the future{W}') ' this kind of failure in the future{W}')
break break

View File

@@ -21,7 +21,7 @@ class Color(object):
# Helper string replacements # Helper string replacements
replacements = { replacements = {
'{+}': ' {W}[{G}+{W}]', '{+}': ' {W}[{G}+{W}]',
'{!}': ' {W}[{R}!{W}]' '{!}': ' {O}[{R}!{O}]{W}'
} }
last_sameline_length = 0 last_sameline_length = 0
@@ -74,6 +74,17 @@ class Color(object):
sys.stdout.flush() sys.stdout.flush()
Color.last_sameline_length = 0 Color.last_sameline_length = 0
@staticmethod
def pattack(attack_type, target, attack_name, progress):
'''
Prints a one-liner for an attack
Includes attack type (WEP/WPA), target BSSID/ESSID & power, attack type, and progress
[name] ESSID (MAC @ Pwr) Attack_Type: Progress
e.g.: [WEP] Router2G (00:11:22 @ 23db) replay attack: 102 IVs
'''
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))
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")
print Color.s("{C}Testing{P}String{W}") print Color.s("{C}Testing{P}String{W}")

View File

@@ -90,7 +90,7 @@ class Interface(object):
output = Process(['ifconfig', iface]).stdout() output = Process(['ifconfig', iface]).stdout()
mac_regex = ('[a-zA-Z0-9]{2}-' * 6)[:-1] mac_regex = ('[a-zA-Z0-9]{2}-' * 6)[:-1]
match = re.search('HWaddr (%s)' % mac_regex, output) match = re.search(' (%s)' % mac_regex, output)
if not match: if not match:
raise Exception('Could not find the mac address for %s' % iface) raise Exception('Could not find the mac address for %s' % iface)
return match.groups()[0].replace('-', ':') return match.groups()[0].replace('-', ':')

View File

@@ -23,6 +23,7 @@ class Scanner(object):
self.targets = [] self.targets = []
self.target = None # Specific target (based on ESSID/BSSID) self.target = None # Specific target (based on ESSID/BSSID)
Color.pl("")
# Loads airodump with interface/channel/etc from Configuration # Loads airodump with interface/channel/etc from Configuration
with Airodump() as airodump: with Airodump() as airodump:
try: try:

View File

@@ -103,10 +103,12 @@ class Target(object):
power = Color.s('{%s}%s' % (color, power)) power = Color.s('{%s}%s' % (color, power))
wps = Color.s('{O} n/a') wps = Color.s('{O} n/a')
if self.wps: if self.wps == True:
wps = Color.s('{G} yes') wps = Color.s('{G} yes')
else: elif self.wps == False:
wps = Color.s('{R} no') wps = Color.s('{R} no')
else:
wps = Color.s('{O} n/a')
clients = ' ' clients = ' '
if len(self.clients) == 1: if len(self.clients) == 1:

View File

@@ -2,9 +2,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from Process import Process from Process import Process
import re
class Wash(object): class Wash(object):
''' Wrapper for Wash program. ''' ''' Wrapper for Wash program. '''
BSSID_REGEX = re.compile("([A-F0-9\:]{17})", re.IGNORECASE)
def __init__(self): def __init__(self):
pass pass
@@ -33,21 +35,18 @@ class Wash(object):
'-f', capfile # Path to cap file '-f', capfile # Path to cap file
] ]
p = Process(command) p = Process(command)
for line in p.stdout().split('\n'):
# Ignore irrelevant lines p.wait()
if line.strip() == '' or line.startswith('Scanning for'): if p.poll() != 0:
continue return
bssid = line.split(' ')[0]
bssids = [bssid.upper() for bssid in Wash.BSSID_REGEX.findall(p.stdout())]
for t in targets: for t in targets:
t.wps = t.bssid.upper() in bssids
if t.bssid.lower() == bssid.lower(): if t.bssid.lower() == bssid.lower():
# Update the WPS flag # Update the WPS flag
t.wps = True t.wps = True
# Mark other targets as "no" wps support
for t in targets:
if t.wps: continue
t.wps = False
if __name__ == '__main__': if __name__ == '__main__':
from Target import Target from Target import Target