Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Aria2 自动 ban 掉迅雷的脚本(仅限 Linux)
(其实开启强制加密 bt-require-crypto=true
后,即可过滤掉大部分国产吸血客户端)
通过 Aria2 rpc (就是API)自动查找迅雷的 peer 然后使用 iptables + ipset 来 ban (所以 windows 不修改是没法用的)
这是不修改 Aria2 源码(其实就是自己太菜了 改不动 CPP)而 ban 掉迅雷的一个办法
当然经过简单改造,就可以屏蔽其它的特定客户端了 (现在的默认配置文件已经屏蔽了 迅雷 / 影音先锋 / qq旋风 / 百度网盘)
依赖 nodejs
ipset
iptables
// 整个脚本是 js 写的,可以轻松移植成别的语言 比如 py
除了 ArchLinux 安装 nodejs 自行参考官方教程
sudo apt-get install ipset
sudo pacman -S ipset yarn
sudo yum install ipset
git clone https://github.com/makeding/aria2_ban_thunder.git # 克隆
cd aria2_ban_thunder
yarn # 安装依赖
# npm install # 也是安装依赖
abt 会读取本地的 aria2.conf
来访问 rpc
默认读取的文件为 /etc/aria2/aria2.conf
可以使用 -c 来指定 aria2 配置文件
node app.js -c <path>
也可以手动使用 -u 与 -s 手动配置
node app.js -u <url> -s <key>
参考配置
[Unit]
Description=aria2 ban thunder via ipset
After=network.target
[Service]
Type=forking
User=root
Restart=on-failure
RestartSec=5s
# 这里的路径自己改改
ExecStart=/root/.aria2/aria2_ban_thunder/startup.sh
ExecStop=/root/.aria2/aria2_ban_thunder/shutdown.sh
[Install]
WantedBy=multi-user.target
路径:
/etc/systemd/system/aria2_ban_thunder.service
(或者其它你喜欢的服务名)
systemctl daemon-reload
systemctl enable aria2_ban_thunder.service
systemctl start aria2_ban_thunder.service
# 自己安装
# yarn global add pm2
# pacman -S pm2 # ArchLinux
pm2 start --name 'aria2_ban_thunder' app.js
pm2 save
pm2 startup
客户端 | Peer名称 |
---|---|
迅雷 | XL SD |
影音先锋 | XF |
qq旋风 | QD |
百度网盘 | BN(可能) |
未知 | unknow |
以上吸血 peer 参考了来自隔壁的 qBittorrent-Enhanced-Edition 项目的源码,在这里表示感谢
如果还想屏蔽更多的 bt 客户端,可以参考 参考这边的源码 (没有什么必要啦 就迅雷之类的会吸血)
ban 未知的 peer 按照需求添加
如果你觉得好用请推荐给别人
有什么问题 发 issue 就可以了,或者自己改改 发个 pr
MIT
FAQs
Aria2 自动 ban 掉迅雷的脚本(仅限 Linux)
We found that aria2-mod demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.