Watch mode is used for continuous asset change monitoring: it periodically rescans the seed assets, diffs against the previous result, outputs newly added/disappeared assets, and optionally pushes alerts via Webhook. It suits "delta + network hang-up alerting" scenarios.
Startup¶
- Seeds only support
domainandurl(not ip) - Each round uses a brand-new engine instance to run a full scan
Ctrl+Cexits gracefully
Main Configuration¶
monitoring:
interval: 3600 # polling interval (seconds); e.g., 0 = exit right after completing the first baseline round
webhook_url: null # change alert Webhook URL (POST JSON)
The switch is decided by the CLI
Entering watch mode is decided by the --watch argument; the code actually only reads interval and webhook_url.
Workflow¶
Each round of the loop:
- Check the global stop flag; if set, exit
engine.run()runs the full scan for this round- Collect the current asset UID set as
cur_uids - First round establishes the baseline: if
prev_uidsis empty → record the baseline, logBaseline established: N assets, wait one interval, then move to the next round (no changes are reported in the first round) - Delta comparison:
added = cur_uids − prev_uids # newly added assets
removed = prev_uids − cur_uids # disappeared assets
- Change report:
- When there are changes, write
changesto<output_dir>/changes_YYYYMMDD_HHMMSS.jsonand logChanges detected: +N added, -N removed - When
webhook_urlis configured,POST json=changes(10-second timeout) and log by status code; on exception, logWebhook notification failed -
When there are no changes, log
No changes detected -
Interval scheduling:
sleep = max(0, interval − elapsed time of this round), i.e., subtract the scan duration before waiting
Example Change File¶
output/changes_20260812_231800.json:
{
"timestamp": "2026-08-12T23:20:00",
"added": ["domain:new.example.com", "ip:93.184.216.35"],
"removed": ["url:https://old.example.com/"]
}
Webhook Alerts¶
Configure monitoring.webhook_url to receive a POST JSON request whenever changes are detected. The payload is the changes structure above. Typical webhook receivers include WeCom (WeChat Work) bots, Slack, self-hosted services, etc.
Relationship with resume-from-breakpoint
--watch creates a brand-new engine each round, does not rely on checkpoints, and does not reuse the previous round's asset graph. It only depends on the set difference of UID sets.
No changes counted in the first round
The first round only establishes the baseline; no changes file or Webhook notification is produced. Incremental diffs start from the second round.