Questions tagged [socat]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
59 votes
3 answers
36k views

What's the difference between socat and netcat?

I understand that socat is described as a "more advanced" version of netcat, but what is the actual difference? Would it be correct to say that everything you can do in netcat you can also do in ...
bantic's user avatar
  • 1,529
44 votes
7 answers
51k views

Forward local port or socket file to remote socket file

Quick question - I run two linux boxes, one my own desktop and the other my VPS. For security reasons on the VPS end I opted for socket connections to MySQL (/var/run/mysqld/mysql.sock). I know I can ...
user avatar
31 votes
6 answers
73k views

echo server with netcat or socat

I want a UDP echo server to get packets, and reply exactly what it has received. How can I simply do this using netcat or socat? It should stay alive forever and handle packets coming from several ...
Mohammad Hedayati's user avatar
11 votes
2 answers
3k views

How to set up a persistent TCP gender-changer proxy?

I have a provider (A) that wants to send us data through an incoming TCP connection. Unfortunately the consuming service (B) cannot receive inbound TCP connections. Also it does not have a static IP, ...
dtech's user avatar
  • 633
10 votes
1 answer
18k views

socat: Show incoming connections

I am slightly going mad. Even if I call socat like this: socat -vvvv tcp4-listen:9000 tcp4-listen:9001 it works perfectly, but doesn't inform me about incoming TCP connections! Is there an ...
Niklas B.'s user avatar
  • 214
8 votes
2 answers
7k views

Access D-Bus remotely using socat

Description: I'd like to access a D-Bus system service from another machine, knowing only machine's IP address and the service to connect to. What I have recently found is Gabriel (D-Bus over SSH). ...
schedar's user avatar
  • 261
7 votes
2 answers
12k views

socat forwarding to multiple addresses

I have a single incoming video stream, and I'd like to set up multiple processes to handle it, each running at its own address. After some reading it seems socat is one way to do this socat TCP4-...
Shukri Adams's user avatar
7 votes
1 answer
11k views

Always keep socat alive

I have a socat running nicely, executing my command when a connection comes in with the arguments provided. However, the issue I am having is that the socket is at EOF and the next time a connection ...
Robbie Trencheny's user avatar
7 votes
1 answer
41k views

How do i use socat as a proxy server?

I'd like my .NET app to use a proxy which I know how to do except .net doesn't support sock4a/sock5. I know how to setup my app but, how do I setup socat to listen at as a TCP proxy on port 1234 and ...
user avatar
7 votes
2 answers
6k views

Forwarding serial port over network and back to serial char device on remote host (socat?)

I'm working with a linux application which needs to talk with a remotely-located serial (rs-232) device. I've worked out how to use socat on the remote end to send the device's serial data over an IP ...
Alex G's user avatar
  • 386
7 votes
1 answer
17k views

Forwarding linux terminal from serial port to TCP with socat

I'm working on embedded ARM platform, Slackware. I'm using G24 Java modem which is configured to forward data between ports /dev/ttyS1 and /dev/ttyACM0, so anything that goes onto any of these ports ...
Wookie88's user avatar
  • 211
7 votes
1 answer
8k views

Socat to share a serial link between multiple processes

I have a scenario where multiple processes on the same box want to communicate with a serial device. Process A needs two-way communications with the serial port, and Process B only needs to be able ...
John Walthour's user avatar
6 votes
2 answers
19k views

Windows/Linux socat to share a serial device over IP

I have a scenario where I demonstrated to my group @ work how to share a very expensive USB patient simulator plugged into a Raspberry Pi (Debian) using socat. The group wants to be able to have an on-...
wxfield's user avatar
  • 61
4 votes
2 answers
9k views

socat connect-connect "proxy" two inbound TCP connections to expose a firewalled service?

I'm struggling a bit trying to see how to use socat (or a similar TCP port redirector) to expose a firewalled service on a PC. Here's the scenario: I have a server PC which will be acting as a ...
cjones26's user avatar
  • 276
4 votes
3 answers
6k views

socat TCP file server

I'm trying to set up a simple socat fileserver using TCP to send small files (~100KB). Here are the one-line servers and client for one file: Server: socat -u -d -d OPEN:file.dat TCP-LISTEN:<port&...
jean-loup's user avatar
  • 126
4 votes
1 answer
2k views

Can socat be used to forward an ssh-agent socket into a chroot?

I'm building custom Debian environments on a remote server, which I connect to over SSH. This involves building a debootstrap environment, then chrooting into it to run a custom installer. As part of ...
3 votes
1 answer
2k views

socat tun device very low throughput

I was tinkering around with socat and tried to use socat for creating a TUN device for tunneling between two debian stretch servers. However, throughput seemed very low and comparing with iperf ...
1gd_1bs37coua9dd's user avatar
2 votes
1 answer
3k views

Socat - is it possible?

Is there any way to listen and execute a command ( for every connection ) while port forwarding with socat? A non-working example to make it more clear: socat TCP-LISTEN:8080,reuseaddr, "exec:ls&...
hyogy's user avatar
  • 23
2 votes
1 answer
5k views

IPv4 to IPv6 proxy/passthrough

I recently had an app rejected from the ios store for crashing during their (now) mandatory IPv6 test (didn't even know they did that). My server (on AWS) wasn't setup for IPv6, but I've fixed that ...
user3249281's user avatar
2 votes
1 answer
6k views

UDP multicast send/receive: Routing or socat issues?

I'm using 'socat' on Linux Centos 7 to diagnose some problems. Server and clients are all linux centos7, they all have multiple interfaces. Server 10.1.1.1 is on Switch 1, 10.1.1.2 is on Switch 2. ...
surfcode's user avatar
  • 245
2 votes
1 answer
5k views

Simulate tcp disconnect using socat

I am trying to use socat command to simulate a tcp disconnect between my client service and EMS broker process on a remote host. I am running this socat command socat TCP-LISTEN:8123,fork TCP:...
Bhaskar's user avatar
  • 141
2 votes
2 answers
862 views

Resolving HAProxy BADREQs using socat

I'm trying to figure out why i'm getting BADREQs from time to time, by using "show errors" in socat. The problem is that it only shows the last error. I want to be able to see all of them ( like using ...
SecondThought's user avatar
2 votes
1 answer
2k views

What is needed to use kubernetes port forwarding through a proxy?

I have a kubernetes cluster that I can reach through an nginx proxy. I can do kubectl get deployments -n kube-system without issue. However, I'm trying to use helm. Helm is throwing an error: ...
cat pants's user avatar
  • 2,273
2 votes
0 answers
1k views

socat Resource temporarily unavailable

I am using socat as a bridge between some devices and running socat (a couple hundreds of instances) like this: socat -d -d -d -x -d -lf "/var/log/some_log_file" TCP4-LISTEN:6126,fork,max-children=1,...
Tiago Queiroz's user avatar
2 votes
0 answers
623 views

use socat to provide password to bsign

I have many servers, where I deploy various binaries. For this purpose I use a script that packs them into archives, publishes to the local repository and then ssh-es to the target servers and ...
gluk47's user avatar
  • 220
1 vote
1 answer
2k views

socat CREATE returning Bad file descriptor

I'm trying to build a quick script which listens for one UDP packet, stores it to a file, and exits. socat to the rescue! $ socat UDP-RECVFROM:9999 CREATE:/tmp/results_9999 2016/04/08 11:56:59 socat[...
tudor -Reinstate Monica-'s user avatar
1 vote
1 answer
6k views

Is it possible to make a web browser proxy tunnel with Netcat/Socat?

Concerning the Netcat/Socat utility . From the man page, it seems like it is possible to create a secure proxy using netcat by which I could point my web browser to like a proxy server , that could ...
djangofan's user avatar
  • 4,190
1 vote
1 answer
8k views

socat udp packet forwarding with source address

I am trying to use socat (instead of iptables) for UDP port forwarding. I just need to redirect some traffic from UDP port 162 to 33162. I am using something like this: socat udp-listen:162,pktinfo,...
Rade_303's user avatar
  • 133
1 vote
1 answer
2k views

How to capture UDP traffic so it can be piped to grep

I'm trying to capture UDP traffic which is being sent as StatsD metrics (on port 8125). The most simple approach I tried is to run nc -ul 8125 which prints the metrics to the terminal...but they are ...
Darragh's user avatar
  • 113
1 vote
1 answer
2k views

Why Socat is sending back the input to client?

I am using this command socat -lm -d -d TCP4-LISTEN:5555,reuseaddr,fork EXEC:/bin/myscript,chroot=/root/,su=root,pty,stderr to start a server but when i send the i connect to it through netcat and ...
user2001987's user avatar
1 vote
1 answer
1k views

Need help in Haproxy socat for cacti

am using the haproxy socat to get the sessions data to plot it in cacti, /var/run/socket-haproxy is owned by www-data (the user which cacti uses) but when I try to execute this command as www-data am ...
APZ's user avatar
  • 964
1 vote
1 answer
740 views

Using socat forwarder over HTTP tunnel (CONNECT) over SSL/TLS

For context, i am using nginx's reverse proxy ngx_http_proxy_module to cache content from an upstream https server. For a specific project, i need nginx to pass through a corporate HTTP proxy (using ...
Florent Thiery's user avatar
1 vote
1 answer
713 views

What is the iptables equivalent to what socat does?

What is the iptables equivalent to the following? socat TCP-LISTEN:8080 TCP:some-random-host-in-another-network.com:80 Now multiple clients can connect to port 8080 of this middle host to actually ...
Masood Lapeh's user avatar
1 vote
1 answer
5k views

Forwarding SNMP ports over SSH

I access my work network through a VPN and have access to every host in there through SSH. Currently I need to access around 3000 hosts via SNMP, but corporate sec policies restrict SNMP access ...
Megaslav's user avatar
  • 117
1 vote
0 answers
554 views

'socat' not displaying incoming UDP packets, but Wireshark does

The link is an image of a Wireshark dump of an incoming 60-byte Ethernet frame which contains a UDP packet. The packet payload is the single word 'hello' (sorry, I don't have enough rep to paste the ...
QF0's user avatar
  • 183
1 vote
0 answers
2k views

ping packet loss in wireguard UDP over TCP + UDP over socat tunnels

I have a wireguard tunnel mostly working between two Debian systems, but I had to workaround a ISP firewall (firewall X in the diagram below) that blocks everything inbound and prevents Server B from ...
Lucio Crusca's user avatar
1 vote
1 answer
1k views

Invoke remote program with socat and wait for it to complete

I need to invoke a program x on server foo from client bar. Program x takes some time to load, then reads input from stdin and transmits output to stdout before terminating. I've been trying to use ...
koehn's user avatar
  • 291
1 vote
0 answers
622 views

Simple socat UDP6 relay test setup not working

I'd like to use socat as a relay to let two players (both behind firewalls) of my game connect to each other. The game engine uses UDP. Player A will host the game server, player B will join as client,...
Lou's user avatar
  • 11
1 vote
0 answers
53 views

Encapsulate udp traffic info tcp with on-disk buffering

My ipfix flow receiver supports only udp (can't be replaced), which is not resistant to network failures and then I'm loosing flow data. To improve this I'm thinking about using socat, mkfifo between ...
Supermario's user avatar
1 vote
1 answer
500 views

End of line after socat readbytes limit is reached

We wanted to use socat to make a process available that is line-based: socat SYSTEM:"echo \$\$;sed -u /^%/s/foo/bar/" \ TCP-L:1234,fork,reuseaddr,readbytes=21,bind=localhost This works but only ...
xebeche's user avatar
  • 363
1 vote
0 answers
857 views

socat multiple reads from pipe via SSH

I would like to read input on a named pipe on a remote server from my local machine. I have a script on the remote server that is triggered as a CRON job. So every now and then by script writes ...
Cyberlurk's user avatar
  • 111
1 vote
0 answers
948 views

Socat interacting with specific host (reverse shell) from mutiple clients/connections

I have a threaded c/c++ application that gives a pty reverse shell installed on multiple linux clients they all connect back to same server/port now I need to find a reliable method to interact with a ...
Chris Bovier's user avatar
1 vote
2 answers
5k views

How to tunnel the serial port from a remote machine?

I'm trying to access a remote serial console (a tty port on a remote machine) as if it's on a local machine. This is necessary for a serial-port only application to work on my machine. The remote tty ...
crististm's user avatar
  • 141
1 vote
1 answer
953 views

with socat, given port on the remote (server) host is to be forwarded to the given host and port on the local side

Is it possible to use socat to achieve the following, without the need of using ssh? > ssh -N -R 8080:localhost:1080 [email protected] -R [bind_address:]port:host:hostport Specifies that the ...
David Portabella's user avatar
0 votes
2 answers
144 views

Dumping the contents of HTTP packets between two VPNs

Here's my setup: Client ---> VPN 1 (my pc, same subnet of the client) --> VPN 2 (external VPN) --> Internet Both VPNs are L2TP/IPSec and the first one is an Ubuntu server with Openswan. I need to ...
StepTNT's user avatar
  • 123
0 votes
2 answers
1k views

Redirect to port based on requested (sub)domain (1 IP, non-HTTP request) [duplicate]

Possible Duplicate: How to use DNS to redirect domain to specific port on my server So I've been trying to figure out how to redirect a subdomain to a specific port. Let's assume the application ...
levifig's user avatar
  • 101
0 votes
1 answer
1k views

how to create a tar file with checksums, but without compression

(note, this is not a duplicate of Creating a tar file with checksums included) I'm familiar with using tar + gzip to create a compressed tar file (tar cf - files | gzip > something.tar.gz), and ...
William's user avatar
  • 145
0 votes
1 answer
2k views

Using socat to exec php cli

There are multiple client programs that periodically connect to a port on my server and send a single line of text. When a connection to the port is made I need to start a PHP CLI script that ...
RoyHB's user avatar
  • 163
0 votes
0 answers
28 views

iptables as proxy server for IoT devices similar to socat

I am able to forward incoming TCP traffic from IoT devices hitting a port towards another destination server using socat using this command socat TCP-LISTEN:5050,reuseaddr,fork TCP:some-random-host-in-...
ShamsRKhan's user avatar
0 votes
1 answer
184 views

K8s Port Forwarding via kubectl and socat

My k8s pod is connecting to a certain https target. This target is not reachable from my local machine, so I wanted to use kubectl proxy + socat to make that target available on my local machine für ...
dontspeak's user avatar