Skip to content

Instantly share code, notes, and snippets.

@dnet
Created February 12, 2013 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnet/4771905 to your computer and use it in GitHub Desktop.
Save dnet/4771905 to your computer and use it in GitHub Desktop.
Simple web file sharing script using SHA-256 hash as file name to avoid brute force attacks
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 <filename>" >&2
exit 1
fi
HASH=$(sha256sum $1 | cut -c -64)
EXT=$(echo "$1" | sed 's/^.*\.//')
scp "$1" remote_host:directory_available_from_web/$HASH.$EXT
echo http://domain.tld/$HASH.$EXT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment