bandwhich
$ bandwhich 社区开源 中风险bandwhich 通过抓包嗅探网卡,实时展示按本地进程、连接和远端地址统计的上传/下载吞吐量(sudo bandwhich)。支持 --raw 标准输出模式(搭配 -n 跳过 DNS 解析)以便文本采集,但会持续流式输出且不支持 JSON 或内置采样次数上限。
brew install bandwhich 实时嗅探本机网卡数据包并与操作系统 PID 套接字表关联(bandwhich --raw);MCP 工具无法进行内核级进程流量归因。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
提供 --raw 以绕过 TUI 输出纯文本流,但缺乏采样次数上限、无 JSON 格式,且通常需要 sudo 交互或预先授权。
--rawprints unformatted text lines to stdout- No JSON output, no
--countlimit, and requiressudo
纯粹的只读流量统计且不写入磁盘,但抓包嗅探需要 root/sudo 或 CAP_NET_RAW/CAP_NET_ADMIN 权限。
- Read-only passive monitor requiring elevated packet-capture privileges
单一 Rust 二进制,可通过 brew install bandwhich、cargo install 与 GitHub Releases 在三大平台安装。
- Cross-platform binary via Homebrew, Cargo, and releases
能独特地将实时带宽归因到本地进程(-p)、连接(-c)与远端地址,但连续文本流对 Agent 而言噪声较大。
- Correlates packet throughput to local process names/PIDs
开源社区 Rust 项目(imsnif/bandwhich),采用 MIT 协议。
- Maintained at
imsnif/bandwhich
简明的 README 与 bandwhich --help 覆盖了 --raw 及权限配置说明。
- GitHub README and
bandwhich --help
安全边界、鉴权与放权指南
无需认证凭据;运行需要 sudo 或 CAP_NET_RAW/CAP_NET_ADMIN 抓包权限。
免费,基于 MIT 开源协议的 Rust 二进制工具。
# bandwhich Agent Rules - Never run bare `bandwhich` in an agent shell—it launches an infinite curses TUI; always use `--raw` under an explicit timeout. - Confirm user approval before invoking `sudo bandwhich` for packet capture privileges.
Agent 高频安全命令配方
只读查询(安全推荐)
bandwhich --help
输出选项(--raw、-i、-n、--processes、--connections)而不启动抓包。
sudo bandwhich --raw -n -p
在跳过 DNS 解析(-n)的情况下以 --raw -p 持续输出按进程统计的吞吐量文本,直至被终止。
核心优势
- + 可将实时网卡带宽直接归因到本地操作系统进程与远端节点。
- +
--raw模式可在需要捕获标准输出时避开 curses TUI 渲染。
注意事项与踩坑点
- ! 会持续输出直至被杀掉——缺少内置
--count或运行时长限制,且不支持 JSON 输出。 - ! 抓包需要
sudo或配置 Linux capabilities 权限。