NetCat & Port Redirection & -b option
I am trying to implement Port redirection using netcat. I have 3 PCs:
"A" from which I run
"B" from which I run
nc -vv 192.168.1.2 -p 80
"C" from which I run
nc -lvvp 80 | nc -vv 192.168.1.3 -p 5555
The idea is to connect from A to C on the port 5555 (assuming A is behind firewall and only port 80 is opened)
the flow works correctly, Text from A goes to C, however, text from C doesn't came back to A, but stuck in B.
I have searched and found that this can be solved by adding a second pipe to B as follows:
nc -lvvp 80 | nc -vv 192.168.1.3 -p 5555 | nc -lvv -b -p 80
however, my netcat doesnt contain -b option (on both BT2 & windows binary).
I have searched the forum and found a solutions using backpipe, but really I didn't understood it.
thanks in advance,
mknod backpipe p
nc -l -p 80 0<backpipe | tee -a inflow | nc localhost 81 | tee -a outflow 1>backpipe