In this article we will see how we can all those wifi network on which the system is ever connected to. Wi-Fi is a wireless networking technology that allows devices such as computers (laptops and desktops), mobile devices (smart phones and wearables), and other equipment (printers and video cameras) to interface with the Internet.
In order to do this we will use the
subprocess module. The subprocess module present in Python(both 2.x and 3.x) is used to run new applications or programs through Python code by creating new processes. It also helps to obtain the input/output/error pipes as well as the exit codes of various commands.
In order to get the information about the wifi devices system is connected to we will use the command given below
subprocess.check_output(['netsh', 'wlan', 'show', 'profiles'])
This command will return the meta data in bytes format in order to get the names of network we have to decode and filter it to get the desired output.
Below is the implementation
All wifi that system has connected to are ----------------------------------------- Engineer_5GHz Engineer honor Redmi Ayush BiGX-cmtqaGFtYjc UERJTTBV8e0GUmVkbWkg 2 DESKTOP-F32H70N 5009 UERJTTBV8e0GUmVkbWkg Bunns Hogwarts Cgc wireless Moto G (5) Plus 8691 AndroidAP AndroidAPab7e roshan Svj? Hey AndroidAP202 JARVIS B6NO-wq5hamF0IGt1bWHCrg CDAC
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.