Linux配置proxychains-ng

2023-10-07 03:52
文章标签 配置 linux proxychains ng

本文主要是介绍Linux配置proxychains-ng,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

    • 具体步骤
      • 编译安装proxychains-ng
      • 遇到的问题debug过程
      • 修改 proxychains.conf文件
      • 使用 proxychains4
    • 参考

具体步骤

编译安装proxychains-ng

https://github.com/rofl0r/proxychains-ng是用来让命令行被代理转发的。

使用git下载proxychains-ng的源码,不过我的服务器有问题,下载不了。

git clone https://github.com/rofl0r/proxychains-ng

所以本地电脑下载之后,手动上传到服务器。
在这里插入图片描述
然后按照如下的命令操作:如果没有遇到问题即可正常使用,而我用的时候会有问题,具体请参加下面的debug过程。

$ cd proxychains-ng
$ ./configure --prefix=/usr --sysconfdir=/etc 
$ make 
$ make install 
$ make install-config #(安装proxychains.conf配置文件)

遇到的问题debug过程

遇到问题bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

(base) lishizheng@dell-PowerEdge-T640:~$ cd proxychains-ng/
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ ls
AUTHORS  completions  configure  COPYING  Makefile  README  src  tests  TODO  tools  VERSION
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ ./configure --prefix=/usr --sysconfdir=/etc 
bash: ./configure: Permission denied
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ chmod +x configure 
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ ls
AUTHORS  completions  configure  COPYING  Makefile  README  src  tests  TODO  tools  VERSION
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ ./configure --prefix=/usr --sysconfdir=/etc 
bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

这个问题的解决方法是:使用vim打开configure文件,然后设置ff=unix,如下所示:

vim configure
:set ff=unix
:wq

然后再执行,便不会报错

