From 2b328b73687a9a2b5b57dbdc7fba9fcc6cef0893 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Wed, 30 Apr 2025 13:58:09 -0500 Subject: [PATCH] Refactor packet sniffing to run in a loop with a longer timeout for improved performance --- listener.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/listener.py b/listener.py index fcf0d39..1376e85 100644 --- a/listener.py +++ b/listener.py @@ -67,17 +67,16 @@ if __name__ == "__main__": print(f"[+] Listening on interface {INTERFACE} (press Ctrl+C to stop)") # Start sniffing in a background thread - sniff_thread = sniff( - iface=INTERFACE, - prn=handle_packet, - store=False, - monitor=True, - timeout=1 - ) - try: while running: + sniff( + iface=INTERFACE, + prn=handle_packet, + store=False, + monitor=True, + timeout=10 + ) print_stats() - time.sleep(10) except KeyboardInterrupt: pass +