Skip to content

Instantly share code, notes, and snippets.

@thunderpoot
Created January 29, 2021 20:29
Show Gist options
  • Save thunderpoot/ceefd8c90b6eac7d86d0a16040db671f to your computer and use it in GitHub Desktop.
Save thunderpoot/ceefd8c90b6eac7d86d0a16040db671f to your computer and use it in GitHub Desktop.
a small telnet gif server using gif-for-cli and netcat
#!/bin/bash
if [ $# -eq 0 ]
then
echo "%usage: $0 <id> [options]"
exit
fi
echo "[$0] 🌶 Now servin' up hot GIFs!"
trap ctrl_c INT
function ctrl_c() {
echo "[$0] ** Terminating **"
exit
}
while true; do
gif-for-cli $2 --rows 20 --cols 80 $1 -l 4 2> /dev/null | sudo nc -l -p 23 -q 1 -v
MYCOUNT=$(expr $MYCOUNT + 1)
echo "[$0] 🌄 served $MYCOUNT gif(s)"
done
@thunderpoot
Copy link
Author

I hope it's obvious to people that sudo nc -l -p 23 -q 1 -v is only a sudo command because of the default telnet port usage;
you can run this without root privs (and probably should anyway if you don't know what it's doing) by changing that line to

gif-for-cli $2 --rows 20 --cols 80 $1 -l 4 2> /dev/null | nc -l -p 1337 -q 1 -v

...or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment