Enhance channel hopping by adding dynamic hop interval calculation based on observation duration

This commit is contained in:
Yaro Kasear 2025-05-06 09:04:53 -05:00
parent dcbd240bb5
commit 27d64d2bed
2 changed files with 20 additions and 6 deletions

View file

@ -35,7 +35,7 @@ unlinked_candidates = set()
bssid_channels = {}
vendor_cache = {}
CHANNEL_LIST = [1, 6, 11, 36, 40, 48, 52, 64, 153, 161] # Channels to hop
CHANNEL_LIST = [1, 6, 11, 36, 40, 48, 52, 64, 100, 104, 108, 112, 149, 153, 161] # Channels to hop
CHANNEL_HOP_INTERVAL = 5 # Seconds per channel
def get_channel_from_freq(freq):
@ -245,14 +245,14 @@ def print_suspect_aps():
else:
print(" None found (yet).")
def channel_hopper(interface):
def channel_hopper(interface, hop_interval):
global running
i = 0
while running:
channel = CHANNEL_LIST[i % len(CHANNEL_LIST)]
set_monitor_channel(interface, channel)
i += 1
time.sleep(CHANNEL_HOP_INTERVAL)
time.sleep(hop_interval)
def is_deadpoint(ap_bssid):
return sum(ap_clients[ap_bssid].values()) < 2 # No meaningful client interaction
@ -267,6 +267,7 @@ def main():
group = parser.add_mutually_exclusive_group()
group.add_argument("--channel", type=int, help="Channel to lock monitor interface to")
group.add_argument("--channel-hop", action="store_true", help="Enable channel hopping")
group.add_argument("--hop-interval", type=int, default=CHANNEL_HOP_INTERVAL, help="Interval for channel hopping (default: 5 seconds)")
args = parser.parse_args()
@ -300,7 +301,7 @@ def main():
print("[+] Sniffing... (waiting for SIGINT to stop)")
if args.channel_hop:
hopper_thread = threading.Thread(target=channel_hopper, args=(args.monitor_iface,))
hopper_thread = threading.Thread(target=channel_hopper, args=(args.monitor_iface,args.hop_interval))
hopper_thread.daemon = True
hopper_thread.start()