本文使用的 socat 是打过 socks5 支持补丁的版本
使用下载工具( 迅雷 )下载源码:
https://github.com/runsisi/socat.git
得到socat-master.zip,解压
我是解压到这里: C:\cygwin64\home\Administrator\socat-master
C:\cygwin64\home\Administrator\socat-master
cygwin64需要这些依赖: make,gcc-core , gcc-g++ ,libgcc1, libgccpp1, pkg-config
参考:ygwin 编译redis源码生成 window版 x86_64 下使用的 redis 6.2.6_s5629068的博客-CSDN博客_cygwin 编译redis https://blog.csdn.net/s5629068/article/details/124402317
http://www.cygwin.com/setup-x86_64.exe
http://www.cygwin.com/setup-x86_64.exe
autoconf
./configure --prefix=/usr/local/bin
#为了不报错需要如下两条命令 绕过 生成帮助手册:
ln /usr/bin/echo /usr/bin/yodl2man
ln /usr/bin/echo /usr/bin/yodl2html
make
make install
Administrator@lvB ~
$ /usr/local/bin/bin/socat -hhh | grep -C2 socks
socket-recvfrom:<domain>:<type>:<protocol>:<local-address> groups=FD,SOCKET,CHILD,RANGE
socket-sendto:<domain>:<type>:<protocol>:<remote-address> groups=FD,SOCKET
socks is an alias name for socks4
socks4:<socks-server>:<host>:<port> groups=FD,SOCKET,CHILD,RETRY,IP4,IP6,TCP,SOCKS4
socks4a:<socks-server>:<host>:<port> groups=FD,SOCKET,CHILD,RETRY,IP4,IP6,TCP,SOCKS4
socks5:<socks-server>:<host>:<port> groups=FD,SOCKS5,SOCKET,CHILD,RETRY,IP4,IP6,TCP
socks5-client is an alias name for socks5
stderr groups=FD,FIFO,BLK,REG,SOCKET,TERMIOS,UNIX,IP4,IP6,UDP,TCP,SCTP
stdin groups=FD,FIFO,BLK,REG,SOCKET,TERMIOS,UNIX,IP4,IP6,UDP,TCP,SCTP
--
sockopt-int is an alias for setsockopt-int
sockopt-string is an alias for setsockopt-string
socks5pass groups=SOCKS5 phase=SPECIFIC type=STRING
socks5port groups=SOCKS5 phase=SPECIFIC type=STRING
socks5user groups=SOCKS5 phase=SPECIFIC type=STRING
socksport groups=SOCKS4 phase=LATE type=STRING
socksuser groups=SOCKS4 phase=LATE type=STRING
socktype is an alias for so-type
sourceport groups=UDP,TCP,SCTP phase=LATE type=UNSIGNED-SHORT
Administrator@lvB ~
$
看到了 socks5port ,说明成功了
测试:
/usr/local/bin/bin/socat -v -d exec:'whoami',pty,stderr,setsid,sigint,sane SOCKS5:127.0.0.1:ncip_xx.xx.xx.xx:ncport_xx,socks5port=1080