Python 扫描 WiFi

标签 python wifi python-3.5 scapy sniffer

我正在寻找一个可以扫描 WiFi 网络并打印所有 SSID 的程序。我试过 scapy 但我失败了。我正在使用 pyCharm 编辑器。

我试过这段代码:

from scapy.all import *
from scapy.layers.dot11 import Dot11

def packet_handler(pkt):        
    if pkt.haslayer(Dot11) and pkt.type == 2:        
        print(pkt.show())
scapy.sniff(iface="mon0", prn=packet_handler)

最佳答案

试试pip install wifi然后扫描使用

from wifi import Cell, Scheme
Cell.all('wlan0')

这将返回一个 Cell 对象列表。在幕后,这会调用 iwlist 扫描并解析不友好的输出。每个单元格对象应具有以下属性:ssid、信号、质量等。 和连接使用

cell = Cell.all('wlan0')[0]
scheme = Scheme.for_cell('wlan0', 'home', cell, passkey)
scheme.save()
scheme.activate()

scheme = Scheme.find('wlan0', 'home')
scheme.activate()

有关更多信息,请转到 https://wifi.readthedocs.io/en/latest/

关于Python 扫描 WiFi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39679421/

相关文章:

python - 具有多种方法的基于类的 View 如何与 django 中的 url 一起使用?

python-3.5 - OSError : broken data stream when reading image file

Python3 写入 gzip 文件 - 内存 View : a bytes-like object is required, 不是 'str'

iphone - 是否可以通过编程方式在 iPhone 中启用热点模式?

node.js - 公共(public) WiFi 热点中使用的 Node JS 互联网网关/强制门户

python - uWSGI 使用 Python 2.7 而不是 3.5,这会导致相应的错误

python - 组合/合并排序的 pandas 数据框中的时间间隔行

python - 我是否需要迁移以将数据库链接到 Django

python - 这是使用 API 在 Python 中为 Braintree 创建订阅的正确方法吗

android - 设置 headless 设备以连接到 wifi 网络