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