socat
Socat is a multipurpose relay for bidirectional data transfer between two byte streams. It supports files, pipes, devices, and sockets including Unix, IPv4, IPv6, raw, UDP, TCP, and SSL.
Description
Socat (SOcket CAT) establishes two bidirectional byte streams and transfers data between them. Data channels may be files, pipes, devices like terminals or modems, or sockets. It provides forking, logging, tracing, different modes for interprocess communication, and many more options.
It can be used as a TCP relay (one-shot or daemon), external socksifier, shell interface to Unix sockets, IPv6 relay, netcat and rinetd replacement, to redirect TCP-oriented programs to a serial line, or to establish a relatively secure environment (su and chroot) for running client or server shell scripts inside network connections. Socat supports SCTP as of version 1.7.0.
The package includes helper tools like filan for analyzing file descriptors, procan for system parameters, and scripts such as socat-broker.sh, socat-chain.sh, and socat-mux.sh for specific relay scenarios.
How It Works
Socat creates two bidirectional byte streams defined by bi-addresses and transfers data between them. It handles various protocols including TCP, UDP, SSL, Unix sockets, IPv4, IPv6, raw sockets, and SCTP. Features like forking, logging, tracing, and options for interprocess communication enable versatile data channeling between files, pipes, devices, and network sockets.
Installation
sudo apt install socatFlags
Examples
socat -h/usr/bin/socat-broker.sh TCP4-L:1234/usr/bin/socat-chain.sh TCP4-L:1234,reuseaddr,fork SOCKS::<server>:<port> OPENSSL:10.2.3.4:12345,cafile=.../usr/bin/socat-mux.sh TCP4-L:1234,reuseaddr,fork TCP:10.2.3.4:12345filan -hprocan -hsocat [options] <bi-address> <bi-address>