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

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

hadoop开启回收站配置

开启回收站功能,可以将删除的文件在不超时的情况下,恢复原数据,起到防止误删除、备份等作用。 开启回收站功能参数说明 (1)默认值fs.trash.interval = 0,0表示禁用回收站;其他值表示设置文件的存活时间。 (2)默认值fs.trash.checkpoint.interval = 0,检查回收站的间隔时间。如果该值为0,则该值设置和fs.trash.interval的参数值相等。

NameNode内存生产配置

Hadoop2.x 系列,配置 NameNode 内存 NameNode 内存默认 2000m ,如果服务器内存 4G , NameNode 内存可以配置 3g 。在 hadoop-env.sh 文件中配置如下。 HADOOP_NAMENODE_OPTS=-Xmx3072m Hadoop3.x 系列,配置 Nam

linux-基础知识3

打包和压缩 zip 安装zip软件包 yum -y install zip unzip 压缩打包命令: zip -q -r -d -u 压缩包文件名 目录和文件名列表 -q:不显示命令执行过程-r:递归处理,打包各级子目录和文件-u:把文件增加/替换到压缩包中-d:从压缩包中删除指定的文件 解压:unzip 压缩包名 打包文件 把压缩包从服务器下载到本地 把压缩包上传到服务器(zip

wolfSSL参数设置或配置项解释

1. wolfCrypt Only 解释:wolfCrypt是一个开源的、轻量级的、可移植的加密库,支持多种加密算法和协议。选择“wolfCrypt Only”意味着系统或应用将仅使用wolfCrypt库进行加密操作,而不依赖其他加密库。 2. DTLS Support 解释:DTLS(Datagram Transport Layer Security)是一种基于UDP的安全协议,提供类似于

Linux 网络编程 --- 应用层

一、自定义协议和序列化反序列化 代码: 序列化反序列化实现网络版本计算器 二、HTTP协议 1、谈两个简单的预备知识 https://www.baidu.com/ --- 域名 --- 域名解析 --- IP地址 http的端口号为80端口,https的端口号为443 url为统一资源定位符。CSDNhttps://mp.csdn.net/mp_blog/creation/editor

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

Linux_kernel驱动开发11

一、改回nfs方式挂载根文件系统         在产品将要上线之前,需要制作不同类型格式的根文件系统         在产品研发阶段,我们还是需要使用nfs的方式挂载根文件系统         优点:可以直接在上位机中修改文件系统内容,延长EMMC的寿命         【1】重启上位机nfs服务         sudo service nfs-kernel-server resta