3 ms·
I know this is a toy meant for short-term use, but you can use a fifo/named pipe so you don't have a growing file used for data transfer. mkfifo -m0600 /tm
by dundarious 5y ago
I know this is a toy meant for short-term use, but you can use a fifo/named pipe so you don't have a growing file used for data transfer.
mkfifo -m0600 /tmp/buffer && netcat httpbin.org 80 < /tmp/buffer | netcat -lp 8080 > /tmp/buffer
Might want the file if you want a record of course.
- maxbond 5y agoThanks! TIL! That's a much cleaner way of doing it. Regarding keeping the file, if memory serves the "real" pipeline had some `tee`s in it. I recreated this much more recently to make a GitHub repo of funny code snippets (https://github.com/MaxBondABE/one-thread-crashing/ https://github.com/MaxBondABE/one-thread-crashing/). You reminded me of a different toy I made many years ago. I created FIFOs for files that you might try to read when exploiting an arbitrary file read in a web app, say /etc/www/apache.conf (if that's the right path - it's been a while since I've configured a web server!) and I'd have a program that opened them. This would block until someone opened the other end of the FIFO, at which point I'd raise an alarm (which was just a print statement).