Add channel change detection and update logic in main loop
This commit is contained in:
parent
d0d7dd473f
commit
e93addb4c0
1 changed files with 11 additions and 1 deletions
12
listener.py
12
listener.py
|
@ -109,7 +109,7 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
print("[!] Unable to determine the current channel. Exiting.")
|
print("[!] Unable to determine the current channel. Exiting.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, stop_sniff)
|
signal.signal(signal.SIGINT, stop_sniff)
|
||||||
print(f"[+] Listening on interface {LISTEN_INTERFACE} (press Ctrl+C to stop)")
|
print(f"[+] Listening on interface {LISTEN_INTERFACE} (press Ctrl+C to stop)")
|
||||||
|
|
||||||
|
@ -124,6 +124,16 @@ if __name__ == "__main__":
|
||||||
timeout=10
|
timeout=10
|
||||||
)
|
)
|
||||||
print_stats()
|
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:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue