rewriting run_cmd a bit more to handle timout errors
This commit is contained in:
parent
dd649aa439
commit
2f09d2398b
@ -5,7 +5,11 @@ def run_cmd(cmd, out=subprocess.PIPE, timeout=None):
|
|||||||
# Just runs a command, supports changing the pipe n stuff
|
# Just runs a command, supports changing the pipe n stuff
|
||||||
|
|
||||||
proc = subprocess.Popen(cmd, stdout = out, stderr = subprocess.PIPE, shell=True)
|
proc = subprocess.Popen(cmd, stdout = out, stderr = subprocess.PIPE, shell=True)
|
||||||
|
|
||||||
|
try:
|
||||||
proc.wait(timeout=timeout)
|
proc.wait(timeout=timeout)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
return ("","",-1)
|
||||||
|
|
||||||
return (proc.stdout.read().decode(), proc.stderr.read().decode(), proc.returncode)
|
return (proc.stdout.read().decode(), proc.stderr.read().decode(), proc.returncode)
|
||||||
|
|
||||||
@ -44,10 +48,6 @@ class Sniffer:
|
|||||||
if code != 0:
|
if code != 0:
|
||||||
return code
|
return code
|
||||||
|
|
||||||
#time.sleep(timeout+.1) # Give a bit of time for airodump to write
|
|
||||||
|
|
||||||
#stdout, code = run_cmd(f"killall -i airodump-ng")
|
|
||||||
|
|
||||||
full_filepath = f"{dump_file}-01.csv"
|
full_filepath = f"{dump_file}-01.csv"
|
||||||
|
|
||||||
return self.parse_sniff(full_filepath)
|
return self.parse_sniff(full_filepath)
|
||||||
|
Loading…
Reference in New Issue
Block a user