(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ ./configure --prefix=/usr --sysconfdir=/etc
checking whether C compiler works ... yes
checking whether libc headers are complete ... yes
checking whether C compiler understands -Wno-unknown-pragmas ... yes
checking whether getnameinfo() servlen argument is POSIX compliant (socklen_t) ... 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: execvp: ./tools/install.sh: Permission denied

(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ make install
./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so
make: execvp: ./tools/install.sh: Permission denied
make: *** [Makefile:68: /usr/lib/libproxychains4.so] Error 127
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ sudo make install
./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so
make: execvp: ./tools/install.sh: Permission denied
make: *** [Makefile:68: /usr/lib/libproxychains4.so] Error 127

需要进入tools文件,修改install.sh的权限

(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ cd tools/
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ ls
install.sh  version.sh
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ ./install.sh
bash: ./install.sh: Permission denied
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ chmod +x install.sh 
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ ls
install.sh  version.sh
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ ./install.sh 
bash: ./install.sh: /bin/sh^M: bad interpreter: No such file or directory
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ vim install.sh 

然后还是会报错:bash: ./install.sh: /bin/sh^M: bad interpreter: No such file or directory
这个处理方法和上述相同

vim install.sh
:set ff=unix
:wq

然后执行sudo make install 和sudo make install-config成功:

(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng/tools$ cd ..
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ make install
./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so
./tools/install.sh: 53: cannot create /usr/lib/libproxychains4.so.tmp.3951176: Permission denied
make: *** [Makefile:68: /usr/lib/libproxychains4.so] Error 2
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ sudo make install
./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
(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ sudo make install-config 
./tools/install.sh -D -m 644 src/proxychains.conf /etc/proxychains.conf

修改 proxychains.conf文件

修改配置文件/etc/proxychains.conf,

vim /etc/proxychains.conf

划到最下边,删掉socks4 127.0.0.1 9050,只留下如下所示的两个端口7891和7890(Clash的默认端口)

[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5 127.0.0.1 7891
http 127.0.0.1 7890

遇到问题:"/etc/proxychains.conf" E212: Can't open file for writing
使用sudo打开:

(base) lishizheng@dell-PowerEdge-T640:~/proxychains-ng$ sudo vim /etc/proxychains.conf 

使用 proxychains4

具体使用过程

proxychains4 命令

例如,使用proxychains4获取google.com中的index.html文件

proxychains4 wget google.com

测试成功,如下图所示

在这里插入图片描述

如下所示:

(base) lishizheng@dell-PowerEdge-T640:~/clash$ proxychains4 wget google.com
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 
--2023-10-06 19:24:06--  http://google.com/
Resolving google.com (google.com)... 224.0.0.1
Connecting to google.com (google.com)|224.0.0.1|:80... [proxychains] Strict chain  ...  127.0.0.1:7891  ...  127.0.0.1:7890  ...  google.com:80  ...  OK
connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2023-10-06 19:24:06--  http://www.google.com/
Resolving www.google.com (www.google.com)... 224.0.0.2
Connecting to www.google.com (www.google.com)|224.0.0.2|:80... [proxychains] Strict chain  ...  127.0.0.1:7891  ...  127.0.0.1:7890  ...  www.google.com:80  ...  OK
connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1696591476977669&usg=AOvVaw1IrIjXocluk8b0_w1FDsy4 [following]
--2023-10-06 19:24:06--  http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1696591476977669&usg=AOvVaw1IrIjXocluk8b0_w1FDsy4
Resolving www.google.com.hk (www.google.com.hk)... 224.0.0.3
Connecting to www.google.com.hk (www.google.com.hk)|224.0.0.3|:80... [proxychains] Strict chain  ...  127.0.0.1:7891  ...  127.0.0.1:7890  ...  www.google.com.hk:80  ...  OK
connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.com.hk/ [following]
--2023-10-06 19:24:07--  http://www.google.com.hk/
Reusing existing connection to www.google.com.hk:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’index.html                                           [ <=>                                                                                                    ]  17.63K  --.-KB/s    in 0.04s   2023-10-06 19:24:07 (410 KB/s) - ‘index.html’ saved [18057]

再例如,下载一个github仓库

(base) lishizheng@dell-PowerEdge-T640:~/code$ proxychains4 git clone https://github.com/shizhengLi/learning_python.git
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 
Cloning into 'learning_python'...
[proxychains] DLL init: proxychains-ng 
[proxychains] Strict chain  ...  127.0.0.1:7891  ...  127.0.0.1:7890  ...  github.com:443  ...  OK
[proxychains] DLL init: proxychains-ng 
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (21/21), done.
[proxychains] DLL init: proxychains-ng 
remote: Total 25 (delta 2), reused 15 (delta 0), pack-reused 0
Unpacking objects: 100% (25/25), 5.48 MiB | 5.07 MiB/s, done.
[proxychains] DLL init: proxychains-ng 

参考

[1] https://www.zanglikun.com/17437.html
[2] https://www.linuxprobe.com/proxychains-proxy.html
[3] https://askubuntu.com/questions/304999/not-able-to-execute-a-sh-file-bin-bashm-bad-interpreter

这篇关于Linux配置proxychains-ng的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/155860

相关文章

在Linux中改变echo输出颜色的实现方法

《在Linux中改变echo输出颜色的实现方法》在Linux系统的命令行环境下,为了使输出信息更加清晰、突出,便于用户快速识别和区分不同类型的信息,常常需要改变echo命令的输出颜色,所以本文给大家介... 目python录在linux中改变echo输出颜色的方法技术背景实现步骤使用ANSI转义码使用tpu

linux hostname设置全过程

《linuxhostname设置全过程》:本文主要介绍linuxhostname设置全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录查询hostname设置步骤其它相关点hostid/etc/hostsEDChina编程A工具license破解注意事项总结以RHE

SQL Server配置管理器无法打开的四种解决方法

《SQLServer配置管理器无法打开的四种解决方法》本文总结了SQLServer配置管理器无法打开的四种解决方法,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的... 目录方法一:桌面图标进入方法二:运行窗口进入检查版本号对照表php方法三:查找文件路径方法四:检查 S

Linux中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

Linux中SSH服务配置的全面指南

《Linux中SSH服务配置的全面指南》作为网络安全工程师,SSH(SecureShell)服务的安全配置是我们日常工作中不可忽视的重要环节,本文将从基础配置到高级安全加固,全面解析SSH服务的各项参... 目录概述基础配置详解端口与监听设置主机密钥配置认证机制强化禁用密码认证禁止root直接登录实现双因素

嵌入式数据库SQLite 3配置使用讲解

《嵌入式数据库SQLite3配置使用讲解》本文强调嵌入式项目中SQLite3数据库的重要性,因其零配置、轻量级、跨平台及事务处理特性,可保障数据溯源与责任明确,详细讲解安装配置、基础语法及SQLit... 目录0、惨痛教训1、SQLite3环境配置(1)、下载安装SQLite库(2)、解压下载的文件(3)、

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

Linux如何快速检查服务器的硬件配置和性能指标

《Linux如何快速检查服务器的硬件配置和性能指标》在运维和开发工作中,我们经常需要快速检查Linux服务器的硬件配置和性能指标,本文将以CentOS为例,介绍如何通过命令行快速获取这些关键信息,... 目录引言一、查询CPU核心数编程(几C?)1. 使用 nproc(最简单)2. 使用 lscpu(详细信

linux重启命令有哪些? 7个实用的Linux系统重启命令汇总

《linux重启命令有哪些?7个实用的Linux系统重启命令汇总》Linux系统提供了多种重启命令,常用的包括shutdown-r、reboot、init6等,不同命令适用于不同场景,本文将详细... 在管理和维护 linux 服务器时,完成系统更新、故障排查或日常维护后,重启系统往往是必不可少的步骤。本文

Nginx 重写与重定向配置方法

《Nginx重写与重定向配置方法》Nginx重写与重定向区别:重写修改路径(客户端无感知),重定向跳转新URL(客户端感知),try_files检查文件/目录存在性,return301直接返回永久重... 目录一.try_files指令二.return指令三.rewrite指令区分重写与重定向重写: 请求