Socat: Unterschied zwischen den Versionen
| Zeile 35: | Zeile 35: | ||
<syntaxhighlight lang="bash" highlight="1" line copy> | <syntaxhighlight lang="bash" highlight="1" line copy> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Send data from stdin to 192.168.0.10:80 over TCP and show response | |||
socat - TCP:192.168.0.10:80 | |||
Listen on port 8080 and forward traffic to 192.168.0.10 at port 80 | |||
socat TCP-LISTEN:8080,fork TCP:192.168.0.10:80 | |||
Create a simple TCP echo server on port 9000 | |||
socat TCP-LISTEN:9000,reuseaddr fork EXEC:/bin/cat | |||
Relay traffic between ports 1234 and 5678 on localhost u | |||
socat TCP4-LISTEN:1234 fork TCP4:localhost:5678 | |||
Read input from the terminal and send it to UDP server study-notes.org# | |||
socat STDIN UDP:192.168.0.10:5678 Dan Nanni | |||
Serve a file over TCP. Connect to port 8081 to read the log file | |||
socat TCP-LISTEN:8081,fork FILE:/path/to/output.log | |||
Receive data over TCP at port 6000 and append it to a local file | |||
socat TCP-LISTEN:6000,reuseaddr OPEN:/path/to/file,create,append | |||
socat TCP-LISTEN:7000,fork /dev/ttyUSB0,b115200,raw | |||
Forward TCP traffic on port 7000 to a serial device at 115200 baud rate | |||
socat UNIX-LISTEN:/tmp/mysocket,fork EXEC:/bin/cat | |||
Listen on a UNIX socket and echo incoming data | |||
socat TCP4-LISTEN:12345,fork,delay=500ms TCP4:localhost:80 | |||
Introduce 500ms delay to forwarded traffic between ports 12345 and 80 | |||
socat - OPENSSL:example.com:443,verify=0 | |||
Connect to example.com on port 443 while disabling certificate verification | |||
socat OPENSSL-LISTEN:8443,cert=server.pem,verify=0,fork EXEC:/bin/cat | |||
Listen on port 8443 over SSL/TLS as a simple SSL echo server | |||
socat TCP-LISTEN:8080,fork OPENSSL:www.example.com:443,verify=0 | |||
Listen on local port 8080 and forward traffic to example.com over SSL/TLS | |||
socat OPENSSL-LISTEN:8443,cert=test.pem,verify=0,fork TCP:localhost:8080 | |||
Accept SSL connections on 8443 and forward them to non-SSL 8080 | |||
=== Problembehebung === | === Problembehebung === | ||
Version vom 14. Oktober 2025, 12:04 Uhr
Socat - Beschreibung
Beschreibung
Installation
Aufruf
Optionen
| Unix | GNU | Parameter | Beschreibung |
|---|---|---|---|
Parameter
Umgebungsvariablen
Exit-Status
| Wert | Beschreibung |
|---|---|
| 0 | Erfolg |
| >0 | Fehler |
Anwendung
Send data from stdin to 192.168.0.10:80 over TCP and show response
socat - TCP:192.168.0.10:80
Listen on port 8080 and forward traffic to 192.168.0.10 at port 80
socat TCP-LISTEN:8080,fork TCP:192.168.0.10:80
Create a simple TCP echo server on port 9000
socat TCP-LISTEN:9000,reuseaddr fork EXEC:/bin/cat
Relay traffic between ports 1234 and 5678 on localhost u
socat TCP4-LISTEN:1234 fork TCP4:localhost:5678
Read input from the terminal and send it to UDP server study-notes.org#
socat STDIN UDP:192.168.0.10:5678 Dan Nanni
Serve a file over TCP. Connect to port 8081 to read the log file
socat TCP-LISTEN:8081,fork FILE:/path/to/output.log
Receive data over TCP at port 6000 and append it to a local file
socat TCP-LISTEN:6000,reuseaddr OPEN:/path/to/file,create,append
socat TCP-LISTEN:7000,fork /dev/ttyUSB0,b115200,raw Forward TCP traffic on port 7000 to a serial device at 115200 baud rate
socat UNIX-LISTEN:/tmp/mysocket,fork EXEC:/bin/cat Listen on a UNIX socket and echo incoming data
socat TCP4-LISTEN:12345,fork,delay=500ms TCP4:localhost:80 Introduce 500ms delay to forwarded traffic between ports 12345 and 80
socat - OPENSSL:example.com:443,verify=0 Connect to example.com on port 443 while disabling certificate verification
socat OPENSSL-LISTEN:8443,cert=server.pem,verify=0,fork EXEC:/bin/cat Listen on port 8443 over SSL/TLS as a simple SSL echo server
socat TCP-LISTEN:8080,fork OPENSSL:www.example.com:443,verify=0 Listen on local port 8080 and forward traffic to example.com over SSL/TLS
socat OPENSSL-LISTEN:8443,cert=test.pem,verify=0,fork TCP:localhost:8080 Accept SSL connections on 8443 and forward them to non-SSL 8080
Problembehebung
Konfiguration
Dateien
| Datei | Beschreibung |
|---|---|
Anhang
Siehe auch
Dokumentation
- Man-Page
Links
Projekt
Weblinks