Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List All Wireless Networks Python for PC

I am trying to find out how I can list all of the available wireless networks in Python. I am using Windows 8.1.

Is there a built-in function I can call, or through a library?

Please kindly show me the code which prints the list.

like image 358
Code Avatar asked Aug 07 '15 01:08

Code


People also ask

How can I see all Wi-Fi connections?

Start by going to Settings > Network & Internet > Wi-Fi, where you can find and click the Manage Known Networks link to see your list of saved wireless networks.

How do I find wireless networks on my PC?

After your Surface restarts, sign in to Windows. Go to Start, and select Settings > Network & internet > Wi-Fi > Show available networks, and see whether your wireless network name appears in the list of available networks. If you see your wireless network name, select it and select Connect.

How do you check which devices are connected to my Wi-Fi using Python?

Who-is-on-my-wifi is a Python3 cli project that allows you to see who is stealing your WiFI network, scan your WiFI and show you how many devices are connected. Software can be installed on any Windows and Linux device (Mac not verified).

How can I see all Wi-Fi networks using CMD?

At the command prompt, type netsh wlan show wlanreport. This will generate a wireless network report that's saved as an HTML file, which you can open in your favorite web browser. The report shows all the Wi-Fi events from the last three days and groups them by Wi-Fi connection sessions.


1 Answers

This is a question from the olden days, but even at the time the accepted answer could have been much more Pythonic - e.g.,

r = subprocess.run(["netsh", "wlan", "show", "network"], capture_output=True, text=True).stdout
ls = r.split("\n")
ssids = [k for k in ls if 'SSID' in k]

If you just want to SSID names in a list, change the ssids = line to

ssids = [v.strip() for k,v in (p.split(':') for p in ls if 'SSID' in p)]
like image 165
GT. Avatar answered Oct 11 '22 15:10

GT.