我最近正致力于基于计算存在多少个Wi-Fi设备的流量监控项目。我想获得可用的AP SSID列表以及连接到该AP的所有客户端设备。基本上,我想获得如下信息列表:
Network-Name BSSID RSSI
Client-Mac1 RSSI
Client-Mac2 RSSI
Client-Mac3 RSSI
Orphan Clients:
Client-Mac4 RSSI
我希望通过使用带有使用python的Wi-Fi适配器的覆盆子pi来完成。如果那是不可能的,我有一个ESP 8266,可以将它链接到Linux机器/ Arduino。
请发布您的想法,了解如何使用何种类型的平台/库实现此功能。如果您可以包含一些代码示例,那将是最好的!
答案 0 :(得分:1)
复制自esp8266示例 - ESP8266Wifi - WifiScan: 然后,您可以使用串行连接将其发送到主进程
/*
* This sketch demonstrates how to scan WiFi networks.
* The API is almost the same as with the WiFi Shield library,
* the most obvious difference being the different file you need to include:
*/
#include "ESP8266WiFi.h"
void setup() {
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
}
void loop() {
Serial.println("scan start");
// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
Serial.println("scan done");
if (n == 0)
Serial.println("no networks found");
else
{
Serial.print(n);
Serial.println(" networks found");
for (int i = 0; i < n; ++i)
{
// Print SSID and RSSI for each network found
Serial.print(i + 1);
Serial.print(": ");
Serial.print(WiFi.SSID(i));
Serial.print(" (");
Serial.print(WiFi.RSSI(i));
Serial.print(")");
Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
delay(10);
}
}
Serial.println("");
// Wait a bit before scanning again
delay(5000);
}