Files
AirCoding/AirPlan/docs/spec/AirPlan-ParaV2/plugins/airndb/commands/airndb.md
AirCoding ae44be31d5 chore: push all design docs, V2 plan specs, and current working state
Includes AirPlan design documents, AircOding-alpha1-plan, AirPlanV2,
AirPlan-ParaV2, AirPlan-Para V1 reference docs, and all working code
changes across packages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 17:12:29 +08:00

4.9 KiB
Executable File
Raw Blame History

description, argument-hint, allowed-tools
description argument-hint allowed-tools
Enter, exit, inspect, capture, remote-capture, or read AirNDB tcpdump/WinDump network debug mode
enter|setup|exit|status|interfaces|command|capture|read|remote-setup|remote-status|remote-interfaces|remote-command|remote-capture
Read
Glob
Grep
Bash
Write
Edit

/airndb

控制当前工作区的 AirNDB 网络抓包调试模式。

用户传入参数:$ARGUMENTS

  • enter 或空参数:进入 AirNDB 模式并初始化网络调试上下文。
  • status:检查 AirNDB 状态和关键文件是否存在。
  • setup执行首启工具自检Windows 下缺少 tcpdump/WinDump 时自动下载官方 WinDump.exe 并写入 AirPlan/state/airndb/tool.env
  • interfaces:调用 tcpdump/WinDump 列出可抓包接口。
  • command:生成安全、有界的 tcpdump/WinDump 抓包命令,不实际执行。
  • capture:执行短时有界抓包,写入 timestamped .pcap 和 JSON 报告。
  • read:读取已有 .pcap,生成文本摘要和 JSON 报告。
  • remote-setup:检查远程设备 SSH 和抓包工具;缺失时自动尝试配置远程 tcpdump
  • remote-status:只检查远程设备配置和工具状态,不自动安装。
  • remote-interfaces:通过 SSH 调用远端抓包工具列出接口。
  • remote-command:生成安全、有界的远程抓包命令,不实际执行。
  • remote-capture:通过 SSH 执行短时有界远程抓包,并把 pcap/JSON 报告拉回当前项目。
  • exit:退出 AirNDB 模式。

执行步骤

  1. 解析 $ARGUMENTS,默认动作为 enter
  2. 在当前项目根目录运行;enter / setup 会检测 tcpdump / WinDump.exeWindows 缺失时自动从 WinDump 官方下载页获取 WinDump.exe,校验 SHA1 后配置 AirPlan/state/airndb/tool.env
python "$HOME/plugins/airndb/scripts/airndb_mode.py" --mode <enter|setup|exit|status> --project .

如果 python 不存在,尝试 pypython3 或用户提供的 Python 绝对路径。

  1. 如果 $ARGUMENTS 包含 remotessh远程或用户已经说明目标流量在远程设备、测试机、服务器、VM、容器宿主机、SSH 主机上,优先运行远程设备 helper
python "$HOME/plugins/airndb/scripts/airndb_remote_device.py" --project . --action <setup|status|interfaces|command|capture>

首次缺少远程配置时helper 会生成 AirPlan/state/airndb/remote-device.env.example 并提示设置 AIRNDB_REMOTE_SSH_TARGET。有 SSH 目标后helper 会探测远端 tcpdump / dumpcap;缺失时自动尝试安装 tcpdump,只使用非交互式 sudo -n,无法自动配置时停止并提示用户。

  1. interfaces 且目标是本机时运行:
python "$HOME/plugins/airndb/scripts/airndb_capture.py" --project . --action interfaces
  1. command 且目标是本机时先收集接口、host/port/protocol/filter、包数或超时再运行
python "$HOME/plugins/airndb/scripts/airndb_capture.py" --project . --action command --iface <iface> --filter "<bpf>" --count 200
  1. capture 且目标是本机时必须使用有界抓包:
python "$HOME/plugins/airndb/scripts/airndb_capture.py" --project . --action capture --iface <iface> --filter "<bpf>" --count 200 --timeout 30
  1. read 时读取已有 pcap
python "$HOME/plugins/airndb/scripts/airndb_capture.py" --project . --action read --read-file docs/network/airndb-captures/<file>.pcap --filter "<bpf>"
  1. 每次抓包或读取后维护:
  • AirPlan/docs/network/airndb-log.md
    • docs/architecture/adr/
    • docs/architecture/c4/module.md
    • AGENTS.md

安全边界

  • 只抓取用户授权的本机、项目、测试环境或明确允许的网络流量。
  • 默认禁止无界抓包;必须使用 --count--timeout 或轮转策略。
  • 默认使用 -nn-s 0,避免 DNS/service-name 解析并保留完整包。
  • 自动获取仅下载 WinDump.exe 并配置工具路径,不静默安装 WinPcap/Npcap 抓包驱动;接口列举失败时提示用户安装驱动或以管理员权限重试。
  • pcap 可能包含凭据、cookie、token、内网地址或个人信息对外分享前必须提醒脱敏。

输出文案

进入模式:

AirNDB 模式已开启:已初始化或检查 AGENTS.md、ADR、C4 module 和 network debug log并完成 tcpdump/WinDump 工具自检。请说明网络问题、目标主机/端口/协议、抓包接口和允许的抓包窗口。

抓包完成:

AirNDB 抓包完成pcap 和 JSON 报告已写入 docs/network/airndb-captures/,请结合 airndb-log.md 继续分析。

remote-capture 完成:

AirNDB 远程抓包完成:已通过 SSH 执行有界抓包pcap 和 JSON 报告已写入 docs/network/airndb-captures/,请结合 airndb-log.md 继续分析。

状态检查:

AirNDB 状态:<enabled|disabled>
关键文件:逐项列出 ok/missing。