Last active
November 24, 2020 11:54
-
-
Save codycodes/517955946fea3925bde6c5c9a2b63f88 to your computer and use it in GitHub Desktop.
Two commands to get your current WiFi password or any WiFi password stored in your macOS keychain!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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