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

相关文章

IDEA自动生成注释模板的配置教程

《IDEA自动生成注释模板的配置教程》本文介绍了如何在IntelliJIDEA中配置类和方法的注释模板,包括自动生成项目名称、包名、日期和时间等内容,以及如何定制参数和返回值的注释格式,需要的朋友可以... 目录项目场景配置方法类注释模板定义类开头的注释步骤类注释效果方法注释模板定义方法开头的注释步骤方法注

如何在Mac上安装并配置JDK环境变量详细步骤

《如何在Mac上安装并配置JDK环境变量详细步骤》:本文主要介绍如何在Mac上安装并配置JDK环境变量详细步骤,包括下载JDK、安装JDK、配置环境变量、验证JDK配置以及可选地设置PowerSh... 目录步骤 1:下载JDK步骤 2:安装JDK步骤 3:配置环境变量1. 编辑~/.zshrc(对于zsh

售价599元起! 华为路由器X1/Pro发布 配置与区别一览

《售价599元起!华为路由器X1/Pro发布配置与区别一览》华为路由器X1/Pro发布,有朋友留言问华为路由X1和X1Pro怎么选择,关于这个问题,本期图文将对这二款路由器做了期参数对比,大家看... 华为路由 X1 系列已经正式发布并开启预售,将在 4 月 25 日 10:08 正式开售,两款产品分别为华

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、

SQL server配置管理器找不到如何打开它

《SQLserver配置管理器找不到如何打开它》最近遇到了SQLserver配置管理器打不开的问题,尝试在开始菜单栏搜SQLServerManager无果,于是将自己找到的方法总结分享给大家,对SQ... 目录方法一:桌面图标进入方法二:运行窗口进入方法三:查找文件路径方法四:检查 SQL Server 安

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

SpringQuartz定时任务核心组件JobDetail与Trigger配置

《SpringQuartz定时任务核心组件JobDetail与Trigger配置》Spring框架与Quartz调度器的集成提供了强大而灵活的定时任务解决方案,本文主要介绍了SpringQuartz定... 目录引言一、Spring Quartz基础架构1.1 核心组件概述1.2 Spring集成优势二、J

Android Studio 配置国内镜像源的实现步骤

《AndroidStudio配置国内镜像源的实现步骤》本文主要介绍了AndroidStudio配置国内镜像源的实现步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,... 目录一、修改 hosts,解决 SDK 下载失败的问题二、修改 gradle 地址,解决 gradle

如何配置Spring Boot中的Jackson序列化

《如何配置SpringBoot中的Jackson序列化》在开发基于SpringBoot的应用程序时,Jackson是默认的JSON序列化和反序列化工具,本文将详细介绍如何在SpringBoot中配置... 目录配置Spring Boot中的Jackson序列化1. 为什么需要自定义Jackson配置?2.

Linux ls命令操作详解

《Linuxls命令操作详解》通过ls命令,我们可以查看指定目录下的文件和子目录,并结合不同的选项获取详细的文件信息,如权限、大小、修改时间等,:本文主要介绍Linuxls命令详解,需要的朋友可... 目录1. 命令简介2. 命令的基本语法和用法2.1 语法格式2.2 使用示例2.2.1 列出当前目录下的文