Code cleanup
This commit is contained in:
@@ -31,9 +31,9 @@ class Color(object):
|
||||
@staticmethod
|
||||
def p(text):
|
||||
'''
|
||||
Prints text using colored format on same line.
|
||||
Example:
|
||||
Color.p("{R}This text is red. {W} This text is white")
|
||||
Prints text using colored format on same line.
|
||||
Example:
|
||||
Color.p("{R}This text is red. {W} This text is white")
|
||||
'''
|
||||
sys.stdout.write(Color.s(text))
|
||||
sys.stdout.flush()
|
||||
@@ -45,17 +45,13 @@ class Color(object):
|
||||
|
||||
@staticmethod
|
||||
def pl(text):
|
||||
'''
|
||||
Prints text using colored format with trailing new line.
|
||||
'''
|
||||
'''Prints text using colored format with trailing new line.'''
|
||||
Color.p('%s\n' % text)
|
||||
Color.last_sameline_length = 0
|
||||
|
||||
@staticmethod
|
||||
def pe(text):
|
||||
'''
|
||||
Prints text using colored format with leading and trailing new line to STDERR.
|
||||
'''
|
||||
'''Prints text using colored format with leading and trailing new line to STDERR.'''
|
||||
sys.stderr.write(Color.s('%s\n' % text))
|
||||
Color.last_sameline_length = 0
|
||||
|
||||
@@ -85,14 +81,14 @@ class Color(object):
|
||||
@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
|
||||
Prints a one-liner for an attack.
|
||||
Includes attack type (WEP/WPA), target ESSID & power, attack type, and progress.
|
||||
ESSID (Pwr) Attack_Type: Progress
|
||||
e.g.: Router2G (23db) WEP 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 " % (
|
||||
essid, target.bssid, target.power, attack_type, attack_name, progress))
|
||||
Color.p("\r{+} {G}%s{W} ({C}%sdb{W}) {G}%s {C}%s{W}: %s " % (
|
||||
essid, target.power, attack_type, attack_name, progress))
|
||||
|
||||
if __name__ == '__main__':
|
||||
Color.pl("{R}Testing{G}One{C}Two{P}Three{W}Done")
|
||||
|
||||
Reference in New Issue
Block a user