You may remember I had an awkward method to redirect a port (i.e. upon TCP connection to a port, forward it to another address and port) using [[netcat]].

Yesterday I really needed a ‘tranparent proxy’: something that would allow me to look at the traffic going through a network connection, without doing anything else. You could use monitoring tools like tcpdump, but unfortunately you have to have administrative rights to run such tools, which isn’t always possible.

The other method is to go through a transparent proxy: connect to the proxy, which will dump all the data in a file while also forwarding to a different port. Note it’s almost exactly while netcat does.

Clearly I didn’t understand the netcat manual, so I wrote a little transparent proxy from scratch. Twice. Once in Perl and once in C.

Then today I realise that:

  • netcat can dump the traffic going through it using option -o
  • my hack is very awkward; to redirect a port all one needs to do is:
    nc -l -p 5000 -c "nc 25"

    which reads “listens for connections on port 5000, and when that happens connect the connection to another connection to, port 25. Now a telnet to localhost:5000 goes to

And with just one more option, we get a transparent proxy:

nc -l -p 5000 -c "nc -o dump 25"

All that’s really missing in the dump is a dating field, which really has nothing to do with Meetic.