Netcat Relays
Last updated
Was this helpful?
Last updated
Was this helpful?
Un-named pipes in netcat relays are like secret tunnels for one-way communication between processes.
They help transfer data between netcat instances on different hosts or ports without needing specific file names or setups. They make sending and receiving data easy and direct.
Two-way communication between processes can be achieved by using two pipes in opposite "directions".
The STDOUT (1) of the command on the left is sent as STDIN (0) to the command on the right.
Example:
On the local machine, send data using netcat to the remote machine:
On the remote machine, receive the data using netcat:
You can use 1 or more relays to transfer your connection.
NC relays typically can only send data in one direction and that is from left to right.
To ssend data back (right to left) you need to use named pipes.
AKA "FIFOs", Named Pipes are treated like files. They let processes read and write to each other.
Two-way communication so processes can share information.
Example:
You can create a named pipe using mknod
or mkfifo
.
mknod mypipe p
Mknod
= make node
Mypipe
= the name of the pipe
p
= the file descriptor. p is for Pipe.
b
= Block-oriented device file
c
= Character-oriented device file
OR
mkfifo mypipe
On the relay machine (This would be the machine in the middle of the sender and receiver)
On Listener2 (sends info):
On Listener1 (receives info):
Writes the output to listener1 and listener2 through the named pipe