Skip to content

Instantly share code, notes, and snippets.

@mlebkowski
Last active February 23, 2025 11:31
Show Gist options
  • Save mlebkowski/5787e55f130ab1af55f34ed548db8784 to your computer and use it in GitHub Desktop.
Save mlebkowski/5787e55f130ab1af55f34ed548db8784 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
main() {
declare account="$1" uuid="$2" field="${3:-password}"
/opt/homebrew/bin/op read --account "$account" "op://Employee/$uuid/$field"
}
main "$@"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>pl.narzekasz.op-sudo.35s524did7b74qggqeoqbetpee</string>
<key>ProgramArguments</key>
<array>
<string>/Users/puck/bin/op-sudo.sh</string>
<string>WonderNetwork</string>
<string>35s524did7b74qggqeoqbetpee</string>
</array>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>InitGroups</key>
<true/>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockPathMode</key>
<integer>384</integer>
<key>SockPathName</key>
<string>/Users/puck/.op-sudo/wondernetwork.sock</string>
<key>SockType</key>
<string>stream</string>
</dict>
</dict>
</dict>
</plist>
#!/usr/bin/env bash
has-command() {
command -v "$1" >/dev/null 2>&1
}
main() {
SOCKET="$(realpath ~/.ssh/op-sudo.sock)"
if has-command nc; then
echo | nc -U "$SOCKET"
elif has-command socat; then
socat stdio "UNIX-CONNECT:$SOCKET"
else
echo "Type the passwords your own self" >&2
return 1
fi
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment