Skip to content

Instantly share code, notes, and snippets.

@byverdu
Last active August 29, 2015 14:25
Show Gist options
  • Save byverdu/3571bd378711ec8ad4c2 to your computer and use it in GitHub Desktop.
Save byverdu/3571bd378711ec8ad4c2 to your computer and use it in GitHub Desktop.
list and get password for wifi networks
# Retreive all wifi network
alias listWifiSSID='defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences |grep SSIDString'
# Get the password for that pamater
getWifiPasswordFor(){ security find-generic-password -wa $1}
> security find-generic-password -h
Usage: find-generic-password [-a account] [-s service] [options...] [-g] [keychain...]
-a Match "account" string
-c Match "creator" (four-character code)
-C Match "type" (four-character code)
-D Match "kind" string
-G Match "value" string (generic attribute)
-j Match "comment" string
-l Match "label" string
-s Match "service" string
-g Display the password for the item found
-w Display only the password on stdout
If no keychains are specified to search, the default search list is used.
Find a generic password item.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment