Open abidmaria opened 1 year ago
I have done small correction on David Bombal's script ( to fetch all the adapters [ if they available] not only the first adapter e.g wlan0 ) below is the correction :
pattern = r'^wlan[0-9]+' check_wifi_result = subprocess.run(["iwconfig"], capture_output=True).stdout.decode()
wifi_adapters = re.findall(pattern,check_wifi_result,re.MULTILINE)
if len(wifi_adapters) == 0: print("Please connect a WiFi adapter and try again.") exit()
print("The following WiFi interfaces are available:") for index, item in enumerate(wifi_adapters): print(f"{index} - {item}")
I have done small correction on David Bombal's script ( to fetch all the adapters [ if they available] not only the first adapter e.g wlan0 ) below is the correction :
pattern = r'^wlan[0-9]+' check_wifi_result = subprocess.run(["iwconfig"], capture_output=True).stdout.decode()
wifi_adapters = re.findall(pattern,check_wifi_result,re.MULTILINE)
if len(wifi_adapters) == 0: print("Please connect a WiFi adapter and try again.") exit()
print("The following WiFi interfaces are available:") for index, item in enumerate(wifi_adapters): print(f"{index} - {item}")