Skip to content

Instantly share code, notes, and snippets.

@apolzek
Created August 25, 2026 02:01
Show Gist options
  • Select an option

  • Save apolzek/ef087ef3364f32bc64bd0981efd9e57f to your computer and use it in GitHub Desktop.

Select an option

Save apolzek/ef087ef3364f32bc64bd0981efd9e57f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# anongist encrypted runner (linux). AES-256-CBC/PBKDF2.
# Usage: curl -fsSL <gist-raw-url> | bash
set -e
PAYLOAD='U2FsdGVkX19KedtQ35AIXzmbpzmwHZXMU7QrcSL2s/Yr0Ryeav7fHkKDQcX9+Rn6rIaT7xm6YRGZHopFHdRJ9w=='
# Read the password from the terminal even under curl | bash.
ANON_PASS=""
if { exec 9< /dev/tty; } 2>/dev/null; then
printf 'Password: ' > /dev/tty
stty -echo < /dev/tty 2>/dev/null || true
IFS= read -r ANON_PASS <&9 || true
stty echo < /dev/tty 2>/dev/null || true
printf '\n' > /dev/tty
exec 9<&-
else
printf 'Password: '
IFS= read -r ANON_PASS || true
fi
ANON_PLAIN="$(printf '%s' "$PAYLOAD" | base64 -d 2>/dev/null \
| openssl enc -d -aes-256-cbc -pbkdf2 -salt -pass pass:"$ANON_PASS" 2>/dev/null)"
ANON_RC=$?
if [ $ANON_RC -ne 0 ] || [ -z "$ANON_PLAIN" ]; then
echo "anongist: decryption failed (wrong password or corrupted payload)" >&2
exit 1
fi
printf '%s' "$ANON_PLAIN" | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment