PBH-BTN / PeerBanHelper

BT 反吸血工具 - 自动封禁不受欢迎、吸血和异常的 BT 客户端,并支持自定义规则。PeerId黑名单/UserAgent黑名单/IP CIDR/假进度/超量下载/进度回退/多播追猎/连锁封禁/伪装检测 支持 qBittorrent/Transmission/Deluge/BiglyBT/Vuze(Azureus)/BitComet
GNU General Public License v3.0
1.51k stars 36 forks source link

添加多拨检测模块 #80

Closed CharlesChou73 closed 4 months ago

CharlesChou73 commented 5 months ago

按之前的建议修改,并补充了配置示例

/resource/profile.yml 和 README 均已添加新模块的配置,但是没找到配置升级脚本(或者相关逻辑)

之前说提到btn-2,但是提pr的时候没看到btn-2分支,昨天还从那边拉过代码来着……

Summary by CodeRabbit

Ghost-chu commented 5 months ago

PR 出现合并冲突了,无法进行 CI 测试和合并,看看先解决一下合并冲突?

Gaojianli commented 5 months ago

考虑一个误伤的case: pt网站集中的欧洲大盘鸡,当一个种子发布后,他们会在1小时左右后通过rss下载此类种子进行刷流,此功能有可能会误伤,看看有没有规避case

Ghost-chu commented 5 months ago

但是没找到配置升级脚本(或者相关逻辑)

在这里:https://github.com/PBH-BTN/PeerBanHelper/blob/master/src/main/java/com/ghostchu/peerbanhelper/config/ProfileUpdateScript.java

    @UpdateScript(version = XXXX) // 这里是目标配置文件版本号,如果您要新增一段升级脚本,就要 +1
    public void addExcludeLists() { // 方法名也是脚本名,只要您加上注解,这个方法就会自动执行
        // 在这里手动为配置文件设置配置项,脚本执行完毕后会自动保存,无需手动操作
        conf.set("module.peer-id-blacklist.exclude-peer-id", Collections.emptyList());
        conf.set("module.client-name-blacklist.exclude-client-name", Collections.emptyList());
    }
Ghost-chu commented 5 months ago

考虑一个误伤的case: pt网站集中的欧洲大盘鸡,当一个种子发布后,他们会在1小时左右后通过rss下载此类种子进行刷流,此功能有可能会误伤,看看有没有规避case

其实不止 PT,有些 BT 站(例如番剧/电影网站),也会有这种情况。

Gaojianli commented 5 months ago

此外还有个情况,对于PCDN用户考虑到运营商首单优惠/送宽带等),其实拉的很可能不是同一个运营商,因此我质疑本功能的有效性。此外,除了RSS等场景外,大片上映/热门电视剧更新时的学校(例如北洋园,BYRBT)亦会命中该规则

CharlesChou73 commented 5 months ago

@Gaojianli

此外还有个情况,对于PCDN用户考虑到运营商首单优惠/送宽带等),其实拉的很可能不是同一个运营商,因此我质疑本功能的有效性。此外,除了RSS等场景外,大片上映/热门电视剧更新时的学校(例如北洋园,BYRBT)亦会命中该规则

byrbt我在用,其他PT站应该也类似。一个是PT站有自己的下载量监控机制,不太会出现无脑刷下载的情况,我觉得PT用户不需要这个工具;二是校园网、企业网出口IP是固定的,在这个模块里会被判定为同一IP,不会增加计数,企业网如果有多个出口IP也往往没有什么联系,校园网不了解,如果出口IP在同一网段的话,好像会被误伤,也没什么规避方法。

我开发这个模块,是因为已经发现存在同一网段、同一端口、同一客户端下载同一种子的情况,具体是青岛的一批ip。一般用户多拨确实会选择不同运营商,专业PCND玩家(非专业的应该会被其他模块干掉)的带宽需求无法通过这种方式满足,都是贿赂宽带办理人员,填写假地址,拉几条到甚至几十条线路到一家的,属于违规操作,不会选择多家运营商,增加被发现的风险。

CharlesChou73 commented 5 months ago

考虑一个误伤的case: pt网站集中的欧洲大盘鸡,当一个种子发布后,他们会在1小时左右后通过rss下载此类种子进行刷流,此功能有可能会误伤,看看有没有规避case

没有看懂,据我所知,rss是用来获取种子信息的,刷流指下载后做种提供上传流(类似字幕组的分流)?这些分流节点会在同一个网段吗?

Ghost-chu commented 5 months ago

考虑一个误伤的case: pt网站集中的欧洲大盘鸡,当一个种子发布后,他们会在1小时左右后通过rss下载此类种子进行刷流,此功能有可能会误伤,看看有没有规避case

没有看懂,据我所知,rss是用来获取种子信息的,刷流指下载后做种提供上传流(类似字幕组的分流)?这些分流节点会在同一个网段吗?

昨天看BTN的时候发现一家Megacable的ISP出口有三个连续*24的段,一度让我以为是吸血用户。

CharlesChou73 commented 5 months ago

考虑一个误伤的case: pt网站集中的欧洲大盘鸡,当一个种子发布后,他们会在1小时左右后通过rss下载此类种子进行刷流,此功能有可能会误伤,看看有没有规避case

