[英]How to find the mode (Monitor or Managed) of a wireless interface (ex. wlan0) using Python
No idea where to even start here.不知道从哪里开始。 Any ideas?
有任何想法吗? I'd like to do this only using python if possible.
如果可能的话,我想只使用 python 来做到这一点。 Could not find any other threads that answered this in the slightest.
找不到任何其他线程来回答这个问题。
Python generally doesn't really have access to low-level hardware devices. Python 通常无法真正访问低级硬件设备。 You might find 3rd party package that can get you what you want, but you're probably better off capturing the output of a command line utility via subprocess and parsing the output.
您可能会发现 3rd 方软件包可以满足您的需求,但最好通过子进程捕获命令行实用程序的输出并解析输出。
This example output of iwconfig
would be pretty straightforward to parse: iwconfig
这个示例输出很容易解析:
wlan0 IEEE 802.11g ESSID:"NETGEAR"
Mode:Managed Frequency:2.462 GHz Access Point: 00:0F:B5:CE:E3:2A
Tx-Power=27 dBm
Retry min limit:7 RTS thr:off Fragment thr=2346 B
Encryption key:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Note: the output format/content will likely vary based on your adapter and driver注意:输出格式/内容可能会因您的适配器和驱动程序而异
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.