Skip to content

Instantly share code, notes, and snippets.

@tony-sol
Last active August 13, 2024 17:57
Show Gist options
  • Save tony-sol/149fbd8e2b72108c540da992a460f962 to your computer and use it in GitHub Desktop.
Save tony-sol/149fbd8e2b72108c540da992a460f962 to your computer and use it in GitHub Desktop.
Get macos keychain secure note content from command line

Secure notes in macos keychain are actually hex dumped generic passwords, with plist as password value.

This plist contains data node, which is base64 encoded rich text, but also a string node, which is just plain text.

So fetching secure note plain text via command line (yq required)

get_secret_note() {
	security find-generic-password -C note -s "$1" -w | xxd -revert -plain | yq --input-format xml --prettyPrint '.plist.dict.string'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment