Re:Bored? How about trying a Linux speed run?
by zokier on Sunday April 12, 2020 @09:17AM
(#22848049)
/dev/tcp is ugly hack in bash, not something provided by kernel. nc is arguably the more canonical way of doing networking in shell.
Re:Bored? How about trying a Linux speed run?
by anthk on Sunday April 12, 2020 @09:51AM
(#22848236)
If you have nc you just need to reimplement echo.c and the task is over, as you can fetch busybox in several ways.
Heck, a simple while loop over stdin would be enough.
From the K&R book:
#include <stdio.h>
int main(){
int c;
while((c =getchar()) != EOF){
putchar(c);
}
}
Or just run nc from a < redirect, but, the shell could restrict that maybe.
Also accessible as a file, since everything is a file.
echo "foo" > /dev/tcp/host/port