Android上的WPS服务器


8

可以在Android设备上模拟Wi-Fi保护的Setup Server协议吗?

这样,当将该设备用作便携式热点时,我可以使用强密码,并允许客户端使用WPS按钮功能进行连接。


不要使用WPS,因为它具有安全漏洞。
QkiZ

4
@QkiZ:这就是为什么我要使用它,我是安全研究人员:D
enrico.bacis

Answers:


0

需要在以下文件中添加字符串(wps_stateeap_server

系统/ netd /服务器/SoftapController.cpp

int SoftapController::setSoftap(int argc, char *argv[])
{
int hidden = 0;
int channel = AP_CHANNEL_DEFAULT;

int wps_state = 2;

if (argc < 5) {
ALOGE("Softap set is missing arguments. Please use:");
ALOGE("softap <wlan iface> <SSID> <hidden/broadcast> <channel> <wpa2?-psk|open> <passphrase>");
return ResponseCode::CommandSyntaxError;
}

if (!strcasecmp(argv[4], "hidden"))
hidden = 1;

if (argc >= 5) {
channel = atoi(argv[5]);
if (channel <= 0)
channel = AP_CHANNEL_DEFAULT;
}

std::string wbuf(StringPrintf("interface=%s\n"
"driver=nl80211\n"
"ctrl_interface=/data/misc/wifi/hostapd\n"
"ssid=%s\n"
"channel=%d\n"
"ieee80211n=1\n"
"hw_mode=%c\n"
"ignore_broadcast_ssid=%d, **eap_server = 1, wps_state = %d**\n",
argv[2], argv[3], channel, (channel <= 14) ? 'g' : 'a', hidden,**wps_state**));

std::string fbuf;
if (argc > 7) {
char psk_str[2*SHA256_DIGEST_LENGTH+1];
if (!strcmp(argv[6], "wpa-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=3\nwpa_pairwise=TKIP CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "wpa2-psk")) {
if (!generatePsk(argv[3], argv[7], psk_str)) {
return ResponseCode::OperationFailed;
}
fbuf = StringPrintf("%swpa=2\nrsn_pairwise=CCMP\nwpa_psk=%s\n", wbuf.c_str(), psk_str);
} else if (!strcmp(argv[6], "open")) {

fbuf = wbuf;
}
} else if (argc > 6) {
if (!strcmp(argv[6], "open")) {
fbuf = wbuf;
}
} else {
fbuf = wbuf;
}

if (!WriteStringToFile(fbuf, HOSTAPD_CONF_FILE, 0660, AID_SYSTEM, AID_WIFI)) {
ALOGE("Cannot write to \"%s\": %s", HOSTAPD_CONF_FILE, strerror(errno));
return ResponseCode::OperationFailed;
}
return ResponseCode::SoftapStatusResult;
}

测试中

hostapd_cli  wps_pbc
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.