# bootlens **Repository Path**: tomlen/bootlens ## Basic Information - **Project Name**: bootlens - **Description**: bootlens - macOS launchd job auditor in one file: ghost binaries (uninstall leftovers), suspect locations (/tmp, /Users/Shared, .spawn), KeepAlive/RunAtLoad persistence, root daemons, sibling plists, label-file mismatch, baseline drift (NEW/GONE/CHANGED), 10-invariant selftest with hostile fixtures. Zero dependencies, read-only evidence, cron exit codes 0/3/4. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-15 - **Last Updated**: 2026-11-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # bootlens — launchd 作业户口透视镜 回答一个问题:**这台 Mac 的 launchd 里到底养着什么,谁是雷。** 半夜磁盘报警你查过,定时任务跑没跑 [cronguard](https://github.com/tomlen045/cronguard) 盯过, 备份产物死活 [bakcheck](https://github.com/tomlen045/bakcheck) 验过—— 但**开机就自动跑、崩溃还自动复活**的那批 launchd 作业,一直没人管。 bootlens 是自研运维透镜套件的新成员([hostlens](https://github.com/tomlen045/hostlens) 看 known_hosts、[envlens](https://github.com/tomlen045/envlens) 看 ssh config、 [userlens](https://github.com/tomlen045/userlens) 看 Unix 账号),它看的是 `LaunchAgents` / `LaunchDaemons`:**四份户口本,一条命令翻完。** ## 它查什么(BL-01..09) | 代码 | 名称 | 级别 | 一句话 | |---|---|---|---| | BL-01 | GHOST_BIN | critical | 程序路径已不存在——卸载残留,launchd 还在空转 | | BL-02 | SUSPECT_LOC | critical | 落点在 /tmp、/Users/Shared 或带 `.spawn` 类伪装前缀 | | BL-03 | KEEPALIVE | warn | KeepAlive 常驻,崩溃自动拉起 | | BL-04 | QUEEN_RUN | warn | RunAtLoad+KeepAlive 双开:登录即起、永不退出 | | BL-05 | ROOT_DAEMON | info/warn | root 级 LaunchDaemon(陌生前缀加重) | | BL-06 | SIBLING_PLIST | warn | 同一 label 在多个目录重复注册 | | BL-07 | OVERLAP_ARGS | info | 多个作业拉起同一个程序 | | BL-08 | WEIRD_LABEL | warn | label 与文件名不一致(注册名被人动过) | | BL-09 | DISABLED_STALE | info | 已禁用作业的残骸(观察项) | 外加基线漂移:`--save-baseline` 存档,之后 `--baseline` 一比—— **新长出来的、被删掉的、被人改过开关的**(NEW / GONE / CHANGED)全数报出。 ## 快速开始 ```bash # 全机审计(exit 0=干净 3=有warn 4=有critical,可直接进 cron) python3 bootlens.py # 存基线 -> 任何时刻比对漂移 python3 bootlens.py --save-baseline baseline.json python3 bootlens.py --baseline baseline.json # 自检 10 条不变量(含恶意 fixture 故障注入) python3 bootlens.py --selftest # 生成演示 launchd 森林(写 /tmp,不动真机)并演练全流程 python3 bootlens.py --demo /tmp/bootlens-demo python3 bootlens.py --scan-dir /tmp/bootlens-demo/Library/LaunchAgents \ --scan-dir /tmp/bootlens-demo/Library/LaunchDaemons ``` ## 设计不变量(INV-01..10) 确定性输出(同输入同输出、排序稳定)、severity 三值域、summary 账目闭合、 exit code 表 0/3/4、基线缺 key **fail-loud 不静默**、恶意 plist(超长 label / 路径穿越 / 参数注入)不炸不执行不写盘——全部可由 `--selftest` 验证。 ## 边界(诚实版) - 只读取证;唯一写盘动作是你显式指定的 baseline/demo 输出。 - 静态审计工具,不做行为监控、不做杀毒判定。BL-02/05 是「值得人工看一眼」, 不是「这就是病毒」。 - `--liborder` 类厂商名单不参与自动核对:厂商随安装方式千变万化, 自动判「未知=危险」会制造海量误报——bootlens 给的是清单,判断留给你。 - launchctl 运行态(PID/上次退出码)不在本工具范围,那是 cronlens 的活(规划中)。 ## License MIT