added destroy_sniffs, which will destroy the base_dir folder along with all the data in it

This commit is contained in:
Michael Scalzetti 2022-10-26 04:13:07 -04:00
parent 750100e988
commit 37fdd01551

View File

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