概述
ProxyChains
是一个Linux
和Unix
下的代理工具,允许TCP
和DNS
通过代理隧道,支持HTTP
、SOCKS4
、SOCKS5
类型的代理服务器,且可配置多个代理。
ProxyChains
通过用户自定义的代理列表强制连接指定的应用程序。
本文简述Linux
下如何通过ProxyChains
使用Clash
主机代理。
相关资料
GitHub项目地址
ProxyChains
:haad/proxychains: proxychains - a tool that forces any TCP connection made by any given application to follow through proxy like TOR or any other SOCKS4, SOCKS5 or HTTP(S) proxy. Supported auth-types: “user/pass” for SOCKS4/5, “basic” for HTTP. (github.com)
ProxyChains-ng
:rofl0r/proxychains-ng: proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
安装ProxyChains4
kali
默认预装proxychains4
,其它基于Debian
的Linux
发行版可通过如下命令安装:
1
| apt-get install proxychains4
|
或者
1
| apt-get install proxychains
|
文件配置
1
| vim /etc/proxychains4.conf
|
如果刚刚是用apt-get install proxychains
安装的话就是修改:
1
| vim /etc/proxychains.conf
|
取消dynamic_chain
的注释,也可以注释掉strict_chain
:
注:请在代理软件上勾选允许本地网络连接
选项。
在这个配置文件最下面有[ProxyList]这么一行,在这行下面添加上:
如果有别的比如socks4 127.0.0.1 9050
那么就把它给注释掉。
重启,若要在代理下使用某条命令,则
即可在proxychains代理规则下启动。
比如说使用curl的时候用代理:
1
| proxychains curl -fsSL https://get.docker.com | sh
|
例如使用snap的时候用代理:
1 2 3 4 5 6
| root@raspberrypi:~# proxychains snap install docker [proxychains] config file found: /etc/proxychains4.conf [proxychains] preloading /usr/lib/aarch64-linux-gnu/libproxychains.so.4 [proxychains] DLL init: proxychains-ng 4.16 [proxychains] DLL init: proxychains-ng 4.16 Download snap "docker" (1783) from channel
|
测试网络: