Last active
December 8, 2016 02:26
-
-
Save flarn2006/94ba5dae9253b48d42991787f71f3767 to your computer and use it in GitHub Desktop.
Easy QR CIA installer shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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