add more jokes

This commit is contained in:
ed 2018-01-27 22:36:16 +01:00
parent d0520138b3
commit 31780e125d
3 changed files with 64 additions and 2 deletions

View File

@ -23,6 +23,10 @@ most to least recommended
| :--- | :--- |
| telnet | `telnet r0c.int` |
| socat | `socat -,raw,echo=0 tcp:r0c.int:531` |
| bash | [mostly internals](clients/bash.sh) |
| netcat | `nc r0c.int 531` |
| bash | `exec 147<>/dev/tcp/r0c.int/531; cat <&147 & while read -r x; do printf '%s\n' "$x" >&147; done` |
| powershell | [scrolling is kinda broken](clients/powershell.ps1)
| the oneliner | connecting: `exec 147<>/dev/tcp/r0c.int/531;cat<&147 &while read -rN1 x;do printf '%s' "$x">&147;done` |
| | disconnecting: `exec 147<&-; killall cat #sorry` |
| powershell | [scrolling is kinda broken](clients/powershell.ps1)
the powershell client is useless because powershell's VT100 implementation is buggy; scrolling sometimes work, sometimes doesn't, high chance you'll miss messages but it's (very slightly) better than nothing

56
clients/bash.sh Normal file
View File

@ -0,0 +1,56 @@
#!/bin/bash
set -e
# --------------------------------------------
# tcp plaintext client without linebuffering
# --------------------------------------------
# uses bash internals wherever possible,
# let me know if I missed some opportunities
# --------------------------------------------
debug=''
#debug=1
cat_pid=''
function ctrl_c()
{
kill $cat_pid
exit 0
}
function connect()
{
# hook ctrl-c for cleanup
trap ctrl_c INT
# open the tcp connection
exec 147<>/dev/tcp/$1/$2
# dump socket to stdout
cat <&147 & cat_pid=$!
# read keyboard and send each key to the socket
while read -rN1 x
do
[[ $debug ]] &&
{
printf '%s' "$x" |
tee /dev/stderr 2>&1 >&147 |
xxd -c8 -g1 >> /dev/shm/r0c-log
} ||
printf '%s' "$x" >&147
done
}
[[ "x$2" == "x" ]] &&
{
echo
echo " r0c client (bash edition)"
echo " need argument 1: r0c server ip or hostname"
echo " need argument 2: r0c server port"
echo
exit 1
}
connect $1 $2

View File

@ -28,6 +28,8 @@ the other lists are roughly sorted by importance (and additionally split in two
# bugs: whatever
* jump to ch0 on nick change
* powershell's vt100 impl is a glitchy mess
* py2 deadlocks on quit with threadcapture running
* channel cleanup doesn't happen unless user joins another channel after parting
* check for queue buildups in general