简体   繁体   English

如何使用 Python 查找无线接口(例如 wlan0)的模式(Monitor 或 Managed)

[英]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.

相关问题 Scapy 将侦听 wlan0 但不会侦听设置为监视模式的 wlan1 - Scapy will listen on wlan0 but not wlan1 that is set to monitor mode 如何使 output 在 python 中排列(例如'12345')? - how to make output line up (Ex. '12345') in python? 如何在 Python 中打开和读取多个文件(例如 .txt) - How to open and read multiple files (ex. .txt) in Python 如何将 Python 中的字符串加倍。 “你好”到“HHeelllloo” - How to double the strings in Python ex. "Hello" to "HHeelllloo" Ubuntu + Python:wlan0上的HTTP客户端和eth0上的TCP服务器 - Ubuntu + Python: HTTP Client on wlan0 and TCP server on eth0 如何从 ip(例如 192.168.1.3)Linux Shell 或 python3 在本地找到设备主机名 - How can I find devices hostname in local area from ip (ex. 192.168.1.3) Linux Shell or python3 如何使用Python解析无限滚动页面(例如Wallbase.cc/search/sky)? - How do I parse through an infinite scrolling page (ex. Wallbase.cc/search/sky) with Python? 如何在没有Python中的replace()function的情况下替换字符串中句子中所有实例中的字母(例如ABC)? - How to replace letters (ex. ABC) in all instances in a sentence in a string without the replace() function in Python? 如何在python主题建模中以不同的顺序处理相同单词的双字母组? 防爆。 “租赁延期”和“延期租赁” - How to handle bigrams of same word in different sequence in topics modeling in python? Ex. 'lease extension' and 'extension lease' Python3-wifi库无法与Cell.all(“ wlan0”)一起运行 - Python3 - wifi library does not run with Cell.all(“wlan0”)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM