Get configured wifis with ADB

2019-02-20 05:03发布

问题:

Is there a way to get the configured WiFi-SSIDS from an Android (not rooted) device via ADB? This should be working independant from the WiFi on/off state.

Thank you

回答1:

generally all the configured WIFIs with their passwords are stored in wpa_supplicant.conf which saved in

/data/misc/wifi/wpa_supplicant.conf

but you cant access it unless you have root permission.

you can pull the file by this command

if using windows

adb pull /data/misc/wifi/wpa_supplicant.conf c:\

if using ubuntu

adb pull /data/misc/wifi/wpa_supplicant.conf ~/



回答2:

Finally found out that

adb shell dumpsys wifi | grep -i ssid

gives the configured wifis

Edit: Only if wifi is enabled



回答3:

Not possible. WifiManager.getConfiguredNetworks() only works when WiFi is on.



回答4:

adb pull does work on unrooted devices. u need to run the command as root first. try the following:

in the same command prompt box,

-type [adb root] to restart adb as root. click enter.

-Now type [adb shell], click enter. makes sure the prompt shows [root@[device]: ]

-At the # prompt type [cd /data/misc/wifi] click enter.

-Lastly type [cat wpa_supplicant.conf] click enter.

this should dump data of WiFi you've previously connected to on your phone, to your pc screen.

*type in without brackets []

these command works on my unrooted device after running into the “remote object does not exist” issue.



标签: android adb