没有看懂,据我所知,rss是用来获取种子信息的,刷流指下载后做种提供上传流(类似字幕组的分流)?这些分流节点会在同一个网段吗?

昨天看BTN的时候发现一家Megacable的ISP出口有三个连续*24的段,一度让我以为是吸血用户。

草这是小运营商租的骨干网入口吧,本质就是同一小区,好像真没有分辨的方法……

Gaojianli commented 5 months ago

@Gaojianli

此外还有个情况,对于PCDN用户考虑到运营商首单优惠/送宽带等),其实拉的很可能不是同一个运营商,因此我质疑本功能的有效性。此外,除了RSS等场景外,大片上映/热门电视剧更新时的学校(例如北洋园,BYRBT)亦会命中该规则

byrbt我在用,其他PT站应该也类似。一个是PT站有自己的下载量监控机制,不太会出现无脑刷下载的情况,我觉得PT用户不需要这个工具;二是校园网、企业网出口IP是固定的,在这个模块里会被判定为同一IP,不会增加计数,企业网如果有多个出口IP也往往没有什么联系,校园网不了解,如果出口IP在同一网段的话,好像会被误伤,也没什么规避方法。

我开发这个模块,是因为已经发现存在同一网段、同一端口、同一客户端下载同一种子的情况,具体是青岛的一批ip。一般用户多拨确实会选择不同运营商,专业PCND玩家(非专业的应该会被其他模块干掉)的带宽需求无法通过这种方式满足,都是贿赂宽带办理人员,填写假地址,拉几条到甚至几十条线路到一家的,属于违规操作,不会选择多家运营商,增加被发现的风险。

但是本工具并没有做PT相关的豁免,因此对于一个客户端同时使用PT和BT的用户来说不可避免会造成PT种子被误伤,此外关于出口IP的问题,BYRBT是ipv6的,没有什么出口IP的说法,同一个学校的都在同一个网段

没有看懂,据我所知,rss是用来获取种子信息的,刷流指下载后做种提供上传流(类似字幕组的分流)?这些分流节点会在同一个网段吗?

是的,大盘鸡是用来刷上传量的,他们租用统一家VPS 提供商,内网互刷效果非常好,因此出口IP基本都是同一个网段的

CharlesChou73 commented 5 months ago

@Gaojianli

此外还有个情况,对于PCDN用户考虑到运营商首单优惠/送宽带等),其实拉的很可能不是同一个运营商,因此我质疑本功能的有效性。此外,除了RSS等场景外,大片上映/热门电视剧更新时的学校(例如北洋园,BYRBT)亦会命中该规则

byrbt我在用,其他PT站应该也类似。一个是PT站有自己的下载量监控机制,不太会出现无脑刷下载的情况,我觉得PT用户不需要这个工具;二是校园网、企业网出口IP是固定的,在这个模块里会被判定为同一IP,不会增加计数,企业网如果有多个出口IP也往往没有什么联系,校园网不了解,如果出口IP在同一网段的话,好像会被误伤,也没什么规避方法。 我开发这个模块,是因为已经发现存在同一网段、同一端口、同一客户端下载同一种子的情况,具体是青岛的一批ip。一般用户多拨确实会选择不同运营商,专业PCND玩家(非专业的应该会被其他模块干掉)的带宽需求无法通过这种方式满足,都是贿赂宽带办理人员,填写假地址,拉几条到甚至几十条线路到一家的,属于违规操作,不会选择多家运营商,增加被发现的风险。

但是本工具并没有做PT相关的豁免,因此对于一个客户端同时使用PT和BT的用户来说不可避免会造成PT种子被误伤,此外关于出口IP的问题,BYRBT是ipv6的,没有什么出口IP的说法,同一个学校的都在同一个网段

没有看懂,据我所知,rss是用来获取种子信息的,刷流指下载后做种提供上传流(类似字幕组的分流)?这些分流节点会在同一个网段吗?

是的,大盘鸡是用来刷上传量的,他们租用统一家VPS 提供商,内网互刷效果非常好,因此出口IP基本都是同一个网段的

PT豁免有什么思路吗?

对IPv6做了单独的配置,默认64位掩码,按IPv6定义应该没问题吧?在学校的时候倒是没注意过ipv6地址差多少

小IPS同一出口导致的误伤,是没什么逻辑层面的解决办法,只能让用户自己选择了。

coderabbitai[bot] commented 5 months ago

Walkthrough

The recent update enhances the PeerBanHelperServer with the MultiDialingBlocker module, improving its ability to block multiple torrent downloads from the same subnet. This update introduces new configurations, refines language constants for better user feedback, and enhances error handling, ensuring a more robust network management and security framework.

Changes

File Path Change Summary
PeerBanHelperServer.java Added registration of MultiDialingBlocker module
MultiDialingBlocker.java New class for blocking multiple downloads from the same subnet
Lang.java Updated and added string constants for error messages and multi-dialing detection
ProfileUpdateScript.java Added multiDialingBlocker() method with configuration settings
profile.yml New settings for multi-dialing-blocker including subnet mask lengths, tolerances, and cache rules

🐇✨ A hop, a skip, an update's done, With code so sleek, it almost runs. Guarding torrents, one by one, Under the digital moon and sun. Cheers to changes, big and small, In PeerBanHelper's hallowed hall! 🌟🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
Ghost-chu commented 4 months ago

Looks good to me