From 10c81feb9c4afd26c3289ec28a6945649a7d3e8b Mon Sep 17 00:00:00 2001 From: derv82 Date: Mon, 1 Jun 2015 02:55:31 -0700 Subject: [PATCH] Root script 'Wifite.py' brings it all together Now displays when deauthing during WPA attack --- .gitignore | 2 ++ Wifite.py | 37 +++++++++++++++++++++++++++++++++++++ py/AttackWEP.py | 1 + py/AttackWPA.py | 9 ++++++--- py/Scanner.py | 4 ++-- 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 Wifite.py diff --git a/.gitignore b/.gitignore index b948985..a46bfc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.swp *.pyc +py/hs/ +*.bak diff --git a/Wifite.py b/Wifite.py new file mode 100644 index 0000000..090887a --- /dev/null +++ b/Wifite.py @@ -0,0 +1,37 @@ +#!/usr/bin/python + +from py.Scanner import Scanner +from py.Color import Color +from py.AttackWEP import AttackWEP +from py.AttackWPA import AttackWPA + +class Wifite(object): + def __init__(self): + pass + + def run(self): + s = Scanner() + targets = s.select_targets() + for t in targets: + Color.pl('{+} starting attacks against {C}%s{W} ({C}%s{W})' + % (t.bssid, t.essid)) + # TODO: Check if Configuration says to attack certain encryptions. + if 'WEP' in t.encryption: + attack = AttackWEP(t) + elif 'WPA' in t.encryption: + # TODO: Check if WPS, attack WPS + attack = AttackWPA(t) + attack.run() + pass + +if __name__ == '__main__': + w = Wifite() + try: + w.run() + except Exception, e: + Color.pl('\n{!} {R}Error:{O} %s{W}' % str(e)) + #from traceback import format_exc + #format_exc().replace('\n', '\n ') + except KeyboardInterrupt: + Color.pl('\n{!} {O}interrupted{W}') + diff --git a/py/AttackWEP.py b/py/AttackWEP.py index 32592e2..1cd8fa9 100644 --- a/py/AttackWEP.py +++ b/py/AttackWEP.py @@ -33,6 +33,7 @@ class AttackWEP(Attack): ivs_only=True, # Only capture IVs packets output_file_prefix='wep') as airodump: + Color.clear_line() Color.p('\r{+} {O}waiting{W} for target to appear...') airodump_target = self.wait_for_target(airodump) diff --git a/py/AttackWPA.py b/py/AttackWPA.py index c194a49..674225c 100644 --- a/py/AttackWPA.py +++ b/py/AttackWPA.py @@ -27,6 +27,7 @@ class AttackWPA(Attack): target_bssid=self.target.bssid, output_file_prefix='wpa') as airodump: + Color.clear_line() Color.p('\r{+} {O}waiting{W} for target to appear...') airodump_target = self.wait_for_target(airodump) @@ -40,9 +41,9 @@ class AttackWPA(Attack): deauth_proc = None while True: + time.sleep(1) Color.clear_line() Color.p('\r{+} waiting for {C}handshake{W}...') - time.sleep(1) # Find .cap file cap_files = airodump.find_files(endswith='.cap') @@ -75,11 +76,9 @@ class AttackWPA(Attack): # We are N seconds since last deauth was sent, # And the deauth process is not running. if len(clients) == 0 or client_index >= len(clients): - # TODO: Send deauth for broadcast deauth_proc = self.deauth(airodump_target.bssid) client_index = 0 else: - # TODO: Send deauth for client client = clients[client_index] deauth_proc = self.deauth(client.bssid) client_index += 1 @@ -183,6 +182,9 @@ class AttackWPA(Attack): Deauths 'broadcast' if no client is specified. ''' # TODO: Print that we are deauthing and who we are deauthing! + target_name = station_bssid + if target_name == None: + target_name = 'broadcast' command = [ 'aireplay-ng', '--ignore-negative-one', @@ -193,6 +195,7 @@ class AttackWPA(Attack): # Deauthing a specific client command.extend(['-h', station_bssid]) command.append(Configuration.interface) + Color.p(' {C}sending deauth{W} to {C}%s{W}' % target_name) return Process(command) if __name__ == '__main__': diff --git a/py/Scanner.py b/py/Scanner.py index ddd37c1..f026ea3 100644 --- a/py/Scanner.py +++ b/py/Scanner.py @@ -39,7 +39,7 @@ class Scanner(object): [len(t.clients) for t in self.targets]) Color.p( - "\r{+} Scanning, " + + "\r{+} scanning, " + "found {G}%d{W} target(s)," % target_count + " {G}%d{W} clients" % client_count + ". {O}Ctrl+C{W} when ready") @@ -102,7 +102,7 @@ class Scanner(object): + " or you may have issues with your wifi card") self.print_targets() - input_str = '{+} Select target(s)' + input_str = '{+} select target(s)' input_str += ' ({G}1-%d{W})' % len(self.targets) input_str += ' separated by commas, dashes' input_str += ' or {G}all{W}: '