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

相关文章

windows和Linux使用命令行计算文件的MD5值

《windows和Linux使用命令行计算文件的MD5值》在Windows和Linux系统中,您可以使用命令行(终端或命令提示符)来计算文件的MD5值,文章介绍了在Windows和Linux/macO... 目录在Windows上:在linux或MACOS上:总结在Windows上:可以使用certuti

Linux之systemV共享内存方式

《Linux之systemV共享内存方式》:本文主要介绍Linux之systemV共享内存方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、工作原理二、系统调用接口1、申请共享内存(一)key的获取(二)共享内存的申请2、将共享内存段连接到进程地址空间3、将

SpringBoot3.4配置校验新特性的用法详解

《SpringBoot3.4配置校验新特性的用法详解》SpringBoot3.4对配置校验支持进行了全面升级,这篇文章为大家详细介绍了一下它们的具体使用,文中的示例代码讲解详细,感兴趣的小伙伴可以参考... 目录基本用法示例定义配置类配置 application.yml注入使用嵌套对象与集合元素深度校验开发

IntelliJ IDEA 中配置 Spring MVC 环境的详细步骤及问题解决

《IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决》:本文主要介绍IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决,本文分步骤结合实例给大... 目录步骤 1:创建 Maven Web 项目步骤 2:添加 Spring MVC 依赖1、保存后执行2、将新的依赖

快速修复一个Panic的Linux内核的技巧

《快速修复一个Panic的Linux内核的技巧》Linux系统中运行了不当的mkinitcpio操作导致内核文件不能正常工作,重启的时候,内核启动中止于Panic状态,该怎么解决这个问题呢?下面我们就... 感谢China编程(www.chinasem.cn)网友 鸢一雨音 的投稿写这篇文章是有原因的。为了配置完

SpringBoot基于配置实现短信服务策略的动态切换

《SpringBoot基于配置实现短信服务策略的动态切换》这篇文章主要为大家详细介绍了SpringBoot在接入多个短信服务商(如阿里云、腾讯云、华为云)后,如何根据配置或环境切换使用不同的服务商,需... 目录目标功能示例配置(application.yml)配置类绑定短信发送策略接口示例:阿里云 & 腾

如何为Yarn配置国内源的详细教程

《如何为Yarn配置国内源的详细教程》在使用Yarn进行项目开发时,由于网络原因,直接使用官方源可能会导致下载速度慢或连接失败,配置国内源可以显著提高包的下载速度和稳定性,本文将详细介绍如何为Yarn... 目录一、查询当前使用的镜像源二、设置国内源1. 设置为淘宝镜像源2. 设置为其他国内源三、还原为官方

CentOS7更改默认SSH端口与配置指南

《CentOS7更改默认SSH端口与配置指南》SSH是Linux服务器远程管理的核心工具,其默认监听端口为22,由于端口22众所周知,这也使得服务器容易受到自动化扫描和暴力破解攻击,本文将系统性地介绍... 目录引言为什么要更改 SSH 默认端口?步骤详解:如何更改 Centos 7 的 SSH 默认端口1

Maven的使用和配置国内源的保姆级教程

《Maven的使用和配置国内源的保姆级教程》Maven是⼀个项目管理工具,基于POM(ProjectObjectModel,项目对象模型)的概念,Maven可以通过一小段描述信息来管理项目的构建,报告... 目录1. 什么是Maven?2.创建⼀个Maven项目3.Maven 核心功能4.使用Maven H

SpringBoot多数据源配置完整指南

《SpringBoot多数据源配置完整指南》在复杂的企业应用中,经常需要连接多个数据库,SpringBoot提供了灵活的多数据源配置方式,以下是详细的实现方案,需要的朋友可以参考下... 目录一、基础多数据源配置1. 添加依赖2. 配置多个数据源3. 配置数据源Bean二、JPA多数据源配置1. 配置主数据