tech:notes_socat
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:notes_socat [2025/11/08 10:31] – Jean-Baptiste | tech:notes_socat [2026/05/30 21:52] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes socat | ||
| + | |||
| + | Dance, Socat Dance ! | ||
| + | |||
| + | Voir aussi : | ||
| + | * [[OpenSSL Proxy http_proxy]] / proxytunnel | ||
| + | |||
| + | Voir également spiped : | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | |||
| + | Voir : | ||
| + | * netsed | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | |||
| + | Exemple | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP4-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | Mais la bonne solution est : | ||
| + | ~~~bash | ||
| + | iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 10053 -j DNAT --to-destination 10.9.0.6: | ||
| + | iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## TUN | ||
| + | |||
| + | ### TUN Server | ||
| + | |||
| + | ~~~bash | ||
| + | socat -d -d TCP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | After starting this command, socat will wait for a connection and then create a TUN pseudo network device with address 192.168.255.1; | ||
| + | |||
| + | |||
| + | ### TUN Client | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP: | ||
| + | ~~~ | ||
| + | |||
| + | This command should establish a connection to the server and create the TUN device on the client. | ||
| + | |||
| + | |||
| + | ### OpenVPN | ||
| + | |||
| + | http:// | ||
| + | |||
| + | OpenVPN sur le port 443 | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Socket Unix | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ~~~bash | ||
| + | socat / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | echo " | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Tunnel SSH Over SCTP | ||
| + | |||
| + | http:// | ||
| + | |||
| + | assuming you want the SCTP socket to listen on port 80/SCTP and sshd is on 22/TCP | ||
| + | |||
| + | ~~~bash | ||
| + | socat SCTP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | replace SERVER_IP with IP of listening server, and 80 with whatever port the SCTP listener is on :) | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | replace username and -p port value as needed... | ||
| + | |||
| + | ~~~bash | ||
| + | ssh -lusername localhost -D 8080 -p 1337 # | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Décapsuler HTTPS | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | ~~~bash | ||
| + | echo "GET hosts" | socat - TCP4: | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | socat -ls TCP4-LISTEN: | ||
| + | ~~~ | ||
| + | |||
