Compare commits
3 Commits
2f09d2398b
...
d001b5c825
Author | SHA1 | Date | |
---|---|---|---|
d001b5c825 | |||
37fdd01551 | |||
750100e988 |
@ -2,9 +2,10 @@
|
||||
import reporter, sniffer
|
||||
|
||||
def main():
|
||||
print(sniffer.run_cmd("echo 1"))
|
||||
snfr = sniffer.Sniffer("walfa0")
|
||||
print(snfr.sniff(5))
|
||||
#print(snfr.sniff(5))
|
||||
data = snfr.parse_sniff("/tmp/SUSTMP_hyMIo/cap-1666770829-01.csv")
|
||||
snfr.destroy_sniffs()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -14,9 +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
|
||||
@ -39,13 +36,12 @@ 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:
|
||||
if code != 0 and code != -1:
|
||||
return code
|
||||
|
||||
full_filepath = f"{dump_file}-01.csv"
|
||||
@ -56,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
|
||||
|
Loading…
Reference in New Issue
Block a user