This example will show you how to find all users connected to wifi network using Python 3. Sometimes just for fun we may want to know who all are connected to the same wifi network. We can also use the command netsh wlan show network in cmd window under Windows Operating System to find out who all users are currently online in the wifi network.
Here we will find all users connected to wifi network using Python programming language.
Have Python installed in Windows (or Unix)
Pyhton version and Packages
Here I am using Python 3.6.6 version
Example with Source Code
We have used command netsh wlan show network in our Python script to retrieve all online users information. The information will show you as SSID and username of all currently online users. The SSID is the name of the wifi or wireless network. It is a unique 32 alphanumeric characters for each user.
Netsh is a command-line scripting utility that allows you to display or modify the network configuration of a computer that is currently running.
WLAN commands that allow you to access the Wi-Fi profiles.
Network the unique name of wireless network.
Then we basically split, extract and format to print the wifi network name (SSID) and user name of the wifi network for currently online users.
import subprocess results = subprocess.check_output(["netsh", "wlan", "show", "network"]) results = results.decode("ascii") results = results.replace("\r","") ls = results.split("\n") ls = ls[4:] ssids =  x = 0 while x < len(ls): if x % 5 == 0: ssids.append(ls[x]) x += 1 print(ssids)
Testing the Program
When you run the above Python script then you will be able to see the below output in the console:
That’s all. Hope you got idea how to find all users connected to wifi network using Python 3.
You can download source code.
Thanks for reading.
2 thoughts on “Find all users connected to wifi network using Python 3”
Your computer needs to be the one broadcasting the WiFi for you to get that kind of data, otherwise you’ll just get the profiles available in your LAN
I guess it is not for that purpose .