socat安装使用方法

您所在的位置:网站首页 debian安装curl socat安装使用方法

socat安装使用方法

#socat安装使用方法| 来源: 网络整理| 查看: 265

socat,一个多功能的网络工具,名字来源于SOcket CAT,是netcat的增强版,也就是netcat++(扩展了设计,并有新的实现)。

推荐:socat官方文档以及 socat - Handling all Kinds of Sockets (pdf)

------------------------------------------------------------------------

0x01 安装

# debian/ubuntu apt-get install socat # centos/redhat yum install -y socat

 

0x02 通过源码安装

在centos或者redhat通过yum安装后的socat,运行报错:

E parseopts(): unknown option "tcpwrap"

这里是版本没编译进去tcpwrap,先卸载当前socat后,再进行源码编译安装:

(目前最新版本是1.7.3.3)

yum install -y tcp_wrappers tcp_wrappers-devel readline-devel openssl-devel yum install -y gcc v=1.7.3.3 wget http://www.dest-unreach.org/socat/download/socat-${v}.tar.gz tar zxvf socat-${v}.tar.gz cd socat-${v} ./configure make && make install

 

0x03 windows版socat

git clone https://github.com/StudioEtrange/socat-windows

(暂时不推荐用,存在各种问题)

 

0x04 fork EXEC

将一个使用标准输入输出的单进程程序变为一个使用fork方法的多进程服务

socat TCP4-LISTEN:2333,tcpwrap=script,reuseaddr,fork EXEC:"/usr/bin/env python2 -u pcat.py"

(其中TCP4-LISTEN可简写为tcp-l,而python -u表示输出不缓存)

 

0x05 其他

socat的用途很多,可参见开头列举的文档以及pdf,以后pcat有空再补充。



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3