Compare commits

...

2 Commits

2 changed files with 8 additions and 8 deletions

View File

@ -1,10 +1,10 @@
#! /usr/bin/python #! /usr/bin/python
import packet_processer, reporter, sniffer import reporter, sniffer
def main(): def main():
print(sniffer.run_cmd("echo 1")) print(sniffer.run_cmd("echo 1"))
snfr = Sniffer("walfa0") snfr = sniffer.Sniffer("walfa0")
print(snfr.sniff(1)) print(snfr.sniff(5))
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -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)