非常简单,无需额外配置。
mubeng 具有 2 个核心功能:
这对于避免各种类型的 IP 封禁非常有用,例如暴力破解保护、API 速率限制或基于 IP 的 WAF 拦截。我们还允许用户完全自行决定从任何地方使用代理池资源。
因此,如果你想要检查代理池,无需再借助其他额外的代理检查工具。
只需从 releases 页面 下载预构建的二进制文件然后运行即可!
运行以下命令拉取 Docker 镜像:```bash ▶ docker pull ghcr.io/mubeng/mubeng:latest
## 源代码
使用 [Go](https://golang.org/doc/install) 编译器:```bash
▶ go install -v github.com/mubeng/mubeng@latest
从源代码手动构建可执行文件:```bash ▶ git clone https://github.com/mubeng/mubeng ▶ cd mubeng ▶ make build ▶ (sudo) install ./bin/mubeng /usr/local/bin
# 用法
使用本工具时,始终需要提供你的代理列表,无论是用于检查还是作为代理IP轮换的代理池。
<center>
<a href="#"><img alt="kitabisa mubeng" src="https://assets.kitploit.com/production/public/readmes/6846/00da09beb0579d8445f07b09eb977f63be93627d3e6e9ebfcb96dcaed4f3fafd.png" width="80%"></a>
</center>
## 基础```bash
▶ mubeng [-c|-a :8080] -f file.txt [options...]
以下是它支持的所有选项。```bash ▶ mubeng -h
| **标志** | **描述** |
|-------------------------------|--------------------------------------------------------|
| -f, --file `<FILE>` | 代理文件。 |
| -a, --address `<ADDR>:<PORT>` | 运行代理服务器。 |
| -A, --auth `<USER>:<PASS>` | 设置代理服务器的认证。 |
| -d, --daemon | 将代理服务器守护进程化。 |
| -c, --check | 执行代理存活检测。 |
| -g, --goroutine `<N>` | 最大使用的 goroutine 数(默认:50)。 |
| --only-cc `<AA>,<BB>` | 仅显示指定国家代码(逗号分隔)。 |
| -t, --timeout | 代理服务器/检测允许的最长时间(默认:30s)。 |
| -r, --rotate `<AFTER>` | 每执行 `<AFTER>` 次请求后轮换代理 IP(默认:1)。 |
| --rotate-on-error | 轮换代理 IP 并重试失败的 HTTP 请求。 |
| --remove-on-error | 在失败的 HTTP 请求后从代理池中移除代理 IP。 |
| --max-errors `<N>` | 轮换期间允许的最大错误数(默认:3)。 |
| | 与 `--rotate-on-error` 搭配使用。 |
| | 如果值小于 0(例如 -1),轮换将 |
| | 无限继续。 |
| --max-redirs `<N>` | 允许的最大重定向次数(默认:10)。 |
| --max-retries `<N>` | 失败 HTTP 请求的最大重试次数(默认:0)。 |
| -m, --method `<METHOD>` | 轮换方法(顺序/随机)(默认:顺序)。 |
| -s, --sync | 同步将等待前一个请求完成。 |
| -v, --verbose | 输出 HTTP 请求/响应,或在检测时显示失效代理。 |
| -o, --output `<FILE>` | 保存代理服务器或存活检测的输出。 |
| -u, --update | 将 mubeng 更新到最新的稳定版本。 |
| -w, --watch | 监视代理文件,从更改中实时重新加载。 |
| -V, --version | 显示当前 mubeng 版本。 |
<table>
<td>
<h4>注意:</h4>
<ul>
<li>轮换会对所有请求计数,即使请求失败。
<!-- <ul>
<li>轮换是增量式的,从列表开头开始。</li>
<li>轮换意味着随机,<b>不是</b>从代理池中选择/递增一个代理。我们没有设置代理是否已被使用的条件。因此,无法保证当请求达到 <i>N</i> 值 <code>(-r/--rotate)</code> 时,IP 代理一定会轮换。</li>
</ul> -->
</li>
<li>代理服务器默认异步运行,因此无法保证 <i>N</i> 之后的请求(即 <i>N+1</i> 等)会轮换代理 IP,请改用 <code>-s/--sync</code> 标志等待前一个代理的请求完成。</li>
<li>守护进程模式 <code>(-d/--daemon)</code> 将在 (Linux/OSX) 系统上安装 mubeng 服务/在 Windows 上设置回调。
<ul>
<li>因此,你可以使用 <code>journalctl</code>、<code>service</code> 或 <code>net</code>(Windows)命令来控制服务,以启动/停止代理服务器。</li>
<li>每当激活守护进程模式时,它会强制停止并卸载现有的 mubeng 服务,然后重新安装并以守护进程方式启动。</li>
</ul>
</li>
<li>详细模式 <code>(-v/--verbose)</code> 和超时 <code>(-t/--timeout)</code> 同时适用于代理检测和代理 IP 轮换操作。</li>
<li>当启用详细模式 <code>(-v/--verbose)</code> 时,会显示 HTTP 流量请求和响应,但
<ul>
<li>我们<b>不</b>明确显示请求/响应正文,并且</li>
<li>头部中的所有 cookie 值将自动被遮盖。</li>
</ul>
</li>
<li>如果使用输出选项 <code>(-o/--output)</code> 来运行代理 IP 轮换器,请求/响应头部将<b>不</b>写入日志文件。</li>
<li>超时选项 <code>(-t/--timeout)</code> 的值是一个可能带符号的十进制数字序列,每个数字可带小数部分和单位后缀,例如 "5s"、"300ms"、"-1.5h" 或 "2h45m"。
<ul>
<li>有效的时间单位是 "ns"、"us"(或 "µs")、"ms"、"s"、"m" 和 "h"。</li>
</ul>
</li>
<li>最大错误数 <code>(--max-errors)</code> ≠ 最大重试次数 <code>(--max-retries)</code>。</li>
<ul>
<li>最大重试次数 <code>(--max-retries)</code> 适用于使用同一个代理重试失败的 HTTP 请求。</li>
<li>而最大错误数 <code>(--max-errors)</code> 指的是所用代理的失败 HTTP 请求总数。</li>
<li>例如,一旦达到最大重试次数 <code>(--max-retries)</code> <i>(如果指定)</i>,错误被计数,并且代理 IP 将为同一个失败的 HTTP 请求轮换,直到达到最大错误数 <code>(--max-errors)</code>,而最大重试次数 <code>(--max-retries)</code> <b>不</b>会触发代理轮换。</li>
</ul>
<li>如果最大错误数 <code>(--max-errors)</code> 的值小于 <b>0</b>(例如 <b>-1</b>),轮换将无限继续。</li>
</ul>
</td>
</table>
## 安装 SSL 证书
mubeng 使用由 [GoProxy](https://github.com/elazarl/goproxy) 提供的内置证书颁发机构。在 mubeng 代理服务器运行时,可以通过在浏览器中访问 `http://mubeng/cert` 来导出生成的证书。
CA 证书的安装步骤与[其他](https://portswigger.net/burp/documentation/desktop/external-browser-config/certificate)代理工具类似。
## 示例
例如,你有一个代理池 `(proxies.txt)`,内容如下:
<table>
<td>
<pre>http://127.0.0.1:8080
https://127.0.0.1:443
socks4://127.0.0.1:4145
socks5://127.0.0.1:2121
...
...</pre>
</td>
</table>
> 因为我们使用了自动切换传输,所以 `mubeng` 可以同时接受多种代理协议方案。<br>
> 请参阅此包的[文档](https://pkg.go.dev/github.com/mubeng/mubeng/pkg/mubeng#Transport)。
### 代理检测器
在命令中传递 `--check` 标志来执行代理检测:```bash
▶ mubeng -f proxies.txt --check --only-cc AU,US,UK --output live.txt
上述案例还使用了--output标志,配合--only-cc标志(ISO-3166 alpha-2)将特定国家代码的实时代理保存到文件 (live.txt) 中,这些代理来自检查结果。

(图:使用最大5秒超时检查代理 mubeng)
你可以使用--output-format标志配合fasttemplate语法来自定义代理检查器的输出格式:```bash
▶ mubeng -f proxies.txt --check --output-format "{{proxy}} | {{country}} | {{duration}}"
**可用模板变量:**
| 变量 | 描述 | 示例 |
|----------|-------------|---------|
| `{{proxy}}` | 完整的代理URL | `http://192.168.1.1:8080` |
| `{{protocol}}` | 代理协议方案 | `http`, `https`, `socks5` |
| `{{host}}` | 代理主机/IP地址 | `192.168.1.1` |
| `{{port}}` | 代理端口 | `8080` |
| `{{ip}}` | 外部IP地址 | `203.0.113.1` |
| `{{country}}` | 国家代码 | `US`, `UK`, `AU` |
| `{{city}}` | 城市名称 | `New York`, `London` |
| `{{org}}` | 组织/ISP | `Google Inc.` |
| `{{region}}` | 地区/州 | `California`, `England` |
| `{{timezone}}` | 时区 | `America/New_York` |
| `{{loc}}` | 纬度,经度 | `40.7128,-74.0060` |
| `{{hostname}}` | 主机名 | `example.com` |
| `{{duration}}` | 响应时间 | `245ms` |
**示例:**```bash
# JSON-like format
▶ mubeng -f proxies.txt --check --output-format '{"proxy":"{{proxy}}","country":"{{country}}","duration":"{{duration}}"}'
# CSV format
▶ mubeng -f proxies.txt --check --output-format "{{proxy}},{{country}},{{city}},{{duration}}"
# Custom detailed format
▶ mubeng -f proxies.txt --check --output-format "[{{country}}] {{proxy}} ({{org}}) - {{duration}}"
当使用 --output-format 时,格式化的输出同时应用于控制台显示和文件输出(当使用 -o/--output 标志时)。
此外,如果你想从之前检查结果中仍存活的代理 (live.txt) (或者如果你有自己的列表) 中执行代理 IP 轮换,你必须使用 -a (--address) 标志来运行代理服务器:```bash
▶ mubeng -a localhost:8089 -f live.txt -r 10 -m random
`-r` _(--rotate)_ 标志用于每提供 `(10)` 个 _N_ 请求值旋转您的 IP,而 `-m` _(--method)_ 标志将按顺序或随机旋转代理。
<p align="center">
<img src="https://assets.kitploit.com/production/public/readmes/6846/add87f63071a7416cb66f40df56dcace5e9461cc80e0c2b0abadacd74114316d.png">
<i>(图:以详细模式运行 mubeng 作为代理 IP 旋转器)</i>
</p>
### [Burp Suite](https://portswigger.net/burp/documentation/desktop/getting-started/installing-burp) 上游代理
如果您想将 `mubeng` _(代理 IP 旋转器)_ 用作 Burp Suite 中的上游代理,在 Burp Suite 和 mubeng 之间充当到互联网的中间件,这样您就不需要为此在 Burp Suite 中安装任何额外的扩展。为了演示这一点:
<p align="center">
<img src="https://assets.kitploit.com/production/public/readmes/6846/be07464247cdef251240ecc10ac0515484489bf1e5b1f3a4e44c7bf5d1bb2461.jpg">
<i>(图:设置 Burp Suite 上游代理到 mubeng)</i>
</p>
在您的 Burp Suite 实例中,选择**项目选项**菜单,然后点击**连接**选项卡。在**上游代理服务器**部分,勾选**覆盖用户选项**,然后按**添加**按钮添加您的上游代理规则。之后,使用正确的详细信息填写必需的列_(目标主机、代理主机和代理端口)_。点击**确定**保存设置。
### [OWASP ZAP](https://www.zaproxy.org/download/) 代理链
它的作用方式与使用上游代理相同。OWASP ZAP 允许您在 OWASP ZAP 会话中连接到另一个代理以进行传出连接。要将其与 mubeng 代理服务器链接:
<p align="center">
<img src="https://assets.kitploit.com/production/public/readmes/6846/0f8ad5ce8fa502cd51c61f9be5eea8119176df378502ada3c34b89469276bc1d.png">
<i>(图:在 OWASP ZAP 中设置代理链连接到 mubeng)</i>
</p>
在您的 ZAP 会话窗口的菜单栏中选择**工具**,然后选择**选项** _(快捷键:Ctrl+Alt+O)_ 子菜单,并进入**连接**部分。在该窗口中,滚动到**使用代理链**部分,然后勾选**使用出站代理服务器**。之后,使用正确的详细信息填写必需的列_(地址/域名和端口)_。点击**确定**保存设置。
### 代理格式
目前 mubeng 支持 HTTP(S) 和 SOCKSv4(A)/v5 协议,请参阅上面的[示例](#examples)。但是,不仅如此,我们还支持代理字符串替换和用于代理池的辅助函数。
#### 模板化
如果您有经过身份验证的代理,您肯定不想不断地将凭据写入代理池文件。**mubeng** 可以使用 `{{VARIABLE}}` 的编写风格来评估环境变量。
例如:
1. String substitute```console
$ export USERNAME="FOO"
$ export PASSWORD="BAR"
$ echo "http://{{USERNAME}}:{{PASSWORD}}@192.168.0.1:31337" > list.txt
$ mubeng -f list.txt -a :8080
当前支持的可用函数:
uint32,以及uint32n N。上述函数是线程安全的伪随机函数。
作为使用示例,我们将利用 Tor SOCKS 上的流隔离。使用此方法,您只需要一个 Tor 实例,每个请求可以使用具有不同出口节点的不同流,但这并不能保证您的 ass 会被轮换。因此,我们必须为每个连接创建唯一的 USER:PASS 对来隔离流。为了传递伪随机代理授权,请在代理池上使用 uint32 或 uint32n 函数,例如:```console
$ echo "socks5://{{uint32}}:{{uint32}}@127.0.0.1:9050" > list.txt
$ while :; do mubeng -f list.txt -c 2>/dev/null; done
[LIVE] [XX] [23..177.2] socks5://2123347975:[email protected]:9050
[LIVE] [XX] [199..253.156] socks5://1646373938:[email protected]:9050
[LIVE] [XX] [185..101.137] socks5://814036283:[email protected]:9050
[LIVE] [XX] [185..83.83] socks5://2895805939:[email protected]:9050
[LIVE] [XX] [103..167.10] socks5://408584795:[email protected]:9050
[LIVE] [XX] [198..84.99] socks5://3015151335:[email protected]:9050
[LIVE] [XX] [179.**.159.197] socks5://3952852758:[email protected]:9050
^C
#### Amazon API Gateway
mubeng 代理轮换器还支持与 Amazon API Gateway 集成。这允许您通过多个 AWS 区域路由流量,以增强冗余和地理分布。
AWS 代理字符串的格式:```
aws://AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY@REGION
[!TIP] 由于它使用自定义解析器,AWS 秘密访问密钥(或其他任何部分)可以用引号括起来以提高可读性。例如:
aws://AKIAIOSFODNN7EXAMPLE:"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"@us-west-1。此引号功能仅适用于
aws协议方案。
要开始使用,您需要:
2. 创建一个包含 AWS regions 的代理列表文件
为多个 AWS regions 生成代理条目:```bash
echo "aws://{{AWS_ACCESS_KEY_ID}}:{{AWS_SECRET_ACCESS_KEY}}@"{us,eu}"-"{east,west}"-"{1,2} | tr ' ' '\n' > list.txt
这将会为以下区域创建条目:
aws://{{AWS_ACCESS_KEY_ID}}:{{AWS_SECRET_ACCESS_KEY}}@us-east-1aws://{{AWS_ACCESS_KEY_ID}}:{{AWS_SECRET_ACCESS_KEY}}@us-east-2aws://{{AWS_ACCESS_KEY_ID}}:{{AWS_SECRET_ACCESS_KEY}}@us-west-1This setup enables mubeng to automatically rotate traffic through multiple AWS regions via API Gateway. When running the proxy server, mubeng will dynamically substitute your AWS credentials from environment variables using the [templating](#templating) feature described above.
> [!NOTE]
> Ensure your AWS credentials have the appropriate permissions to access API Gateway in the specified regions.
# Limitations
Currently IP rotation runs the proxy server only as an HTTP protocol, not a SOCKSv4(A)/v5 protocol, even though the resource you have is SOCKSv4(A)/v5. In other words, the SOCKSv4(A)/v5 resource that you provide is used properly because it uses auto-switch transport on the client, but this proxy server **DOES NOT** switch to anything other than HTTP protocol.
# Contributors
[](https://github.com/mubeng/mubeng/issues)
This project exists thanks to all the people who contribute. To learn how to setup a development environment and for contribution guidelines, see [CONTRIBUTING.md](https://github.com/mubeng/mubeng/blob/master/.github/CONTRIBUTING.md).
<a href="https://github.com/mubeng/mubeng/graphs/contributors">
<img src="https://raw.githubusercontent.com/mubeng/mubeng/HEAD/.github/CONTRIBUTORS.svg">
</a>
# Pronunciation
[`jv_ID`](https://www.localeplanet.com/java/jv-ID/index.html) • **/mo͞oˌbēNG/** — mubeng-mubeng nganti mumet. (ꦩꦸꦧꦺꦁꦔꦤ꧀ꦠꦶꦩꦸꦩꦺꦠ꧀)
# Changes
For changes, see [CHANGELOG.md](https://github.com/mubeng/mubeng/blob/master/CHANGELOG.md).
# License
This program is free software: you can redistribute it and/or modify it under the terms of the [Apache license](https://github.com/mubeng/mubeng/blob/master/LICENSE). mubeng and any contributions are copyright © by Dwi Siswanto 2021-2025.