wiki:doc/TorifyHOWTO/socat

Version 2 (modified by Jaruga, 5 months ago) (diff)

--

Torifying Socat

Socat is a command line based utility that establishes two bidirectional data streams and transfers between them. This data can take many forms such as files, pipes, devices (terminal or modems), or sockets (UNIX, IPv4, IPv6, TCP, SSL etc). The streams can be constructed from a large and diverse selection of data sinks, sources and address options, which allows Socat to be highly flexible in its usage. Socat can be used for many different purposes. It is for this reason that it and similar tools are often referred to as multipurpose relays.

Using Socat with Tor

Below is an example of utilising Socat to relay traffic from a remote server. While the example shows how to connect to an .onion service, these steps work the exact same way for clear-net facing servers and connections.

Suppose you would like to connect to an IRC network called examplename.onion.

To use pipe Socat via Tor for this connection, simply use the command:

    socat TCP4-LISTEN:4242,fork SOCKS4A:localhost:examplename.onion:6667,socksport=9050

How it works

This command informs Socat to build a connection between your local system on port 4242 and examplename.onion on port 6667 via the Tor network. Simply connect to localhost on port 4242 to utilise it.

Note: If you are using Tor browser for your connection you will need to use port 9150.

See also