Skip to content

Instantly share code, notes, and snippets.

@apolzek
Last active August 18, 2026 19:21
Show Gist options
  • Select an option

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

Select an option

Save apolzek/1fe48121c8f35a98c9196738c90cb54b to your computer and use it in GitHub Desktop.
anongist demo (linux/bash)
#!/usr/bin/env bash
# anongist encrypted runner (linux). AES-256-CBC/PBKDF2.
# Usage: curl -fsSL <gist-raw-url> | bash
set -e
PAYLOAD='U2FsdGVkX1+V43qsMpZYhDYHsL0AAtmSEXyfiYCp8khuqm0U1+97r2+ErlIKOkoArpRU+EgD6frPdsNj45FzS4EHDJ9AdDAAo4lrggakXtEHtvRxC6+UsBjHlvcw++oUaF0bS1tbR0u9afcdEL+W+LtCBf/7LkPKOUkRkEWfmyAdwAqOBg5+z2pR8s1c/1erGFxMyebV6V2NlBRc910jGBQmxB1NP4/Yk7MfUeymNIX1bmNxt8eATYgj7eXsN9utR55y9O4ptme9EbPC+2V3/g=='
# 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