Compare commits

..

No commits in common. "d001b5c8252bf8cec87af452671e3a455a197948" and "2f09d2398bb351a8d92f179de3a4d9dca62a4c01" have entirely different histories.

2 changed files with 8 additions and 7 deletions

View File

@ -2,10 +2,9 @@
import reporter, sniffer
def main():
print(sniffer.run_cmd("echo 1"))
snfr = sniffer.Sniffer("walfa0")
#print(snfr.sniff(5))
data = snfr.parse_sniff("/tmp/SUSTMP_hyMIo/cap-1666770829-01.csv")
snfr.destroy_sniffs()
print(snfr.sniff(5))
if __name__ == "__main__":
main()

View File

@ -14,6 +14,9 @@ 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
@ -36,12 +39,13 @@ 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()) }"
stdout, stderr, code = run_cmd(f"airodump-ng --write {dump_file} --write-interval 1 --output-format csv walfa0", timeout=timeout)
if code != 0 and code != -1:
if code != 0:
return code
full_filepath = f"{dump_file}-01.csv"
@ -52,6 +56,4 @@ 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