After many days of doing things that are often done by people who entertain doing things, I finally did them. One of these things was the revising the old vortex#0 game. Specifically, I wanted to answer the following question:
Can you implement this script without using anything but bash?
My initial answer was “no”, but I can certainly try, and see what I learn along the way. To start with, I’ve grabbed the old script, cleaned it up a bit and added some versioning:
The first thing I tried to do was to remove the dependency on the ‘socat’ tool. After a bit of reading man panges, it turns out that bash actually supports native TCP/IP functionality (among quite a few other things). Specifically, if we go to the bash man page, we get the following:
After a little bit of fiddling around, we can remove the socat dependency from our vortex0 script, as follows:
In a nutshell, we simply replace socat with file descriptor 9, attached to the vortex.labs.overthewire.org system. The rest is essentially the same thing. We think it’s a pretty neat trick, and the applications of this (bash’s support for special filenames like this) are fairly interesting.