From e93addb4c04165db925086aba2550dcd34f89c87 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Wed, 30 Apr 2025 15:18:48 -0500 Subject: [PATCH] Add channel change detection and update logic in main loop --- listener.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/listener.py b/listener.py index 5a2f3c8..13cc49d 100755 --- a/listener.py +++ b/listener.py @@ -109,7 +109,7 @@ if __name__ == "__main__": else: print("[!] Unable to determine the current channel. Exiting.") exit(1) - + signal.signal(signal.SIGINT, stop_sniff) print(f"[+] Listening on interface {LISTEN_INTERFACE} (press Ctrl+C to stop)") @@ -124,6 +124,16 @@ if __name__ == "__main__": timeout=10 ) print_stats() + + # Check channel every 3 loops (~30 seconds) + channel_check_counter += 1 + if channel_check_counter >= 3: + channel_check_counter = 0 + new_channel = get_current_channel(test_interface) + if new_channel and new_channel != last_channel: + print(f"[~] Detected channel change: {last_channel} → {new_channel}") + set_monitor_channel(monitor_interface, new_channel) + last_channel = new_channel except KeyboardInterrupt: pass