Communitygithub.com

cli-anything-adguardhome

通过 AdGuard Home REST API 实现网络级广告拦截和 DNS 管理,专为 AI 代理和高级用户设计。

cli-anything-adguardhome 是什么?

cli-anything-adguardhome 是一个基于命令行的工具,通过 AdGuard Home REST API 实现网络级广告拦截和 DNS 管理。它面向 AI 代理和高级用户,无需图形界面即可管理过滤规则、DNS 重写、客户端设备、DHCP 和查询日志。该工具支持交互式 REPL 模式、人类可读表格输出和机器可读的 JSON 输出(通过 --json 标志)。从 CLI 方面看,它包含多个命令组:config(连接配置)、server(服务器状态)、filter(DNS 过滤列表)、blocking(家长控制和安全浏览)、clients(客户端管理)、stats(查询统计)、log(查询日志)、rewrite(DNS 重写)、dhcp(DHCP 管理)和 tls(TLS 配置)。对于 AI 代理,建议始终使用 --json 标志获取可解析的输出,并检查返回码。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-adguardhome

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

cli-anything-adguardhome 是做什么的?

通过 AdGuard Home REST API 实现网络级广告拦截和 DNS 管理。专为 AI 代理和高级用户设计,无需图形界面即可管理过滤、DNS 重写、客户端、DHCP 和查询日志。

安装

该 CLI 作为 cli-anything-adguardhome 包的一部分安装:

pip install cli-anything-adguardhome

前置条件:

  • Python 3.10+
  • 必须安装并运行 AdGuard Home
  • 安装 AdGuard Home:curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v

用法

基本命令

# 显示帮助
cli-anything-adguardhome --help

# 启动交互式 REPL 模式
cli-anything-adguardhome

# 检查服务器状态
cli-anything-adguardhome server status

# 以 JSON 输出运行(供代理使用)
cli-anything-adguardhome --json server status

REPL 模式

当不带子命令调用时,CLI 进入交互式 REPL 会话:

cli-anything-adguardhome
# 使用制表符补全和历史记录交互式输入命令

命令组

Config

连接和配置管理。

命令描述
show显示当前连接配置
save将连接设置保存到配置文件
test测试与 AdGuard Home 的连接

Server

服务器状态和控制命令。

命令描述
status显示服务器保护状态
version显示 AdGuard Home 版本
restart重启 AdGuard Home 服务器

Filter

DNS 过滤列表管理。

命令描述
list列出所有配置的过滤列表
status显示过滤状态
toggle全局启用或禁用过滤
add通过 URL 添加新的过滤列表
remove移除过滤列表
enable启用特定过滤列表
disable禁用特定过滤列表
refresh强制刷新所有过滤列表

Blocking

家长控制、安全浏览和安全搜索设置。

命令描述
parental status显示家长控制状态
parental enable启用家长控制
parental disable禁用家长控制
safebrowsing status显示安全浏览状态
safebrowsing enable启用安全浏览
safebrowsing disable禁用安全浏览
safesearch status显示安全搜索状态
safesearch enable启用安全搜索
safesearch disable禁用安全搜索

Blocked-Services

管理被拦截的互联网服务。

命令描述
list列出当前被拦截的服务
set设置被拦截的服务列表

Clients

客户端设备管理。

命令描述
list列出所有配置的客户端
add按名称和 IP 添加新客户端
remove移除客户端
show显示特定客户端的详细信息

Stats

查询统计。

命令描述
show显示 DNS 查询统计
reset重置所有统计
config查看或更新统计保留间隔

Log

DNS 查询日志管理。

命令描述
show显示最近的 DNS 查询日志条目
config查看或更新查询日志设置
clear清除查询日志

Rewrite

DNS 重写规则。

命令描述
list列出所有 DNS 重写规则
add添加 DNS 重写规则
remove移除 DNS 重写规则

DHCP

DHCP 服务器管理。

命令描述
status显示 DHCP 服务器状态
leases列出活动的 DHCP 租约
add-static添加静态 DHCP 租约
remove-static移除静态 DHCP 租约

TLS

TLS/HTTPS 配置。

命令描述
status显示 TLS 配置状态

示例

检查服务器状态

cli-anything-adguardhome server status
cli-anything-adguardhome server version

管理过滤列表

# 列出当前过滤器
cli-anything-adguardhome filter list

# 添加新的黑名单
cli-anything-adguardhome filter add --url https://somehost.com/list.txt --name "我的列表"

# 刷新所有过滤器
cli-anything-adguardhome filter refresh

DNS 重写

# 添加本地 DNS 条目
cli-anything-adguardhome rewrite add --domain "myserver.local" --answer "192.168.1.50"

# 列出所有重写
cli-anything-adguardhome rewrite list

客户端管理

cli-anything-adguardhome clients add --name "我的电脑" --ip 192.168.1.100
cli-anything-adguardhome clients list

查询统计

# 显示统计(人类可读)
cli-anything-adguardhome stats show

# 显示统计(JSON 供代理使用)
cli-anything-adguardhome --json stats show

输出格式

所有命令支持双输出模式:

  • 人类可读(默认):表格、颜色、格式化文本
  • 机器可读(--json 标志):供代理使用的结构化 JSON
# 人类输出
cli-anything-adguardhome filter list

# 供代理使用的 JSON 输出
cli-anything-adguardhome --json filter list

针对 AI 代理

以编程方式使用此 CLI 时:

  1. 始终使用 --json 标志 以获得可解析的输出
  2. 检查返回码 - 0 表示成功,非零表示错误
  3. 解析 stderr 以获取失败时的错误消息
  4. 对所有文件操作使用绝对路径
  5. 在其他命令之前先用 config test 测试连接

更多信息

  • 完整文档:见包中 README.md
  • 测试覆盖率:见包中 TEST.md
  • 方法论:见 cli-anything-plugin 中的 HARNESS.md

版本

1.0.0

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

cli-anything-inkscape

>-

相关技能