Cleanup & Restoration Plan Generator
The cleanup plan is the anti-foothold roster — every artifact the kill chain will create must have a concrete removal command and a verifier, or dummy accounts / scheduled tasks / beacons routinely outlive the engagement.
When to Use
- When designing or revising cleanup requirements; the proposed kill chain determines expected artifacts
- User says "create cleanup plan", "list what we'll leave behind", "post-engagement teardown"
Workflow
Step 1: Map Kill Chain Phases → Expected Artifact Types
For every phase in CONOPS.kill_chain, infer which CleanupArtifact.artifact_type entries will be produced:
| Kill Chain Phase |
Likely artifact_types |
| recon |
tool (installed scanners), network-rule (firewall whitelist) |
| initial-access |
account (test users), file (uploaded payloads), tool (web shells) |
| post-exploit |
persistence-mechanism (scheduled-task / service / registry-run), account (created backdoor users), file (dropped binaries) |
| c2 |
beacon (C2 implants), network-rule (egress allow), tool (sliver / cobalt-strike payloads) |
| exfiltration |
file (staged exfil archives), network-rule (DNS tunneling) |
Step 2: Seed CleanupArtifact entries
For each expected artifact, set:
artifact_type — category above
host — placeholder (e.g. "<initial-access target>") — operations agents replace at run time
path — likely filesystem / registry / account-name location
persistence_mech — concrete mechanism if applicable
removal_command — idempotent shell or API call to remove
verifier_command — zero-exit on success
created_by_objective — left blank; operations agents fill on creation
removed=False, removed_at=""
Step 3: Pre-engagement Baseline
Set pre_engagement_baseline to whatever snapshot reference the operator gives during the interview (volume ID, AWS AMI, hypervisor snapshot, manual filesystem hash list). If no baseline is available, record that explicitly — it's a critical risk signal for the engagement owner.
Step 4: Completion Criteria
Default schema text covers most engagements. Override only when the engagement specifies different completion semantics (e.g. "leave honeyfile FILE_X in place for blue team training" — note as a cancellation_reason on that artifact later).
Validation Checklist
Before writing plan/cleanup.json:
Anti-patterns
- Leaving
removal_command empty — operations agents will skip the artifact entirely
- Putting absolute paths from the operator's machine (engagement workspace is
/workspace/<eng> inside the sandbox; cleanup runs on TARGETS not the workspace)
- Forgetting C2 beacons — the kill chain's c2 phase is the most common omission
Output
Write to plan/cleanup.json validating against decepticon.core.schemas.CleanupPlan.
Document schema (derived from the validator's model)
plan/cleanup.json must validate against CleanupPlan. Fields not listed here are not part of the model and are ignored by the validator.
| field |
type |
required |
allowed values / nested keys |
engagement_name |
str |
yes |
|
completion_criteria |
str |
no |
|
artifacts |
list[CleanupArtifact] |
no |
each object: artifact_type, host, path, sha256, persistence_mech, removal_command, verifier_command, created_by_objective, removed, removed_at |
pre_engagement_baseline |
str |
no |
|
version |
str |
no |
|
last_updated |
str |
no |
|
CleanupArtifact object:
| field |
type |
required |
allowed values |
artifact_type |
str |
yes |
|
host |
str |
yes |
|
path |
str |
yes |
|
sha256 |
str |
no |
|
persistence_mech |
str |
no |
|
removal_command |
str |
yes |
|
verifier_command |
str |
no |
|
created_by_objective |
str |
no |
|
removed |
bool |
no |
|
removed_at |
str |
no |
|
1---2name: cleanup-template3description: "Cleanup & restoration plan generator — artifact inventory, persistence removal commands, pre-engagement baseline, post-engagement verification."4allowed-tools: Read Write Edit5metadata:6 source: https://skillmd.com/skills/purpleailab/cleanup-template7 skillogy:8 version: 19 subdomain: planning10 when_to_use: "create cleanup plan, artifact inventory, persistence removal, post-engagement teardown, restoration plan"11 tags: cleanup, restoration, persistence, post-engagement, hygiene12 upstream_ref: "Soundwave cleanup template — artifact inventory, persistence removal, restoration plan"13---1415# Cleanup & Restoration Plan Generator1617The cleanup plan is the **anti-foothold roster** — every artifact the kill chain will create must have a concrete removal command and a verifier, or dummy accounts / scheduled tasks / beacons routinely outlive the engagement.1819## When to Use2021- When designing or revising cleanup requirements; the proposed kill chain determines expected artifacts22- User says "create cleanup plan", "list what we'll leave behind", "post-engagement teardown"2324## Workflow2526### Step 1: Map Kill Chain Phases → Expected Artifact Types2728For every phase in CONOPS.kill_chain, infer which `CleanupArtifact.artifact_type` entries will be produced:2930| Kill Chain Phase | Likely artifact_types |31|---|---|32| recon | `tool` (installed scanners), `network-rule` (firewall whitelist) |33| initial-access | `account` (test users), `file` (uploaded payloads), `tool` (web shells) |34| post-exploit | `persistence-mechanism` (scheduled-task / service / registry-run), `account` (created backdoor users), `file` (dropped binaries) |35| c2 | `beacon` (C2 implants), `network-rule` (egress allow), `tool` (sliver / cobalt-strike payloads) |36| exfiltration | `file` (staged exfil archives), `network-rule` (DNS tunneling) |3738### Step 2: Seed CleanupArtifact entries3940For each expected artifact, set:41- `artifact_type` — category above42- `host` — placeholder (e.g. ``"<initial-access target>"``) — operations agents replace at run time43- `path` — likely filesystem / registry / account-name location44- `persistence_mech` — concrete mechanism if applicable45- `removal_command` — idempotent shell or API call to remove46- `verifier_command` — zero-exit on success47- `created_by_objective` — left blank; operations agents fill on creation48- `removed=False`, `removed_at=""`4950### Step 3: Pre-engagement Baseline5152Set `pre_engagement_baseline` to whatever snapshot reference the operator gives during the interview (volume ID, AWS AMI, hypervisor snapshot, manual filesystem hash list). If no baseline is available, record that explicitly — it's a critical risk signal for the engagement owner.5354### Step 4: Completion Criteria5556Default schema text covers most engagements. Override only when the engagement specifies different completion semantics (e.g. "leave honeyfile FILE_X in place for blue team training" — note as a cancellation_reason on that artifact later).5758## Validation Checklist5960Before writing `plan/cleanup.json`:6162- [ ] Every CONOPS phase that creates persistence has a matching artifact entry63- [ ] Every artifact has a non-empty `removal_command`64- [ ] No artifact's `path` references an out-of-scope host65- [ ] `pre_engagement_baseline` is either set or explicitly marked "no baseline available"6667## Anti-patterns6869- Leaving `removal_command` empty — operations agents will skip the artifact entirely70- Putting absolute paths from the operator's machine (engagement workspace is `/workspace/<eng>` inside the sandbox; cleanup runs on TARGETS not the workspace)71- Forgetting C2 beacons — the kill chain's c2 phase is the most common omission7273## Output7475Write to `plan/cleanup.json` validating against `decepticon.core.schemas.CleanupPlan`.7677## Document schema (derived from the validator's model)7879`plan/cleanup.json` must validate against `CleanupPlan`. Fields not listed here are not part of the model and are ignored by the validator.8081| field | type | required | allowed values / nested keys |82| --- | --- | --- | --- |83| `engagement_name` | str | yes | |84| `completion_criteria` | str | no | |85| `artifacts` | list[CleanupArtifact] | no | each object: `artifact_type`, `host`, `path`, `sha256`, `persistence_mech`, `removal_command`, `verifier_command`, `created_by_objective`, `removed`, `removed_at` |86| `pre_engagement_baseline` | str | no | |87| `version` | str | no | |88| `last_updated` | str | no | |8990`CleanupArtifact` object:9192| field | type | required | allowed values |93| --- | --- | --- | --- |94| `artifact_type` | str | yes | |95| `host` | str | yes | |96| `path` | str | yes | |97| `sha256` | str | no | |98| `persistence_mech` | str | no | |99| `removal_command` | str | yes | |100| `verifier_command` | str | no | |101| `created_by_objective` | str | no | |102| `removed` | bool | no | |103| `removed_at` | str | no | |