cli-anything-adguardhome
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecli-anything-adguardhome
cli-anything-adguardhome
Network-wide ad blocking and DNS management via the AdGuard Home REST API. Designed for AI agents and power users who need to manage filtering, DNS rewrites, clients, DHCP, and query logs without a GUI.
通过 AdGuard Home REST API 实现全网络广告拦截与DNS管理。专为无需图形界面(GUI)即可管理过滤规则、DNS重写、客户端、DHCP和查询日志的AI Agent及高级用户设计。
Installation
安装
This CLI is installed as part of the cli-anything-adguardhome package:
bash
pip install cli-anything-adguardhomePrerequisites:
- Python 3.10+
- AdGuard Home must be installed and running
- Install AdGuard Home:
curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
此CLI作为cli-anything-adguardhome包的一部分进行安装:
bash
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
Usage
使用方法
Basic Commands
基础命令
bash
undefinedbash
undefinedShow help
显示帮助信息
cli-anything-adguardhome --help
cli-anything-adguardhome --help
Start interactive REPL mode
启动交互式REPL模式
cli-anything-adguardhome
cli-anything-adguardhome
Check server status
检查服务器状态
cli-anything-adguardhome server status
cli-anything-adguardhome server status
Run with JSON output (for agent consumption)
以JSON格式输出(供Agent使用)
cli-anything-adguardhome --json server status
undefinedcli-anything-adguardhome --json server status
undefinedREPL Mode
REPL交互模式
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-adguardhome当不指定子命令调用时,CLI会进入交互式REPL会话:
bash
cli-anything-adguardhomeEnter commands interactively with tab-completion and history
交互式输入命令,支持自动补全和历史记录
undefinedundefinedCommand Groups
命令组
Config
配置
Connection and configuration management.
| Command | Description |
|---|---|
| Show current connection configuration |
| Save connection settings to a config file |
| Test the connection to AdGuard Home |
连接与配置管理。
| 命令 | 说明 |
|---|---|
| 显示当前连接配置 |
| 将连接设置保存到配置文件 |
| 测试与AdGuard Home的连接 |
Server
服务器
Server status and control commands.
| Command | Description |
|---|---|
| Show server protection status |
| Show AdGuard Home version |
| Restart the AdGuard Home server |
服务器状态与控制命令。
| 命令 | 说明 |
|---|---|
| 显示服务器防护状态 |
| 显示AdGuard Home版本 |
| 重启AdGuard Home服务器 |
Filter
过滤规则
DNS filter list management.
| Command | Description |
|---|---|
| List all configured filter lists |
| Show filtering status |
| Enable or disable filtering globally |
| Add a new filter list by URL |
| Remove a filter list |
| Enable a specific filter list |
| Disable a specific filter list |
| Force-refresh all filter lists |
DNS过滤列表管理。
| 命令 | 说明 |
|---|---|
| 列出所有已配置的过滤列表 |
| 显示过滤功能状态 |
| 全局启用或禁用过滤功能 |
| 通过URL添加新的过滤列表 |
| 删除过滤列表 |
| 启用指定过滤列表 |
| 禁用指定过滤列表 |
| 强制刷新所有过滤列表 |
Blocking
拦截设置
Parental control, safe browsing, and safe search settings.
| Command | Description |
|---|---|
| Show parental control status |
| Enable parental control |
| Disable parental control |
| Show safe browsing status |
| Enable safe browsing |
| Disable safe browsing |
| Show safe search status |
| Enable safe search |
| Disable safe search |
家长控制、安全浏览与安全搜索设置。
| 命令 | 说明 |
|---|---|
| 显示家长控制状态 |
| 启用家长控制 |
| 禁用家长控制 |
| 显示安全浏览状态 |
| 启用安全浏览 |
| 禁用安全浏览 |
| 显示安全搜索状态 |
| 启用安全搜索 |
| 禁用安全搜索 |
Blocked-Services
拦截服务
Manage blocked internet services.
| Command | Description |
|---|---|
| List currently blocked services |
| Set the list of blocked services |
管理被拦截的互联网服务。
| 命令 | 说明 |
|---|---|
| 列出当前被拦截的服务 |
| 设置被拦截服务列表 |
Clients
客户端
Client device management.
| Command | Description |
|---|---|
| List all configured clients |
| Add a new client by name and IP |
| Remove a client |
| Show details for a specific client |
客户端设备管理。
| 命令 | 说明 |
|---|---|
| 列出所有已配置的客户端 |
| 通过名称和IP添加新客户端 |
| 删除客户端 |
| 显示指定客户端的详细信息 |
Stats
统计信息
Query statistics.
| Command | Description |
|---|---|
| Show DNS query statistics |
| Reset all statistics |
| View or update statistics retention interval |
查询统计数据。
| 命令 | 说明 |
|---|---|
| 显示DNS查询统计数据 |
| 重置所有统计数据 |
| 查看或更新统计数据保留间隔 |
Log
日志
DNS query log management.
| Command | Description |
|---|---|
| Show recent DNS query log entries |
| View or update query log settings |
| Clear the query log |
DNS查询日志管理。
| 命令 | 说明 |
|---|---|
| 显示近期DNS查询日志条目 |
| 查看或更新查询日志设置 |
| 清空查询日志 |
Rewrite
DNS重写
DNS rewrite rules.
| Command | Description |
|---|---|
| List all DNS rewrite rules |
| Add a DNS rewrite rule |
| Remove a DNS rewrite rule |
DNS重写规则。
| 命令 | 说明 |
|---|---|
| 列出所有DNS重写规则 |
| 添加DNS重写规则 |
| 删除DNS重写规则 |
DHCP
DHCP
DHCP server management.
| Command | Description |
|---|---|
| Show DHCP server status |
| List active DHCP leases |
| Add a static DHCP lease |
| Remove a static DHCP lease |
DHCP服务器管理。
| 命令 | 说明 |
|---|---|
| 显示DHCP服务器状态 |
| 列出活跃的DHCP租约 |
| 添加静态DHCP租约 |
| 删除静态DHCP租约 |
TLS
TLS
TLS/HTTPS configuration.
| Command | Description |
|---|---|
| Show TLS configuration status |
TLS/HTTPS配置。
| 命令 | 说明 |
|---|---|
| 显示TLS配置状态 |
Examples
示例
Check Server Status
检查服务器状态
bash
cli-anything-adguardhome server status
cli-anything-adguardhome server versionbash
cli-anything-adguardhome server status
cli-anything-adguardhome server versionManage Filter Lists
管理过滤列表
bash
undefinedbash
undefinedList current filters
列出当前过滤列表
cli-anything-adguardhome filter list
cli-anything-adguardhome filter list
Add a new blocklist
添加新的拦截列表
cli-anything-adguardhome filter add --url https://somehost.com/list.txt --name "My List"
cli-anything-adguardhome filter add --url https://somehost.com/list.txt --name "My List"
Refresh all filters
刷新所有过滤列表
cli-anything-adguardhome filter refresh
undefinedcli-anything-adguardhome filter refresh
undefinedDNS Rewrites
DNS重写
bash
undefinedbash
undefinedAdd a local DNS entry
添加本地DNS条目
cli-anything-adguardhome rewrite add --domain "myserver.local" --answer "192.168.1.50"
cli-anything-adguardhome rewrite add --domain "myserver.local" --answer "192.168.1.50"
List all rewrites
列出所有重写规则
cli-anything-adguardhome rewrite list
undefinedcli-anything-adguardhome rewrite list
undefinedClient Management
客户端管理
bash
cli-anything-adguardhome clients add --name "My PC" --ip 192.168.1.100
cli-anything-adguardhome clients listbash
cli-anything-adguardhome clients add --name "My PC" --ip 192.168.1.100
cli-anything-adguardhome clients listQuery Statistics
查询统计数据
bash
undefinedbash
undefinedShow stats (human-readable)
显示统计数据(人类可读格式)
cli-anything-adguardhome stats show
cli-anything-adguardhome stats show
Show stats (JSON for agents)
显示统计数据(供Agent使用的JSON格式)
cli-anything-adguardhome --json stats show
undefinedcli-anything-adguardhome --json stats show
undefinedOutput Formats
输出格式
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (flag): Structured JSON for agent consumption
--json
bash
undefined所有命令支持两种输出模式:
- 人类可读格式(默认):表格、颜色、格式化文本
- 机器可读格式(参数):结构化JSON,供Agent使用
--json
bash
undefinedHuman output
人类可读输出
cli-anything-adguardhome filter list
cli-anything-adguardhome filter list
JSON output for agents
供Agent使用的JSON输出
cli-anything-adguardhome --json filter list
undefinedcli-anything-adguardhome --json filter list
undefinedFor AI Agents
面向AI Agent的使用说明
When using this CLI programmatically:
- Always use flag for parseable output
--json - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use absolute paths for all file operations
- Test connection first with before other commands
config test
以编程方式使用此CLI时:
- 始终使用参数以获得可解析的输出
--json - 检查返回码 - 0表示成功,非零表示错误
- 解析stderr以获取失败时的错误信息
- 使用绝对路径进行所有文件操作
- 先测试连接,在执行其他命令前使用测试连接
config test
More Information
更多信息
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything-plugin
- 完整文档:查看包中的README.md
- 测试覆盖率:查看包中的TEST.md
- 方法说明:查看cli-anything-plugin中的HARNESS.md
Version
版本
1.0.0
1.0.0