Skip to content

Instantly share code, notes, and snippets.

@flarn2006
Last active December 8, 2016 02:26
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 flarn2006/94ba5dae9253b48d42991787f71f3767 to your computer and use it in GitHub Desktop.
Save flarn2006/94ba5dae9253b48d42991787f71f3767 to your computer and use it in GitHub Desktop.
Easy QR CIA installer shell script
#!/bin/bash
# Requirements:
# * qrencode <https://fukuchi.org/works/qrencode/> (apt-get install qrencode)
# * netcat <http://nc110.sourceforge.net/>
if [ -z "$1" ]; then
echo "Usage: $0 filename" >&2
exit 2
fi
if [ ! -e "$1" ]; then
echo "$1: file not found" >&2
exit 1
fi
echo "Scan the following QR code using FBI:"
echo
qrencode -tutf8 "http://`hostname`:12345/"
{
echo -ne "HTTP/1.1 200 OK\r\nContent-Length: `stat -c%s $1`\r\n\r\n"
cat $1
} | nc -l 12345 >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment