Try to combine some if statements

This commit is contained in:
deix
2017-08-28 19:13:04 +02:00
parent 101332316a
commit 383d09ff29
3 changed files with 7 additions and 11 deletions

View File

@@ -44,9 +44,8 @@ class Airmon(object):
p = Process('airmon-ng') p = Process('airmon-ng')
for line in p.stdout().split('\n'): for line in p.stdout().split('\n'):
# Ignore blank/header lines # Ignore blank/header lines
if len(line) == 0: continue if len(line) == 0 or line.startswith('Interface') or line.startswith('PHY'):
if line.startswith('Interface'): continue continue
if line.startswith('PHY'): continue
# Strip out interface information # Strip out interface information
fields = line.split("\t") fields = line.split("\t")
@@ -242,8 +241,8 @@ class Airmon(object):
if re.search('^ *PID', line): if re.search('^ *PID', line):
hit_pids = True hit_pids = True
continue continue
if not hit_pids: continue if not hit_pids or line.strip() == '':
if line.strip() == '': continue continue
match = re.search('^[ \t]*(\d+)[ \t]*([a-zA-Z0-9_\-]+)[ \t]*$', line) match = re.search('^[ \t]*(\d+)[ \t]*([a-zA-Z0-9_\-]+)[ \t]*$', line)
if match: if match:
# Found process to kill # Found process to kill

View File

@@ -120,9 +120,7 @@ class Airodump(object):
# Remove .cap and .xor files from pwd # Remove .cap and .xor files from pwd
for fil in os.listdir('.'): for fil in os.listdir('.'):
if fil.startswith('replay_') and fil.endswith('.cap'): if fil.startswith('replay_') and fil.endswith('.cap') or fil.endswith('.xor'):
os.remove(fil)
if fil.endswith('.xor'):
os.remove(fil) os.remove(fil)
def get_targets(self, apply_filter=True): def get_targets(self, apply_filter=True):

View File

@@ -321,9 +321,8 @@ class Configuration(object):
result += Color.s('{W}%s------------------{W}\n' % ('-' * max_len)) result += Color.s('{W}%s------------------{W}\n' % ('-' * max_len))
for (key,val) in sorted(Configuration.__dict__.iteritems()): for (key,val) in sorted(Configuration.__dict__.iteritems()):
if key.startswith('__'): continue if key.startswith('__') or type(val) == staticmethod or val is None:
if type(val) == staticmethod: continue continue
if val is None: continue
result += Color.s("{G}%s {W} {C}%s{W}\n" % (key.ljust(max_len),val)) result += Color.s("{G}%s {W} {C}%s{W}\n" % (key.ljust(max_len),val))
return result return result