Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Two commands to get your current WiFi password or any WiFi password stored in your macOS keychain!
#!/bin/bash
get_current_wifi_password() {
# this command from http://bit.ly/2zWtUhQ
current_wifi=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | \
awk '/ SSID/ {print substr($0, index($0, $2))}'`
security find-generic-password -a "$current_wifi" -g | tail -0
}
get_wifi_password() {
security find-generic-password -a "$1" -g | tail -0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.