> For the complete documentation index, see [llms.txt](https://sphantix-hang.gitbook.io/timebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sphantix-hang.gitbook.io/timebook/2.-huan-jing-pian/kai-fa-huan-jing-pei-zhi/tong-yong/proxychain_ng.md).

# proxychain安装与使用

[proxychain](https://github.com/rofl0r/proxychains-ng)可以hook libc中所有网络相关的函数，强制所有的`TCP`连接都通过指定的socks4/5或者http代理，避免对于不同的app，需要分别设置代理的繁琐。

## 一、安装

### 1.1 Linux

1. 下载代码：`git clone https://github.com/rofl0r/proxychains-ng.git`
2. 进入代码目录并运行`configure`：`./configure --prefix=/usr --sysconfdir=/etc`
3. 编译：`make`
4. 安装proxychain：`sudo make install`
5. 安装配置文件：`sudo make install-config`，配置文件位于`etc/proxychains.conf`中。

### 1.2 MacOS

todo

## 二、使用

### 2.1 Linux

1. 修改配置文件

   使用编辑器打开`etc/proxychains.conf`，将最后一行修改为想要的代理。例如设置SOCKS5代理：`socks5  127.0.0.1 1080`，说明在本地回环地址的1080端口走socks5代理。
2. 代理app

   ```bash
   proxychains4 /app/to/be/hooked
   ```

   例如使用代理`clone`代码：`proxychains4 git clone https://github.com/rofl0r/proxychains-ng.git`。

### 2.2 MacOS

todo


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sphantix-hang.gitbook.io/timebook/2.-huan-jing-pian/kai-fa-huan-jing-pei-zhi/tong-yong/proxychain_ng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
