Skip to content

Instantly share code, notes, and snippets.

@kevinmel2000
Forked from masbog/keychain-system-dump.sh
Created July 26, 2016 13:34
Show Gist options
  • Save kevinmel2000/a8748045948f6e413b5b98f5f8b2add3 to your computer and use it in GitHub Desktop.
Save kevinmel2000/a8748045948f6e413b5b98f5f8b2add3 to your computer and use it in GitHub Desktop.
Dump system keychain with automation insert username and password
$security dump-keychain -d /Library/Keychains/System.keychain > System-keychain.txt &
$osascript 2>/dev/null <<EOF
set appName to "${username}"
set appPass to "${password}"
tell application "System Events"
repeat while exists (processes where name is "SecurityAgent")
tell process "SecurityAgent"
if exists (text field 1 of window 1) then
set value of text field 1 of window 1 to appName
set value of text field 2 of window 1 to appPass
end if
end tell
tell process "SecurityAgent" to click button "Allow" of window 1
delay 0.2
end repeat
end tell
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment