如何在 python 中连接/断开/配置无线网络? [英] How do I connect/disconnect/configure a wireless network in python?

查看:57
本文介绍了如何在 python 中连接/断开/配置无线网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看看是否有办法在 python 中连接或断开无线网络,如果我提供密码,最好是一种对公共网络和安全网络都适用的方法.如果我可以配置有关无线的选项,那将是一个额外的好处(例如,查看范围内的所有网络,查看有关范围内网络的信息(如加密类型)).我运行的是 Windows 计算机,所以我在 Linux 或其他操作系统中看到了这个问题的很多答案,但在 Windows 中没有.提前致谢.

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.

推荐答案

为此,您可能必须使用 Windows 中的 DLL 之一.使用 ctypes,您可以从 Python 访问 win32 API.

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.

它看起来像 wlanapi.dll 中的函数,从 WlanOpenHandleWlanEnumInterfaces 可能会做你想做的事.

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

例如代码,请参阅这个.

这篇关于如何在 python 中连接/断开/配置无线网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