feat(asm): attack-surface management — external discovery, continuous monitoring, engagement - #198
Open
ehartford wants to merge 1 commit into
Open
feat(asm): attack-surface management — external discovery, continuous monitoring, engagement#198ehartford wants to merge 1 commit into
ehartford wants to merge 1 commit into
Conversation
Clearwing is deep on a known target but had no way to discover what's out there, track what changes, or organize a surface across runs. This adds that front half — reimagined agentically and feeding the existing deep scanning / verification pipeline — ported from the ideas in Sn1per without its shallow version-only detection. New `clearwing/asm/` subsystem + a `clearwing asm` command: - assets.py / scope.py — a scope-keyed SQLite AssetStore (modeled on HistoricalFindingsDB) with idempotent ingest and delta detection (record_observations returns only NEW assets), and a Scope engagement model. - discovery.py + agent/tools/recon/discovery_tools.py — passive-first, host-safe discovery as pure-Python @tool functions: crt.sh certificate transparency, Wayback URL mining, optional GitHub/Shodan/Censys, DNS resolution, HTTP liveness + tech fingerprint, and a screenshot gallery. Orchestrated into a normalized asset hierarchy and projected into the knowledge graph. - monitor.py — continuous ASM poll loop (modeled on CommitMonitor): each cycle discovers, records the delta, emits ASSET_DISCOVERED, and drives the existing port/service/vuln scanners on new hosts. Never exploits or triggers approval-gated actions automatically. - notify.py — outbound Slack/generic webhook notifier (the missing outbound half), subscribing to ASSET_DISCOVERED / FINDING_RECORDED, best-effort. - threatintel.py — CISA KEV + EPSS enrichment; findings sort KEV-first. - sweep.py — mass parallel scanning across a discovered surface. - modes.py — named playbooks (recon, stealth, web-assessment, external-sweep). - report.py — per-scope aggregate markdown/json reports. Wiring: an `asm` config section, EventType.ASSET_DISCOVERED + payload, knowledge -graph entity/relationship types (domain/subdomain/url/technology), the discovery tool category in get_all_tools(), the `asm` CLI subcommand (scan/monitor/sweep/report/list), and read-only web endpoints + WebSocket event. Tests: 48 focused ASM tests (store delta, discovery, monitor, notifier, threat-intel, sweep, modes, report, CLI). Docs: docs/asm.md, a cli.md section, README. Full ASM suite + shared-file regressions green; ruff clean.
ehartford
force-pushed
the
feat/asm-attack-surface
branch
from
August 29, 2026 23:36
0b11d47 to
5c51032
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the discovery/continuity/engagement ideas from Sn1per into Clearwing — reimagined agentically and feeding Clearwing's existing deep scanning/verification, without copying Sn1per's shallow version-only detection (the false-positive firehose Clearwing exists to avoid).
Why
Clearwing is deep on a known target but had no way to discover what's out there, track what changes over time, or organize a surface across runs.
scanner_toolsonly scans a host you already supply. This adds the missing front half.What (new
clearwing/asm/subsystem +clearwing asmcommand)assets.py/scope.pyHistoricalFindingsDB;record_observationsreturns only the new assets (delta detection).discovery.py+agent/tools/recon/discovery_tools.py@tools: crt.sh cert transparency, Wayback, optional GitHub/Shodan/Censys, DNS resolution, HTTP liveness + tech fingerprint, screenshot gallery. Projected into the knowledge graph.monitor.pyCommitMonitor): discover → delta →ASSET_DISCOVERED→ scan new hosts. Never exploits or triggers approval-gated actions automatically.notify.pyASSET_DISCOVERED/FINDING_RECORDED, best-effort.threatintel.pysweep.pymodes.pyreport.pyWiring (additive, with baselines updated): an
asmconfig section;EventType.ASSET_DISCOVERED+ payload; knowledge-graph entity/relationship types (domain/subdomain/url/technology); the discovery tool category inget_all_tools(); theasmCLI subcommand (scan/monitor/sweep/report/list); read-only web endpoints + a WebSocket event.Design choices
proxy_request/scan_ports. Heavy active enum is left to the Kali container. ASM never auto-exploits.AssetStoreis authoritative for "what's new since last run"; the knowledge graph is a queryable/visualizable projection.asm monitoris a poll loop (daemon or--oncefor cron /clearwing schedule) — the repo has no scheduler library.Tests / docs
48 focused ASM tests (store delta, discovery, monitor, notifier, threat-intel, sweep, modes, report, CLI) — all green, plus shared-file regressions (events, tool registry, knowledge, config, webui, scanner, reporting) pass; ruff clean; two baseline tests updated for the new event + 6 new tools. Docs:
docs/asm.md, adocs/cli.mdsection, README, mkdocs nav.Note
This is a large single PR (~2.8k lines) by request — organized so each layer is an independent module with its own tests. Happy to split if the team prefers.