I have an Android phone which is connected to a secured Wi-Fi hotspot. How can I find out the password of the hotspot from the phone?
3 Answers
On my phone, the credentials are stored in /data/wifi/bcm_supp.conf
. You'll probably need root to see it directly on your phone but you may be able to use adb pull
(requires the Android SDK) from your PC to get the file.
As noted in the comments, the location may vary based on your ROM or device (specifically the Wi-Fi chip; mine's a Broadcom). Check /data/wifi/
, /data/etc/wifi/
and /data/misc/wifi/
for relevant config files if you don't find the ones suggested by eldarerathis or me.
-
3Hm, interesting. What type of phone are you using ATM? I don't have that file, but I was just about to post an answer saying to look for
/data/misc/wifi/wpa_supplicant.conf
. Maybe WPA Supplicant is just a CyanogenMod thing... Apr 2, 2012 at 18:41 -
The name and location of the file vary per device, but it should be either one or the other.– oxr463Sep 11, 2019 at 12:19
On CyanogenMod devices, and possibly other AOSP ROMs, you should be able to grab it from the /data/misc/wifi/wpa_supplicant.conf
file. On a non-rooted device I don't think this is possible since you won't have permission to read the /data
directories where the settings are stored and the Settings menu simply displays (Unchanged)
if you go into the network configuration.
This is what I see on my CM7 EVO (network name and password redacted):
# cd /data/misc/wifi/
# ls
sockets wpa_supplicant.conf
# more wpa_supplicant.conf
ctrl_interface=eth0
update_config=1
network={
ssid="SomeWifiNetwork"
psk="MyPlaintextPassword"
key_mgmt=WPA-PSK
priority=1
}
#
-
My phone is rooted. I have 'superuser' app installed. But how can I get 'adb shell' with root accessed. I tried '$ adb shell shell@android:/ $ su Permission denied 1|shell@android:/ $ cd /data shell@android:/data $ ls opendir failed, Permission denied 255|shell@android:/data $ su Permission denied 1|shell@android:/data $– michaelApr 2, 2012 at 20:34
-
1Ah, this is actually a new setting in CyanogenMod. You'll need to use
su
to get a root shell, but first check inSettings->Developer Options
(your phone's main settings) to see what the "Root Access" setting is. By default it is "Apps only". You'll need to switch it to "Apps and ADB" in order forsu
to work from the shell. Apr 2, 2012 at 21:08 -
In Android Oreo and Pie (tested on OnePlus 6), the file seems to be /data/misc/wifi/WifiConfigStore.xml
which stores your Wi-Fi credentials. I do not know of a good XML parser, but the file can be opened in a text editor (requires root access). Search with the name of your Wifi (SSID) and locate the line containing:
<string name="SSID">"YOUR_SAVED_SSID;</string>
One of the following lines would show the password. It would be mentioned as "PreSharedKey". Example:
<string name="PreSharedKey">"SAVED_PASSWORD;</string>