From 0abdf54f4300e30cc13477ba9a1285fcb143aee6 Mon Sep 17 00:00:00 2001 From: Sniffleupagus Date: Sun, 18 Jun 2023 20:04:26 -0700 Subject: [PATCH] changed channel detection to detect all channels. iwlist only returns the first 32 --- pwnagotchi/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pwnagotchi/utils.py b/pwnagotchi/utils.py index 29c36327..cbba5f63 100644 --- a/pwnagotchi/utils.py +++ b/pwnagotchi/utils.py @@ -304,11 +304,13 @@ def total_unique_handshakes(path): def iface_channels(ifname): channels = [] - output = subprocess.getoutput("/sbin/iwlist %s freq" % ifname) + + phy = subprocess.getoutput("/sbin/iw %s info | grep wiphy | cut -d ' ' -f 2" % ifname) + output = subprocess.getoutput("/sbin/iw phy%s channels | grep ' MHz' | sed 's/^.*\[//g' | sed s/\].*\$//g" % phy) for line in output.split("\n"): line = line.strip() - if line.startswith("Channel "): - channels.append(int(line.split()[1])) + channels.append(int(line)) + return channels