## File: README.md

# PeerBanHelper
[English](./README.EN.md)

自动封禁不受欢迎、吸血和异常的 BT 客户端，并支持自定义规则。



**在安装前试用 PeerBanHelper：**[前往演示站](https://pbh-demo.pbh-btn.com)

PeerBanHelper 是一个开放源代码的个人网络防火墙安全软件。通过连接支持的应用程序（如：BitTorrent 客户端软件）的 Web API 接口获取受保护应用的连接信息，识别其中可能包含潜在安全威胁的连接并通知对应的应用程序主动断开其连接。  

## 功能介绍

PeerBanHelper 主要由以下几个功能模块组成：

- [PeerID 黑名单](https://docs.pbh-btn.com/docs/module/peer-id)
- [Client Name 黑名单](https://docs.pbh-btn.com/docs/module/client-name)
- [IP/GeoIP/IP 类型 黑名单](https://docs.pbh-btn.com/docs/module/ip-address-blocker)
- [虚假进度检查器（提供启发式客户端检测功能）](https://docs.pbh-btn.com/docs/module/progress-cheat-blocker)
- [自动连锁封禁](https://docs.pbh-btn.com/docs/module/auto-range-ban)
- [多拨追猎](https://docs.pbh-btn.com/docs/module/multi-dial)
- Peer ID/Client Name 伪装检查；通过 [AviatorScript 引擎](https://docs.pbh-btn.com/docs/module/expression-engine) 实现
- [主动监测（提供本地数据分析功能）](https://docs.pbh-btn.com/docs/module/active-monitoring)
- [网络 IP 集规则订阅](https://docs.pbh-btn.com/docs/module/ip-address-blocker-rules)
- WebUI （目前支持：活跃封禁名单查看，历史封禁查询，封禁最频繁的 Top 50 IP，规则订阅管理，图表查看，Peer 列表查看）

此外，PeerBanHelper 会在启动时下载 GeoIP 库，成功加载后支持以下功能：

- 在封禁列表中查看 IP 归属地，AS 信息（ASN、ISP、AS 名称等），网络类型信息（宽带、基站、物联网、数据中心等）
- 基于 GeoIP 信息按国家/地区、城市、网络类型、ASN 等封禁 IP 地址
- 查看 GeoIP 统计数据

> [!TIP]
> 为获得最佳效果，建议配合我们维护的 IP 规则库 [PBH-BTN/BTN-Collected-Rules](https://github.com/PBH-BTN/BTN-Collected-Rules) 和 [BTN 网络](https://docs.pbh-btn.com/docs/btn/intro) 一起食用，不过这是完全可选的。


## 支持的客户端

> [!CAUTION]
> 所有安装在 Docker 中的下载器，必须使用 host 网络驱动程序。PBH 需要下载器能获得 Peer 的真实 IP，不能使用 bridge 桥接模式！

- qBittorrent/qBitorrent，**4.5.0 或更高版本**，不支持 XDown
- BiglyBT（需要安装[插件](https://github.com/PBH-BTN/PBH-Adapter-BiglyBT)）
- Deluge（需要安装[插件](https://github.com/PBH-BTN/PBH-Adapter-Deluge)）
- Transmission **(4.1.0-beta2 或更高版本)**
- BitComet **v2.18 或更高版本** (不支持 P2SP LTSeed 长效种子反吸血，因为 BitComet 暂时无法封禁长效连接)

PeerBanHelper 仅支持对传统 IPv4 或 IPv6 地址的反吸血，如遇 I2P 或者 Tor 连接将主动忽略。

# 截图

| 主界面                                                                                                                                | 封禁列表                                                                                                                             | 封禁日志                                                                                                                             | 封禁统计                                                                                                                            | 规则统计                                                                                                                                | 规则订阅                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|  |  |  |  |  |  |

## 安装 PeerBanHelper

查看 [PeerBanHelper 文档](https://docs.pbh-btn.com/docs/category/%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2)

## 常见问题

在报告问题前，请先检查 [常见问题列表](https://docs.pbh-btn.com/docs/faq)

## 需要帮助？
考虑加入我们的 QQ 群！

1 群：932978658

或者：[Telegram](https://t.me/+TfjwEmsUKhZjMTI1)

## 声明

**使用本软件意味着你同意以下声明：** 

违法网站和黑灰产请勿向我组织开发或支持人员发起任何形式的人工服务请求；严禁使用 PBH-BTN 团队的任何成果（包括但不限于代码，镜像，程序，BTN规则集等）从事任何违法违规、危害国家安全、实施或帮助他人实施电信犯罪等非法活动。  
用户不得通过 PBH-BTN 团队的任何成果（包括但不限于代码，镜像，程序，BTN规则集等）进行任何损害其它个人或组织的利益的活动。在任何违反个人或组织权益的情况下使用 PBH-BTN 团队的任何服务、产品均不被允许。
用户使用本软件造成的任何后果，由用户自行承担，与本软件开发者无关。

## Star History

[](https://star-history.com/#PBH-BTN/PeerBanHelper&Date)

## Tools

在 PeerBanHelper 的开发过程中，我们使用到了许多优秀的专业工具。感谢下面的公司或项目慷慨的提供开源许可证：

### Install4j

PeerBanHelper 使用 [Install4j multi-platform installer builder](https://www.ej-technologies.com/products/install4j/overview.html) 打包多平台安装程序。感谢 ej-technolgies 的开放源代码许可证。点击链接或者下面的图片下载 install4j。

[](https://www.ej-technologies.com/products/install4j/overview.html)

### JProfiler

PeerBanHelper 使用 [JProfiler all-in one Java profiler](https://www.ej-technologies.com/jprofiler) 对程序进行性能分析与优化。感谢 ej-technolgies 的开放源代码许可证。点击链接或者下面的图片下载 JProfiler。

[](https://www.ej-technologies.com/jprofiler)

### 纯真 CZ88.NET 社区版 IP 库

纯真(CZ88.NET)自2005年起一直为广大社区用户提供社区版IP地址库，只要获得纯真的授权就能免费使用，并不断获取后续更新的版本。如果有需要免费版IP库的朋友可以前往纯真的官网进行申请。

纯真除了免费的社区版IP库外，还提供数据更加准确、服务更加周全的商业版IP地址查询数据。纯真围绕IP地址，基于 网络空间拓扑测绘 + 移动位置大数据 方案，对IP地址定位、IP网络风险、IP使用场景、IP网络类型、秒拨侦测、VPN侦测、代理侦测、爬虫侦测、真人度等均有近20年丰富的数据沉淀。


## Credit

### Backend

- [Cordelia](https://github.com/bochkov/cordelia)
- [IPAddress](https://github.com/seancfoley/IPAddress)
- [YamlConfiguration](https://github.com/bspfsystems/YamlConfiguration)
- [libby](https://github.com/AlessioDP/libby)
- [AviatorScript](https://github.com/killme2008/aviatorscript)
- [javalin](https://javalin.io/)
- [deluge-java](https://github.com/RangerRick/deluge-java)
- [SystemThemeDetector](https://github.com/Benzor94/SystemThemeDetector)
- [Methanol](https://github.com/mizosoft/methanol)
- [Flatlaf](https://github.com/JFormDesigner/FlatLaf)
- [GeoIP2](https://dev.maxmind.com/geoip)
- [ormlite](https://ormlite.com/)
- [SimpleReloadLib](https://github.com/Ghost-chu/SimpleReloadLib)
- [portmapper](https://github.com/offbynull/portmapper)
- [xz](https://github.com/tukaani-project/xz-java)
- [commonmark](https://github.com/commonmark/commonmark-java)
- [oshi](https://github.com/oshi/oshi)
- [semver4j](https://github.com/vdurmont/semver4j)
- [commonmark](https://github.com/commonmark/commonmark-java)
- [dnsjava](https://github.com/dnsjava/dnsjava)
- [SWT](https://eclipse.dev/eclipse/swt/)
- [simple-java-mail](https://www.simplejavamail.org/)
- [PF4J](https://pf4j.org/)
- [completable-futures](https://github.com/spotify/completable-futures)
- [cdnbye/NatTypeDetector](https://github.com/cdnbye/NatTypeDetector)

### WebUI

- [Vue](https://vuejs.org/)
- [ArcoDesign](https://arco.design/)
- [ECharts](https://echarts.apache.org/en/index.html)

---

## File: pkg/synopkg/PeerBanHelperPackage/README.md

# Synology Example Package.

This package is depend on Synology toolkit framework.
This package is a template package, users can modify this package to generate their own packages.

Please setup the toolkit by following [pkgscripts-ng](https://github.com/SynologyOpenSource/pkgscripts-ng)

## Build package.
After setup toolkit environment, you can create package by command:
```bash
pkgscripts-ng/PkgCreate.py [-p {platforms}] -c -v 7.0 ExamplePkg
```
```bash
pkgscripts-ng/PkgCreate.py -p avoton -c -v 7.0 ExamplePkg
pkgscripts-ng/PkgCreate.py -c -v 7.0 ExamplePkg # will generate package for all platforms in build_env
```

You can find generated packages in result_spk directory.

---

## File: webui/src/views/custom-script/components/editor/aviatorscript/README.md

# AviatorScript

the avaitorscript support is original developed by [OpenDSL](https://gitee.com/opendsl/opendsl-editor) and rewritten in ts by @Gaojianli

---

## File: webui/README.md

# pbh-fe

This is a ~~alternative~~ WebUI of the [PeerBanHelper](https://github.com/Ghost-chu/PeerBanHelper), based on modern front-end stacks.

Quick preview: https://pbh.u2b.eu

API Doc: https://apifox.com/apidoc/shared-b24f42a4-67f5-402a-900d-9fad3ae9917b

## Feature

- [x] Custom Endpoint
- [x] Ban List
- [x] Ban Logs
- [x] Auto Refresh
- [x] Client Status
- [x] Max-ban list with search
- [x] Manage rule subscription

## Screenshots






## How to contribute

This project using Vue 3 + [Arco Design](https://arco.design/vue/en-US/docs/start)

## Project Setup

You are supposed to use [pnpm](https://pnpm.io/) to manage the dependencies.

```sh
pnpm install
```

### Compile and Hot-Reload for Development

```sh
pnpm run dev
```

### Type-Check, Compile and Minify for Production

```sh
pnpm run build
```

### Lint with [ESLint](https://eslint.org/)

```sh
pnpm run lint
```

---

## File: README.EN.md

# PeerBanHelper
[简体中文](./README.md)

Automatically ban unwelcome, leeching, and abnormal BT clients with support for custom rules.



**Try PeerBanHelper before install to your device:** [Demo Site](https://pbh-demo.pbh-btn.com)

## Features

PeerBanHelper consists of the following core modules:

- [PeerID Blacklist](https://docs.pbh-btn.com/docs/module/peer-id)
- [Client Name Blacklist](https://docs.pbh-btn.com/docs/module/client-name)
- [IP/GeoIP/IP Type Blacklist](https://docs.pbh-btn.com/docs/module/ip-address-blocker)
- [Fake Progress Checker (Progress Cheat Blocker)](https://docs.pbh-btn.com/docs/module/progress-cheat-blocker)
- [Automatic Chain Banning](https://docs.pbh-btn.com/docs/module/auto-range-ban)
- [Multi-Dial Tracking](https://docs.pbh-btn.com/docs/module/multi-dial)
- Peer ID/Client Name Spoofing Detection via [AviatorScript Engine](https://docs.pbh-btn.com/docs/module/expression-engine)
- [Active Monitoring (Local Data Analysis)](https://docs.pbh-btn.com/docs/module/active-monitoring)
- [IP Set Rules Subscription](https://docs.pbh-btn.com/docs/module/ip-address-blocker-rules)
- WebUI (Current Features: Active Banlist, Ban History, Top 50 Most Banned IPs, Rule Subscription Management, Charts, Peer List)

Additionally, PeerBanHelper downloads the GeoIP database on startup. Once loaded, it supports:

- Viewing IP geolocation, AS info (ASN, ISP, AS Name), and network type (Broadband, Cellular, IoT, Data Center, etc.) in ban lists
- Banning IPs by country/region, city, network type, ASN, etc.
- GeoIP statistics visualization

> [!TIP]
> For optimal performance, we recommend using our maintained IP rule repository [PBH-BTN/BTN-Collected-Rules](https://github.com/PBH-BTN/BTN-Collected-Rules) and [BTN Network](https://docs.pbh-btn.com/docs/btn/intro), though this is entirely optional.

## Supported Clients

> [!CAUTION]
> All Docker-based downloaders must use host network driver. PBH requires real peer IPs - bridge mode is unsupported!

- qBittorrent/qBittorrent **v4.5.0 or newer** (XDown not supported)
- BiglyBT (requires [plugin](https://github.com/PBH-BTN/PBH-Adapter-BiglyBT))
- Deluge (requires [plugin](https://github.com/PBH-BTN/PBH-Adapter-Deluge))
- Transmission **(v4.1.0-beta2 or newer required)**
- BitComet **v2.18 or newer** (LTSeed anti-leech unsupported due to BitComet's limitation)

PeerBanHelper only supports traditional IPv4/IPv6 anti-leech. I2P/Tor connections are ignored.

# Screenshots

| Main UI                                                                                                                              | Ban List                                                                                                                           | Ban Logs                                                                                                                           | Ban Statistics                                                                                                                     | Rule Statistics                                                                                                                     | Rule Subscriptions                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|  |  |  |  |  |  |

## Installation

See [PeerBanHelper Documentation](https://docs.pbh-btn.com/docs/category/%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2)

## FAQ

Before reporting issues, check [FAQ](https://docs.pbh-btn.com/docs/faq)

## Need Help?

Join our [QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=w5as_wH2G1ReUrClreCYhR69XiNCuP65&jump_from=webapi&authKey=EyjMX7Pwc77XLM51V6FEcR7oXnG8fsUbSFqYZ4PPiEpq32vBglJn/jFvpc3LFDhn) or [Telegram Group](https://t.me/+TfjwEmsUKhZjMTI1)!

## Disclaimer

**By using this software, you agree to:**

Illegal websites and black/grey industries shall not request any form of manual service from PBH-BTN developers/supporters. Strictly prohibited to use any PBH-BTN assets (including but not limited to code, images, programs, BTN rulesets) for illegal activities, endangering national security, telecom fraud, or assisting others in such acts.  
Users shall not use PBH-BTN assets to harm other individuals/organizations. Any usage infringing rights of others is prohibited.  
Users bear full responsibility for consequences arising from software usage. Developers assume no liability.

## Star History

[](https://star-history.com/#PBH-BTN/PeerBanHelper&Date)

## Tools

We use these excellent tools during development. Thanks to the companies/projects for providing open-source licenses:

### Install4j

PeerBanHelper uses [Install4j multi-platform installer builder](https://www.ej-technologies.com/products/install4j/overview.html). Thanks to ej-technologies for the OSS license. Click the link or image below for install4j.

[](https://www.ej-technologies.com/products/install4j/overview.html)

### JProfiler

PeerBanHelper uses [JProfiler all-in one Java profiler](https://www.ej-technologies.com/jprofiler) for performance analysis. Thanks to ej-technologies for the OSS license. Click the link or image below for JProfiler.

[](https://www.ej-technologies.com/jprofiler)

## Credit

### Backend

- [Cordelia](https://github.com/bochkov/cordelia)
- [IPAddress](https://github.com/seancfoley/IPAddress)
- [YamlConfiguration](https://github.com/bspfsystems/YamlConfiguration)
- [libby](https://github.com/AlessioDP/libby)
- [AviatorScript](https://github.com/killme2008/aviatorscript)
- [javalin](https://javalin.io/)
- [deluge-java](https://github.com/RangerRick/deluge-java)
- [SystemThemeDetector](https://github.com/Benzor94/SystemThemeDetector)
- [Methanol](https://github.com/mizosoft/methanol)
- [Flatlaf](https://github.com/JFormDesigner/FlatLaf)
- [GeoIP2](https://dev.maxmind.com/geoip)
- [ormlite](https://ormlite.com/)
- [SimpleReloadLib](https://github.com/Ghost-chu/SimpleReloadLib)
- [portmapper](https://github.com/offbynull/portmapper)
- [xz](https://github.com/tukaani-project/xz-java)
- [commonmark](https://github.com/commonmark/commonmark-java)
- [oshi](https://github.com/oshi/oshi)
- [semver4j](https://github.com/vdurmont/semver4j)
- [commonmark](https://github.com/commonmark/commonmark-java)
- [dnsjava](https://github.com/dnsjava/dnsjava)
- [SWT](https://eclipse.dev/eclipse/swt/)
- [simple-java-mail](https://www.simplejavamail.org/)
- [PF4J](https://pf4j.org/)
- [completable-futures](https://github.com/spotify/completable-futures)
- [cdnbye/NatTypeDetector](https://github.com/cdnbye/NatTypeDetector)

### WebUI

- [Vue](https://vuejs.org/)
- [ArcoDesign](https://arco.design/)
- [ECharts](https://echarts.apache.org/en/index.html)