proxychains-ng配置终端下代理
终端下git和下载一些资料,没有代理的时候,特别的基本以失败告终。 试了好几个工具,都不是很理想,还是老工具proxychains-ng好用,安装和配置都方便,强烈推荐。
一、下载proxychains-ng
目前proxychains-ng最新版本是4.16,官方下载地址为proxychains-ng4.16
然后进行解压:
$ tar -xvf proxychains-ng-4.16.tar.xz
proxychains-ng-4.16/
proxychains-ng-4.16/tests/
proxychains-ng-4.16/tests/test_getnameinfo.c
proxychains-ng-4.16/tests/test_proxy_gethostbyname.c
proxychains-ng-4.16/tests/test_gethostent.c
proxychains-ng-4.16/tests/test_shm.c
proxychains-ng-4.16/tests/test_sendto.c
proxychains-ng-4.16/tests/test_gethostbyname.c
proxychains-ng-4.16/tests/test_getaddrinfo.c
proxychains-ng-4.16/tests/test_v4_in_v6.c
proxychains-ng-4.16/tests/test_gethostent_r.c
proxychains-ng-4.16/configure
proxychains-ng-4.16/tools/
proxychains-ng-4.16/tools/version.sh
proxychains-ng-4.16/tools/install.sh
proxychains-ng-4.16/TODO
proxychains-ng-4.16/src/
proxychains-ng-4.16/src/debug.c
proxychains-ng-4.16/src/common.h
proxychains-ng-4.16/src/proxychains.conf
proxychains-ng-4.16/src/hash.c
proxychains-ng-4.16/src/debug.h
proxychains-ng-4.16/src/ip_type.h
二、编译
配置
$ ./configure --prefix=/usr --sysconfdir=/etc checking whether C compiler works ... yes checking whether we have GNU-style getservbyname_r() ... yes checking whether we have pipe2() and O_CLOEXEC ... yes checking whether we have SOCK_CLOEXEC ... yes checking whether we have clock_gettime ... yes checking whether $CC defines __APPLE__ ... no checking whether $CC defines __FreeBSD__ ... no checking whether $CC defines __OpenBSD__ ... no checking whether $CC defines __sun ... no checking whether $CC defines __HAIKU__ ... no checking whether we can use -Wl,--no-as-needed ... yes checking what's the option to use in linker to set library name ... --soname checking checking whether we can use -ldl ... yes checking checking whether we can use -lpthread ... yes Done, now run make && make install
编译
$ make
printf '#define VERSION "%s"\n' "$(sh tools/version.sh)" > src/version.h
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/version.o src/version.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/core.o src/core.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/common.o src/common.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/libproxychains.o src/libproxychains.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/allocator_thread.o src/allocator_thread.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/rdns.o src/rdns.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/hostsreader.o src/hostsreader.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/hash.o src/hash.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/debug.o src/debug.c
cc -fPIC -Wl,--no-as-needed -ldl -lpthread -Wl,--soname,libproxychains4.so \
-shared -o libproxychains4.so src/version.o src/core.o src/common.o src/libproxychains.o src/allocator_thread.o src/rdns.o src/hostsreader.o src/hash.o src/debug.o
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/main.o src/main.c
cc src/common.o src/main.o -ldl -o proxychains4
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/daemon/hsearch.o src/daemon/hsearch.c
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/daemon/sblist.o src/daemon/sblist.c
In file included from src/daemon/sblist.c:3:0:
src/daemon/sblist.h:90:0: warning: ignoring #pragma RcB2 DEP [-Wunknown-pragmas]
#pragma RcB2 DEP "sblist.c" "sblist_delete.c"
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/daemon/sblist_delete.o src/daemon/sblist_delete.c
In file included from src/daemon/sblist_delete.c:1:0:
src/daemon/sblist.h:90:0: warning: ignoring #pragma RcB2 DEP [-Wunknown-pragmas]
#pragma RcB2 DEP "sblist.c" "sblist_delete.c"
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/daemon/daemon.o src/daemon/daemon.c
src/daemon/daemon.c:8:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
<command-line>:0:0: note: this is the location of the previous definition
In file included from src/daemon/daemon.c:20:0:
src/daemon/udpserver.h:11:0: warning: ignoring #pragma RcB2 DEP [-Wunknown-pragmas]
#pragma RcB2 DEP "udpserver.c"
In file included from src/daemon/daemon.c:21:0:
src/daemon/sblist.h:90:0: warning: ignoring #pragma RcB2 DEP [-Wunknown-pragmas]
#pragma RcB2 DEP "sblist.c" "sblist_delete.c"
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DLIB_DIR=\"/usr/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\" -fPIC -c -o src/daemon/udpserver.o src/daemon/udpserver.c
In file included from src/daemon/udpserver.c:1:0:
src/daemon/udpserver.h:11:0: warning: ignoring #pragma RcB2 DEP [-Wunknown-pragmas]
#pragma RcB2 DEP "udpserver.c"
cc src/daemon/hsearch.o src/daemon/sblist.o src/daemon/sblist_delete.o src/daemon/daemon.o src/daemon/udpserver.o -o proxychains4-daemon
- 安装
$ sudo make install
[sudo] password for bytetoy:
./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so
./tools/install.sh -D -m 755 proxychains4 /usr/bin/proxychains4
./tools/install.sh -D -m 755 proxychains4-daemon /usr/bin/proxychains4-daemon
三、配置&测试
将源码(src)目录下的proxychains.conf文件复制到用户目录的的.config目录下,同时添加代理的ip和端口。
- 配置
[ProxyList] # add proxy here ... # meanwile # defaults set to "tor" http 127.0.0.1 7890
- 测试
./proxychains4 -f ~/.config/proxychains.conf curl -i www.google.com 80 [proxychains] config file found: /home/bytetoy/.config/proxychains.conf [proxychains] preloading ./libproxychains4.so [proxychains] DLL init: proxychains-ng 4.16 [proxychains] Strict chain ... 127.0.0.1:7890 ... www.google.com:80 ... OK HTTP/1.1 200 OK Date: Mon, 18 Dec 2023 01:55:00 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-22YkdFi_V8FF2PImpIa2rA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
四、下载youtube视频
- 配置alias
使用命令+配置文件既长且复杂,可以在.bashrc配置一个别名
alias proxychain='/home/bytetoy/apps/proxychains-ng-4.16/proxychains4 -f ~/.config/proxychains.conf'
- 下载youtube视频
proxychain you-get https://www.youtube.com/watch?v=Dx_A1Hu20cI&list=PLYhOT2FBuEidYOFh0f7EsmmhPMk0K0CRk [1] 11803 bytetoy@aml:~/ustore/video$ [proxychains] config file found: /home/bytetoy/.config/proxychains.conf [proxychains] preloading /home/bytetoy/apps/proxychains-ng-4.16/libproxychains4.so [proxychains] DLL init: proxychains-ng 4.16 [proxychains] DLL init: proxychains-ng 4.16 [proxychains] Strict chain ... 127.0.0.1:7890 ... www.youtube.com:443 ... OK [proxychains] Strict chain ... 127.0.0.1:7890 ... www.youtube.com:443 ... OK [proxychains] Strict chain ... 127.0.0.1:7890 ... rr1---sn-i3b7knsl.googlevideo.com:443 ... OK [proxychains] Strict chain ... 127.0.0.1:7890 ... rr5---sn-i3belne6.googlevideo.com:443 ... OK [proxychains] Strict chain ... 127.0.0.1:7890 ... rr5---sn-npoe7ner.googlevideo.com:443 ... OK site: YouTube title: 20130125【我是歌手】羽泉 《燭光裡的媽媽》