Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I connect/disconnect/configure a wireless network in python?

I'm looking to see if there is a way to connect or disconnect to a wireless network in python, preferably a way that would work for both public and secured networks if I supplied the password. If I can configure the options about wireless, that would be an added bonus (ex. see all networks in range, see information about networks in range (like encryption type)). I run a windows computer, so I see many answers to this question in Linux, or other operating systems, but none in windows. Thanks in advance.

like image 576
Tom Avatar asked Aug 26 '12 00:08

Tom


People also ask

How do I disconnect from a wireless network?

Right-click the Network icon on the lower right corner of the screen (or click the Wi-Fi icon, select the network, and select disconnect). For more information, see Fix Wi-Fi connection issues in Windows.


1 Answers

You'll probably have to use one of the DLLs in windows for that. Using ctypes you can get access to the win32 API from Python.

It looks like the functions from wlanapi.dll, starting with WlanOpenHandle and WlanEnumInterfaces might do what you want.

Edit: For example code, see the accepted answer to this.

like image 156
Roland Smith Avatar answered Sep 20 '22 01:09

Roland Smith