diff --git a/py/Aircrack.py b/py/Aircrack.py index f4b78c8..751b128 100644 --- a/py/Aircrack.py +++ b/py/Aircrack.py @@ -26,14 +26,14 @@ class Aircrack(object): def is_running(self): - return self.pid.poll() == None + return self.pid.poll() is None def is_cracked(self): return os.path.exists(self.cracked_file) def stop(self): ''' Stops aircrack process ''' - if self.pid.poll() == None: + if self.pid.poll() is None: self.pid.interrupt() def get_key_hex_ascii(self): @@ -56,7 +56,7 @@ class Aircrack(object): # Hex key is non-printable in ascii ascii_key = None continue - elif ascii_key == None: + elif ascii_key is None: # We can't generate an Ascii key continue # Convert decimal to char diff --git a/py/Aireplay.py b/py/Aireplay.py index 7ad8d2f..3d58fc8 100644 --- a/py/Aireplay.py +++ b/py/Aireplay.py @@ -81,11 +81,11 @@ class Aireplay(Thread): self.start() def is_running(self): - return self.pid.poll() == None + return self.pid.poll() is None def stop(self): ''' Stops aireplay process ''' - if hasattr(self, "pid") and self.pid and self.pid.poll() == None: + if hasattr(self, "pid") and self.pid and self.pid.poll() is None: self.pid.interrupt() def get_output(self): @@ -182,7 +182,7 @@ class Aireplay(Thread): # Interface is required at this point Configuration.initialize() - if Configuration.interface == None: + if Configuration.interface is None: raise Exception("Wireless interface must be defined (-i)") cmd = ["aireplay-ng"] @@ -259,7 +259,7 @@ class Aireplay(Thread): cmd.extend(["-h", client_mac]) elif attack_type == WEPAttackType.hirte: - if client_mac == None: + if client_mac is None: # Unable to carry out hirte attack raise Exception("Client is required for hirte attack") cmd.extend([ @@ -267,7 +267,7 @@ class Aireplay(Thread): "-h", client_mac ]) elif attack_type == WEPAttackType.forgedreplay: - if client_mac == None or replay_file == None: + if client_mac is None or replay_file is None: raise Exception("Client_mac and Replay_File are required for arp replay") cmd.extend([ "--arpreplay", diff --git a/py/Airmon.py b/py/Airmon.py index e9f211e..0e209f7 100644 --- a/py/Airmon.py +++ b/py/Airmon.py @@ -89,7 +89,7 @@ class Airmon(object): mon_iface = mon_iface.split(')')[0] break - if mon_iface == None: + if mon_iface is None: # Airmon did not enable monitor mode on an interface Color.pl("{R}failed{W}") diff --git a/py/Airodump.py b/py/Airodump.py index 3860c25..c42eef4 100644 --- a/py/Airodump.py +++ b/py/Airodump.py @@ -21,15 +21,15 @@ class Airodump(object): Configuration.initialize() - if interface == None: + if interface is None: interface = Configuration.interface - if interface == None: + if interface is None: raise Exception("Wireless interface must be defined (-i)") self.interface = interface self.targets = [] - if channel == None: + if channel is None: channel = Configuration.target_channel self.channel = channel self.five_ghz = Configuration.five_ghz @@ -133,7 +133,7 @@ class Airodump(object): # Found the file csv_filename = fil break - if csv_filename == None or not os.path.exists(csv_filename): + if csv_filename is None or not os.path.exists(csv_filename): # No file found return self.targets diff --git a/py/Attack.py b/py/Attack.py index c18aa16..9e0cc2e 100644 --- a/py/Attack.py +++ b/py/Attack.py @@ -39,7 +39,7 @@ class Attack(object): airodump_target = t break - if airodump_target == None: + if airodump_target is None: raise Exception( 'Could not find target (%s) in airodump' % self.target.bssid) diff --git a/py/Bully.py b/py/Bully.py index dc343fe..c860b7e 100644 --- a/py/Bully.py +++ b/py/Bully.py @@ -206,7 +206,7 @@ class Bully(Attack): return False def stop(self): - if hasattr(self, "pid") and self.pid and self.pid.poll() == None: + if hasattr(self, "pid") and self.pid and self.pid.poll() is None: self.pid.interrupt() def __del__(self): diff --git a/py/Configuration.py b/py/Configuration.py index 2f47abc..c62abc7 100644 --- a/py/Configuration.py +++ b/py/Configuration.py @@ -100,7 +100,7 @@ class Configuration(object): @staticmethod def get_interface(): - if Configuration.interface == None: + if Configuration.interface is None: # Interface wasn't defined, select it! from Airmon import Airmon Configuration.interface = Airmon.ask() @@ -273,7 +273,7 @@ class Configuration(object): @staticmethod def temp(subfile=''): ''' Creates and/or returns the temporary directory ''' - if Configuration.temp_dir == None: + if Configuration.temp_dir is None: Configuration.temp_dir = Configuration.create_temp() return Configuration.temp_dir + subfile @@ -289,7 +289,7 @@ class Configuration(object): @staticmethod def delete_temp(): ''' Remove temp files and folder ''' - if Configuration.temp_dir == None: return + if Configuration.temp_dir is None: return if os.path.exists(Configuration.temp_dir): for f in os.listdir(Configuration.temp_dir): os.remove(Configuration.temp_dir + f) @@ -323,7 +323,7 @@ class Configuration(object): for (key,val) in sorted(Configuration.__dict__.iteritems()): if key.startswith('__'): continue if type(val) == staticmethod: continue - if val == None: continue + if val is None: continue result += Color.s("{G}%s {W} {C}%s{W}\n" % (key.ljust(max_len),val)) return result diff --git a/py/Handshake.py b/py/Handshake.py index 0e27d83..78ce6a6 100644 --- a/py/Handshake.py +++ b/py/Handshake.py @@ -100,7 +100,7 @@ class Handshake(object): mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1] match = re.search('(%s) [^ ]* (%s).*.*SSID=(.*)$' % (mac_regex, mac_regex), line) - if match == None: + if match is None: # Line doesn't contain src, dst, ssid continue (src, dst, essid) = match.groups() @@ -139,7 +139,7 @@ class Handshake(object): mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1] match = re.search('(%s) (?:->|→) (%s).*Message.*(\d).*(\d)' % (mac_regex, mac_regex), line) - if match == None: + if match is None: # Line doesn't contain src, dst, Message numbers continue (src, dst, index, ttl) = match.groups() diff --git a/py/Interface.py b/py/Interface.py index 61c2725..b08b89a 100644 --- a/py/Interface.py +++ b/py/Interface.py @@ -82,10 +82,10 @@ class Interface(object): from Process import Process import re - if iface == None: + if iface is None: Configuration.initialize() iface = Configuration.interface - if iface == None: + if iface is None: raise Exception('Interface must be defined (-i)') output = Process(['ifconfig', iface]).stdout() diff --git a/py/Process.py b/py/Process.py index 503e0bd..d220826 100644 --- a/py/Process.py +++ b/py/Process.py @@ -85,7 +85,7 @@ class Process(object): Ran when object is GC'd. If process is still running at this point, it should die. ''' - if self.pid and self.pid.poll() == None: + if self.pid and self.pid.poll() is None: self.interrupt() def stdout(self): @@ -110,9 +110,9 @@ class Process(object): def get_output(self): ''' Waits for process to finish, sets stdout & stderr ''' - if self.pid.poll() == None: + if self.pid.poll() is None: self.pid.wait() - if self.out == None: + if self.out is None: (self.out, self.err) = self.pid.communicate() def poll(self): @@ -139,7 +139,7 @@ class Process(object): kill(pid, SIGINT) wait_time = 0 # Time since Interrupt was sent - while self.pid.poll() == None: + while self.pid.poll() is None: # Process is still running wait_time += 0.1 sleep(0.1) diff --git a/py/Reaver.py b/py/Reaver.py index 8cbb982..f73f560 100644 --- a/py/Reaver.py +++ b/py/Reaver.py @@ -96,7 +96,7 @@ class Reaver(Attack): (pin, psk, ssid) = self.get_pin_psk_ssid(stdout) # Check if we cracked it, or if process stopped. - if (pin and psk and ssid) or reaver.poll() != None: + if (pin and psk and ssid) or reaver.poll() is not None: reaver.interrupt() # Check one-last-time for PIN/PSK/SSID, in case of race condition. @@ -321,7 +321,7 @@ class Reaver(Attack): pin_current = 11000 - pins_left # Check if process is still running - if reaver.pid.poll() != None: + if reaver.pid.poll() is not None: Color.pl('{R}failed{W}') Color.pl('{!} {R}reaver{O} quit unexpectedly{W}') self.success = False diff --git a/py/Scanner.py b/py/Scanner.py index f24492a..288c9a6 100644 --- a/py/Scanner.py +++ b/py/Scanner.py @@ -30,7 +30,7 @@ class Scanner(object): # Loop until interrupted (Ctrl+C) while True: - if airodump.pid.poll() != None: + if airodump.pid.poll() is not None: # Airodump process died! raise Exception( "Airodump exited unexpectedly! " + @@ -76,7 +76,7 @@ class Scanner(object): bssid = Configuration.target_bssid essid = Configuration.target_essid - if bssid == None and essid == None: + if bssid is None and essid is None: return False for target in self.targets: