socat | Run socat command in alpine container | Continuous Deployment library
kandi X-RAY | socat Summary
kandi X-RAY | socat Summary
Run socat command in alpine container. Auto-trigger docker build for socat when new version is released.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of socat
socat Key Features
socat Examples and Code Snippets
Community Discussions
Trending Discussions on socat
QUESTION
I have a RNDIS USB modem that allows AT commands through a telnet port (5510). I want to use it to read and send SMS messages from a script. I've used a variant of a similar question posted here but I'm using socat instead of netcat.
- I have a helper script called atread.sh:
ANSWER
Answered 2022-Mar-22 at 20:58Socats address parser interpretes a few characters specially, these are for example:
QUESTION
I compiled dpdk 19.11.11 version to test l3fwd-acl. After starting it in a VirtualBox instance with 2 CPUs and 2 ports I have used 2 TAP interfaces to simulate 2 network interfaces for putting traffic over one and getting that back over another. I have used the following command (and get the following output):
...ANSWER
Answered 2022-Mar-09 at 07:45L3fwd-acl works with IP packets only, for all non IP packets it drops. Hence with TAP PMD I had to follow the changes as
- Disable any NIC PCIe device using
--no-pci
- Use new commands as
sudo ./build/l3fwd-acl --file-prefix=mytest -l 2-4 --vdev=net_tap0 --vdev=net_tap1 --no-pci -- -P -p 3 --config="(0,0,4),(1,0,3)" --rule_ipv4=ipv4-sample.db --rule-ipv6=ipv6-sample.db --eth-dest=0, --eth-dest=1,
- edit ip-sample.db file with the entries to be assigned for
dtap0 and dtap1
. - refer section 24.1.3 to identify the format and for default drop rule
- start the application and use the following netns commands.
QUESTION
I created a serial port by using socat PTY,link=/tmp/ttys0,raw,echo=0 PTY,link=/tmp/ttys1,raw,echo=0 &
I think it created 2 PTY under /dev and let /tmp/ttys0 and /tmp/ttys1 pointing to them.
% ls -ltr /tmp/
lrwxr-xr-x 1 hankboyu wheel 12 Mar 1 13:22 ttys0 -> /dev/ttys009
lrwxr-xr-x 1 hankboyu wheel 12 Mar 1 13:22 ttys1 -> /dev/ttys010
Now I want to change the baud rate of the serial ports from default value 9600 to 115200, how do I do that?
Also, do I need to change the baud rate on all 4 file descriptors?
The virtual serial port was created for 2 micro-services to communicates with each other, each micro-service listens on different PTY.
...ANSWER
Answered 2022-Mar-02 at 11:46You may apply Socat option b115200 when creating the PTYs.
With something like
stty -f /dev/ttys009 115200
it might be possible to change the speed afterwards.
QUESTION
I am using Windows10 WSL2
(running with Ubuntu v20
) with VSCode
.
I want to send GPG-signed Git Commit to GitHub
in VSCode Dev Container.
I try with the setup like below:
Install Gpg4win in Windows
install packages in
WSL2
ANSWER
Answered 2022-Feb-17 at 13:28It turns out I should not install gnupg2
in my Dev Container instance
.
QUESTION
I have an embedded linux system running a tcp server. Telnet can connect to and use the tcp server interactively just fine.
I am trying to use socat to make the same connection, by linking stdin to the tcp server, like so:
socat - tcp:localhost:8088
I get the initial response from the server, and I can type, but as soon as I press enter, the terminal hangs (I can get out of this with Ctrl + C as long as I am not using the raw socat option.)
If I do the same thing but with readline, everything mostly works as expected:
socat readline tcp:localhost:8088
However, with readline, the terminal echoes my input, and then the response from the server also echoes it. This is more than just an annoyance, since things like passwords (which should not even be echoed once) are now visible.
Ideally, I would just use stdin instead of readline, so that I could send each character as soon as I type it, and turn off stdin echo. That way, when I type a character, the tcp server receives it and echoes it immediately, but only if it is supposed to.
But socat is hanging with the stdin option for reasons I don't understand.
I'm looking for an explanation as to why stdin is locking up the thread, or a workaround possibly using readline or similar.
EDIT: Here is the dddd debug output from the socat command when I use stdin:
sh-5.0# socat -d -d -d -d -lu - tcp:localhost:8088
2022/02/04 01:34:58.805536 socat[1074] D getpid()
2022/02/04 01:34:58.807631 socat[1074] D getpid() -> 1074
2022/02/04 01:34:58.807667 socat[1074] D setenv("SOCAT_PID", "1074", 1)
2022/02/04 01:34:58.807687 socat[1074] D setenv() -> 0
2022/02/04 01:34:58.807704 socat[1074] D setenv("SOCAT_PPID", "1074", 1)
2022/02/04 01:34:58.807724 socat[1074] D setenv() -> 0
2022/02/04 01:34:58.807737 socat[1074] I socat by Gerhard Rieger and contributors - see www.dest-unreach.org
2022/02/04 01:34:58.807752 socat[1074] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2022/02/04 01:34:58.807767 socat[1074] I This product includes software written by Tim Hudson (tjh@cryptsoft.com)
2022/02/04 01:34:58.807781 socat[1074] D socat version 1.7.3.3 on May 25 2021 13:47:29
2022/02/04 01:34:58.807795 socat[1074] D setenv("SOCAT_VERSION", "1.7.3.3", 1)
2022/02/04 01:34:58.807811 socat[1074] D setenv() -> 0
2022/02/04 01:34:58.807827 socat[1074] D running on Linux version #1 SMP Mon Jan 31 20:48:32 UTC 2022, release 5.4.0, machine aarch64
2022/02/04 01:34:58.807845 socat[1074] D argv[0]: "socat"
2022/02/04 01:34:58.807857 socat[1074] D argv[1]: "-d"
2022/02/04 01:34:58.807870 socat[1074] D argv[2]: "-d"
2022/02/04 01:34:58.807883 socat[1074] D argv[3]: "-d"
2022/02/04 01:34:58.807895 socat[1074] D argv[4]: "-d"
2022/02/04 01:34:58.807907 socat[1074] D argv[5]: "-lu"
2022/02/04 01:34:58.807920 socat[1074] D argv[6]: "-"
2022/02/04 01:34:58.807932 socat[1074] D argv[7]: "tcp:localhost:8088"
2022/02/04 01:34:58.807945 socat[1074] D sigaction(1, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.807960 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.807973 socat[1074] D sigaction(2, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.807987 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808000 socat[1074] D sigaction(3, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808014 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808026 socat[1074] D sigaction(4, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808040 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808053 socat[1074] D sigaction(6, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808067 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808079 socat[1074] D sigaction(7, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808092 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808105 socat[1074] D sigaction(8, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808119 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808132 socat[1074] D sigaction(11, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808146 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808158 socat[1074] D sigaction(15, 0xffffc8d63a18, 0x0)
2022/02/04 01:34:58.808172 socat[1074] D sigaction() -> 0
2022/02/04 01:34:58.808185 socat[1074] D signal(13, 0x1)
2022/02/04 01:34:58.808200 socat[1074] D signal() -> 0x0
2022/02/04 01:34:58.808213 socat[1074] D atexit(0xaaaaba73c4a0)
2022/02/04 01:34:58.808226 socat[1074] D atexit() -> 0
2022/02/04 01:34:58.808267 socat[1074] D calloc(1, 848)
2022/02/04 01:34:58.808284 socat[1074] D calloc() -> 0xaaaadd2cc680
2022/02/04 01:34:58.808304 socat[1074] D malloc(1024)
2022/02/04 01:34:58.808318 socat[1074] D malloc() -> 0xaaaadd2cca00
2022/02/04 01:34:58.808333 socat[1074] D calloc(1, 848)
2022/02/04 01:34:58.808350 socat[1074] D calloc() -> 0xaaaadd2cce10
2022/02/04 01:34:58.808364 socat[1074] D calloc(1, 848)
2022/02/04 01:34:58.808377 socat[1074] D calloc() -> 0xaaaadd2cd170
2022/02/04 01:34:58.808391 socat[1074] D isatty(0)
2022/02/04 01:34:58.808411 socat[1074] D isatty() -> 1
2022/02/04 01:34:58.808424 socat[1074] D tcgetattr(0, 0xaaaadd2ccf6c)
2022/02/04 01:34:58.808461 socat[1074] D tcgetattr(, {00005400,00000005,00001cb2,0000083b, 4098,4098, 03,1c,7f,15,04,00,01,00,11,13,1a,00,12,0f,17,16,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00}) -> 0
2022/02/04 01:34:58.808480 socat[1074] D isatty(1)
2022/02/04 01:34:58.808494 socat[1074] D isatty() -> 1
2022/02/04 01:34:58.808507 socat[1074] D tcgetattr(1, 0xaaaadd2cd2cc)
2022/02/04 01:34:58.808542 socat[1074] D tcgetattr(, {00005400,00000005,00001cb2,0000083b, 4098,4098, 03,1c,7f,15,04,00,01,00,11,13,1a,00,12,0f,17,16,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00}) -> 0
2022/02/04 01:34:59.141868 socat[1074] D malloc(128)
2022/02/04 01:34:59.141888 socat[1074] D malloc() -> 0xaaaadd2cd4d0
2022/02/04 01:34:59.141903 socat[1074] D malloc(128)
2022/02/04 01:34:59.141916 socat[1074] D malloc() -> 0xaaaadd2cd560
2022/02/04 01:34:59.141931 socat[1074] N reading from and writing to stdio
2022/02/04 01:34:59.141946 socat[1074] D calloc(1, 848)
2022/02/04 01:34:59.141959 socat[1074] D calloc() -> 0xaaaadd2cd5f0
2022/02/04 01:34:59.141983 socat[1074] D malloc(1024)
2022/02/04 01:34:59.141997 socat[1074] D malloc() -> 0xaaaadd2cd9b0
2022/02/04 01:34:59.142015 socat[1074] D getaddrinfo("localhost", NULL, {1,0,1,6,0,0x0,0x0,0x0}, 0xffffc8d63538)
2022/02/04 01:34:59.142789 socat[1074] D getaddrinfo(,,,{{AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:0, }) -> 0
2022/02/04 01:34:59.142815 socat[1074] D malloc(128)
2022/02/04 01:34:59.142830 socat[1074] D malloc() -> 0xaaaadd2ce610
2022/02/04 01:34:59.142847 socat[1074] N opening connection to AF=2 127.0.0.1:8088
2022/02/04 01:34:59.142861 socat[1074] I starting connect loop
2022/02/04 01:34:59.142876 socat[1074] D socket(2, 1, 6)
2022/02/04 01:34:59.142900 socat[1074] I socket(2, 1, 6) -> 5
2022/02/04 01:34:59.142919 socat[1074] D fcntl(5, 2, 1)
2022/02/04 01:34:59.142935 socat[1074] D fcntl() -> 0
2022/02/04 01:34:59.142954 socat[1074] D connect(5, {2,AF=2 127.0.0.1:8088}, 16)
2022/02/04 01:34:59.145199 socat[1074] D connect() -> 0
2022/02/04 01:34:59.145246 socat[1074] D getsockname(5, 0xffffc8d635b8, 0xffffc8d6359c{112})
2022/02/04 01:34:59.145269 socat[1074] D getsockname(, {AF=2 127.0.0.1:46294}, {16}) -> 0
2022/02/04 01:34:59.145286 socat[1074] N successfully connected from local address AF=2 127.0.0.1:46294
2022/02/04 01:34:59.145306 socat[1074] I resolved and opened all sock addresses
2022/02/04 01:34:59.145321 socat[1074] D malloc(16385)
2022/02/04 01:34:59.145344 socat[1074] D malloc() -> 0xaaaadd2cf400
2022/02/04 01:34:59.145360 socat[1074] N starting data transfer loop with FDs [0,1] and [5,5]
2022/02/04 01:34:59.145375 socat[1074] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2022/02/04 01:34:59.145395 socat[1074] D select(6, &0x21, &0x22, &0x0, NULL/0.000000)
2022/02/04 01:34:59.145426 socat[1074] D select -> (, 0x0, 0x20, 0x0, NULL/0.000000), 1
2022/02/04 01:34:59.145443 socat[1074] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2022/02/04 01:34:59.145461 socat[1074] D select(6, &0x21, &0x2, &0x0, NULL/0.000000)
2022/02/04 01:34:59.157132 socat[1074] D select -> (, 0x20, 0x0, 0x0, NULL/0.000000), 1
2022/02/04 01:34:59.157178 socat[1074] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2022/02/04 01:34:59.157198 socat[1074] D select(2, &0x1, &0x2, &0x0, NULL/0.000000)
2022/02/04 01:34:59.401692 socat[1074] D select -> (, 0x0, 0x2, 0x0, NULL/0.000000), 1
2022/02/04 01:34:59.401732 socat[1074] D read(5, 0xaaaadd2cf400, 8192)
2022/02/04 01:34:59.401765 socat[1074] D read -> 48
2022/02/04 01:34:59.401782 socat[1074] D write(1, 0xaaaadd2cf400, 48)
ÿûÿû
Connect to IP address 169.254.12.16
2022/02/04 01:34:59.401809 socat[1074] D write -> 48
2022/02/04 01:34:59.401823 socat[1074] I transferred 48 bytes from 5 to 1
2022/02/04 01:34:59.401838 socat[1074] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2022/02/04 01:34:59.401856 socat[1074] D select(6, &0x21, &0x2, &0x0, NULL/0.000000)
2022/02/04 01:34:59.462969 socat[1074] D select -> (, 0x0, 0x2, 0x0, NULL/0.000000), 1
2022/02/04 01:34:59.463017 socat[1074] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2022/02/04 01:34:59.463036 socat[1074] D select(6, &0x21, &0x0, &0x0, NULL/0.000000)
At this point, I can still type, but no matter what I do, I get nothing in response.
...ANSWER
Answered 2022-Feb-09 at 00:04Probably it is not Socat that hangs but the server. Use options -v -x to see what data Socat transfers in both situations and compare; maybe there are different line termination characters involved.
QUESTION
Consider the following setup where one instance of socat pipes data from stdin
to a unix domain socket, and the other instance reads that data from the unix domain socket and writes it to stdout
:
Client:
...ANSWER
Answered 2022-Feb-06 at 14:15Upon further investigation of the man page, I learned that SOCK_SEQPACKET
is supported by socat
:
socktype= Sets the type of the socket, specified as second argument to the socket() or socketpair() calls, to [int]. Address resolution is not affected by this option. Under Linux, 1 means stream oriented socket, 2 means datagram socket, 3 means raw socket, and 5 seqpacket (stream keeping packet boundaries).
Client:
QUESTION
Is it possible to create a bidirectional UDP tunnel with socat? The starting point is a client (C) that communicates with a server (S) and receives a reply, so C⟷S. Of course, C and S are on different networks with a relay (R) between them, hence the need for C⟷R⟷S. The relay is running Ubuntu Linux.
Using socat for example per this:
sudo nohup socat UDP-LISTEN:1194,fork,reuseaddr UDP:IP-ADDRESS-OF-HOME-ROUTER:1194 &
apparently results in all packets received by the relay (R) to be forwarded to IP-ADDRESS-OF-HOME-ROUTER
, including the reply packets from the server, or C⟶R⟷S.
So my question is, would it be possible to make socat wait for reply packets from the server, and forward them back to the client? Is there perhaps another way to accomplish this goal?
...ANSWER
Answered 2022-Jan-24 at 10:20The second method (datagram with UDP-RECVFROM/UDP-SENDTO) works only in a query/answer mode; a second answer in sequence from the OpenVPN server will not be passed back to the client; and for each query packet a sub process will be forked.
The first method forks a subprocess per "connection" (determined by source port), and - after an initial packet from the client - forwards in both directions. Sub processes will hang "forever", so it is advisable to use the timeout option -T 3600 or so.
QUESTION
I have an application that is running in Docker configured with an NGINX reverse proxy. The application is a binary, I don't have source code and there's no way to modify the header of an HTTP request from the app itself. My goal is to append a header field before the request is dispatched out of the host machine:
...ANSWER
Answered 2021-Nov-09 at 08:52You could use Traefik reverse proxy v2.4+ with Traefik Pilot enabled and a plugin like Header transformation.
You run Traefik as a container which routes the traffic to the other containers. You can then link your instance to Traefik Pilot using a token, which enables plugins. If you use labels in a docker-compose.yml file:
QUESTION
I have an interesting problem that I have a reproducer for. Using a container to compartmentalize this system and make it reproducible, I can have it run successfully on my powerful laptop, but when running on a slow raspberry Pi it fails.
...ANSWER
Answered 2022-Jan-03 at 16:42I have discovered that service
has an interesting "feature":
QUESTION
I'm trying to receive dhcp6 messages in rust. This is the code I have right now:
...ANSWER
Answered 2022-Jan-02 at 11:40The problem was the following line:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install socat
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page