Fix regex in get_connected_bssid to match MAC addresses case-insensitively and ensure consistent formatting.

This commit is contained in:
Yaro Kasear 2025-05-01 10:28:55 -05:00
parent 9665180077
commit 7d9e33e9ea

View file

@ -153,9 +153,9 @@ def reset_interface(interface):
def get_connected_bssid(interface):
try:
out = subprocess.check_output(["iw", interface, "link"]).decode()
match = re.search(r"Connected to ([0-9a-f:]{17})", out.lower())
match = re.search(r"Connected to ([0-9A-Fa-f:]{17})", out, re.MULTILINE)
if match:
return match.group(1)
return match.group(1).lower()
print("[!] No valid MAC address found in iw link output.")
return None
except Exception as e: