Fix regex in get_connected_bssid to match MAC addresses case-insensitively and ensure consistent formatting.
This commit is contained in:
parent
9665180077
commit
7d9e33e9ea
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue