wifi_password() {
airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"
ssid="`$airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'`"
pwd="`security find-generic-password -D 'AirPort network password' -ga \"$ssid\" 2>&1 >/dev/null`"
echo $pwd
}
$ wifi_password
password: "!forHackers"
From us to your inbox weekly.