Skip to content

Instantly share code, notes, and snippets.

@wmonk
Last active November 11, 2015 22:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmonk/4784c626bbd331f0877d to your computer and use it in GitHub Desktop.
Save wmonk/4784c626bbd331f0877d to your computer and use it in GitHub Desktop.
Get wifi password
# ssid will give the SSID of the current network you are connected to
alias ssid='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '\''/ SSID/ {print substr($0, index($0, $2))}'\'''
# wifi will return 'password: "your-password"'
alias wifi='security find-generic-password -D "AirPort network password" -a $(ssid) -g | awk '\''/ password: "/ {print substr($0, index($0, $2))}'\'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment