Packs / socat Recipes

Pack 07

socat Recipes

20 practical commands for connecting, relaying, wrapping in TLS and bridging with socat

For blue-team learners, homelabbers and junior admins who have outgrown netcat and need to relay, forward or wrap a connection in TLS. Twenty recipes cover socat's two-address model and its -d -d logs, TCP and UDP listeners, quick TLS servers and clients, port forwarding, UDP and UNIX-socket bridges, serving files, virtual serial ports and spotting socat relays on a host. Each recipe was run between Kali, Ubuntu Server and Metasploitable 2 on an isolated lab network and shows the real output it produced.

US$12local taxes calculated at checkout

Buy on Gumroad

Checkout and download are handled by Gumroad.

Cover of socat Recipes

What you get

  • socat Recipes PDF: 20 recipes
  • One-page socat cheat sheet PDF
  • Edition 1

What it covers

  • Connect, listen and read socat's log
  • Add or strip TLS with OPENSSL
  • Forward ports, UDP and UNIX sockets
  • Move files, make PTYs, spot stray relays

Tested on

Tool
socat 1.8.1.3 and 1.8.1.1
System
Kali GNU/Linux Rolling and Ubuntu 26.04.1 LTS
Lab runs
28 and 29 Nov 2026, on an isolated lab network

Only connect to, listen on or relay to systems you own or have written permission to test.

A sample page from socat Recipes
A page from the pack.

The 20 recipes

Connecting and reading socat's output

  1. 01Connect to a service: socat's two addresses
  2. 02See why a connection failed
  3. 03Watch the bytes both ways (-v, crlf)

Listeners, TCP and UDP

  1. 04Listen for one connection and see who it was
  2. 05Accept only chosen clients (range=)
  3. 06A stand-in service that answers every client (fork)
  4. 07Receive UDP datagrams (a quick syslog sink)

TLS with OPENSSL

  1. 08Run a quick TLS server
  2. 09A TLS client that checks the certificate (OPENSSL)
  3. 10Put TLS in front of a plain service

Forwarding and proxying

  1. 11Forward a port to another host (fork)
  2. 12Forward UDP (DNS) to another host
  3. 13Turn UDP into TCP (a syslog relay)
  4. 14Record a session byte for byte (-r, -R)
  5. 15Let another host reach a loopback-only service
  6. 16Bridge a UNIX-domain socket and TCP

Files and terminals

  1. 17Serve a file to every client that connects
  2. 18Send a file to a receiver and check it (-u, CREATE)
  3. 19Make a pair of virtual serial ports (PTY)

Spotting socat on a host

  1. 20Find socat relays and listeners

Also in a bundle