diff --git a/src/sniffer.py b/src/sniffer.py index 5012596..7afb153 100644 --- a/src/sniffer.py +++ b/src/sniffer.py @@ -14,7 +14,6 @@ def run_cmd(cmd, out=subprocess.PIPE, timeout=None): return (proc.stdout.read().decode(), proc.stderr.read().decode(), proc.returncode) - class Sniffer: def __init__(self, interface_name): self.ifname = interface_name @@ -37,7 +36,6 @@ class Sniffer: stdout, stderr, code = run_cmd( f"mkdir -p {base_dir}" ) return code == 0 - def sniff(self, timeout): timeout = int(timeout+0.5) dump_file = f"{self.base_dir}/cap-{ int(time.time()) }" @@ -54,4 +52,6 @@ class Sniffer: with open(full_filepath,'r') as file: return csv.DictReader(file) - + def destroy_sniffs(self): + stdout, stderr, code = run_cmd( f"rm -rf {self.base_dir}" ) + return code == 0