使用ADB Shell连接到受密码保护的wifi网络 [英] Connect to password protected wifi network using adb shell

查看:586
本文介绍了使用ADB Shell连接到受密码保护的wifi网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一部Android手机,目标是将手机连接到受密码保护的wifi网络。

I have an Android phone, and the goal is to connect the phone to a password protected wifi network.

到目前为止我知道的步骤:

Steps I know so far:

adb root
adb shell svc wifi enable

好吧,wifi已打开。
现在我需要将电话连接到需要密码的特定无线网络。
我希望可以使用adb shell命令进行连接。

Ok sweet, wifi is turned on. Now I need to connect the phone a certain wireless network that requires a password. I am hoping I can connect using an adb shell command.

有帮助吗?

我宁愿不将程序下载到设备上

I would rather not download programs onto the device

推荐答案

使用 wpa_cli wpa_supplicant 的命令行界面:

# Get to the shell
adb root
adb shell

# Get to wpa_cli prompt
wpa_cli -p /data/misc/wifi/sockets/ -i wlan0

# Add new WiFi network
add_network
set_network 0 auth_alg OPEN
set_network 0 key_mgmt WPA-PSK
set_network 0 ssid "network_name"
set_network 0 proto RSN
set_network 0 mode 0
set_network 0 psk "password"

# Connect to it
select_network 0
enable_network 0
reassociate

# Check the status
status

在上面的命令列表中, add_network 命令将输出新网络的索引,该索引应应该用于后续命令。在此示例中,该索引为 0

In the above list of commands, add_network command will output the index of the new network, which should be used for the subsequent commands. In this example, this index is 0.

这篇关于使用ADB Shell连接到受密码保护的wifi网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