美文网首页
使用proxychain4进行终端代理

使用proxychain4进行终端代理

作者: 遂夜吟秋细雨 | 来源:发表于2022-11-06 23:06 被阅读0次

使用proxychain4进行终端代理

引言(introduction)

在日常工作生活中,经常遇到使用 wget或者 git时,下载文件且文件在国内下载慢甚至不能下载的情况,需要在终端使用代理。发现proxychains很方便好用。

proxychains

我们可以从github仓库看到关于proxychains的介绍:

ProxyChains is a UNIX program, that hooks network-related libc functions in DYNAMICALLY LINKED programs via a preloaded DLL (dlsym(), LD_PRELOAD) and redirects the connections through SOCKS4a/5 or HTTP proxies.

It supports TCP only (no UDP/ICMP etc).

The way it works is basically a HACK; so it is possible that it doesn't work with your program, especially when it's a script, or starts numerous processes like background daemons or uses dlopen() to load "modules" (bug in glibc dynlinker).

It should work with simple compiled (C/C++) dynamically linked programs though.

If your program doesn't work with proxychains, consider using an iptables based solution instead; this is much more robust.

Supported Platforms: Linux, BSD, Mac, Haiku.

安装

sudo apt install proxychains4 

配置

vim /etc/proxychains4.conf

网上有些博文写的 proxychains4/etc/proxychains4.conf
当然是可以的,但就直接 /etc/proxychains.conf 也会生效。
甚至两个文件都存在的时候 proxychains.conf 的优先级比 proxychains4.conf 高。

中间都不用管,直接拉到最后:

[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4         127.0.0.1 9050
socks5         [子网IP] [socket端口]

测试

$ curl www.httpbin.org/ip
$ proxychains4 curl www.httpbin.org/ip

接口返回的两个本机IP不一致,说明开启代理成功了。

使用

例如使用git克隆一个较大的仓库,在原本输入的命令前加入proxychain4即可

❯ proxychains4 git clone https://github.com/haad/proxychains.git

参考文档

使用proxychain4安装zsh

相关文章

  • Mac终端代理和git代理设置

    Mac终端代理设置 使用的s s代理 1.临时代理在终端中输入 这是代理本身走的https/http或者 这是代理...

  • MAC下设置Iterm2代理进行加速

    如果你有ssr,默认是只能浏览器走代理,但是某些情况下我们需要让终端使用代理进行加速(wget,git,curl,...

  • 终端使用SS代理

    shadowsocks设置为: 以zsh作为说明 添加如下代理配置: :wq保存退出 使用proxy前先查看下当前...

  • MacOS终端使用代理

    今天安装Homebrew时下载相关组件非常慢,并且Homebrew使用的镜像国内网络也难以访问。有两种方法可以解决...

  • 终端无法使用代理

    这种情况在win10和macOS上都有出现,macOS是在SIP系统完整性保护出现后的系统版本会无法进行,wind...

  • Mac终端使用代理

    1.打开梯子 2.在.zshrc中设置 export http_proxy=socks5://127.0.0.1:...

  • Proxychains笔记

    背景 使用 Ubuntu,想在终端使用代理服务器,改了系统代理却没丝毫影响?试看看 Proxychains 吧~ ...

  • Flutter Exception: Pub will wait

    问题 上传自己写的包到 pub 报错。 解决方法 1). 设置终端代理(一定要是终端代理) 2). 使用curl ...

  • Mac 终端下使用SS代理

    虽然Mac下挂了SS,但是使用终端访问一下国外的网站的时候还是无法通过SS代理进行,这时候需要只需要在当前终端下输...

  • 解决pod,homebrew,github等速度过慢问题

    1.设置终端代理: 设置成功之后就可以了。2.取消终端代理 另外全局终端代理 取消终端代理 解决前后对比

网友评论

      本文标题:使用proxychain4进行终端代理

      本文链接:https://www.haomeiwen.com/subject/xlgitdtx.html