Show HN: Made a quick filesharing bash script inspired by another Show HN post
I got inspiration from this post
https://news.ycombinator.com/item?id=33094627
Here is the script
#!/bin/bash qrcode() {
qrcode-terminal "http://"$(ip addr show wlp3s0 |grep -Eo $ipregex |head -n1 )":9000/"
cd ~/.webshare && python3 -m http.server 9000
}
share(){ if [[ "$1" = "f" ]] then echo "success $1"
[[ ! -d ~/.webshare ]] && mkdir -p ~/.webshare
#cp -r --reflink "$2" ~/.webshare/
path="$(realpath "$2")"
ln -s "$path" "/home/sanbotbtrfs/.webshare/"
qrcode
elif [[ "$1" = "s" ]]
then
path="$( find "$2" |fzf )"
path="$(realpath "$path")"
ln -s "$path" "/home/sanbotbtrfs/.webshare/"
qrcode
else
error
fi
}cleanup() { echo 'cleanup operation ' rm -vrf ~/.webshare/* } error() { echo 'usage share [s/f] <filename/dir> ; s is for fuzzy search and f is regular '
} trap cleanup 1 2 3 6 14 15 ; [[ $# -eq 2 ]] && share "$1" "$2" || error
2 comments
[ 3.5 ms ] story [ 13.9 ms ] threadWhat is interesting is the qrcode-terminal. Never seen that before but makes me wonder. In terms of data exfiltration, you could absolutely store data inside a qrcode.
Looked it up, qrcodes can store about 4000 characters. I guess in situations where node is available it could be useful