Python扫描WiFi

问题描述 投票:3回答:1

我正在搜索可以扫描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)
python wifi python-3.5 scapy sniffer
1个回答
5
投票

尝试pip install wifi然后扫描使用

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

这将返回Cell对象的列表。在引擎盖下,这称为iwlist扫描并解析不友好的输出。每个单元对象应具有以下属性:ssid,signal,quality等。并用于连接使用

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

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

了解更多信息goto https://wifi.readthedocs.io/en/latest/

© www.soinside.com 2019 - 2024. All rights reserved.