【问题标题】:Python scan for WiFiPython 扫描 WiFi
【发布时间】:2016-09-24 18:03:53
【问题描述】:

我正在寻找一个可以扫描 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】:

尝试pip install wifi然后用于扫描

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

这将返回 Cell 对象的列表。在后台,这会调用 iwlist scan 并解析不友好的输出。每个单元格对象应具有以下属性: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 库仅适用于 Linux 系统
  • @NikhilBaliga 那么我们其他人会怎么做呢?
  • 您可以创建一个引导驱动器并安装一种 linux 风格,否则您将不得不使用 pyobjc 库来弥补差距并尝试访问 ios 的机场pypi.org/project/pyobjc
  • 请注意这个库/项目不再由开发者维护:(
  • wifi 模块不支持Windows?
猜你喜欢
  • 1970-01-01
  • 2014-07-26
  • 2015-12-06
  • 1970-01-01
  • 1970-01-01
  • 2012-03-20
  • 2011-02-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多