Triage and Incident Response Scripts

Preserve observations, reproduce the timeline, and distinguish inference from evidence.

Scope comes before collection

The scenario permits owned synthetic files and a bounded current-process snapshot.

Record the question, approved account/host, commands, output paths, time convention, statuses, and excluded actions. Collection itself changes live state.

No service termination, account disabling, address blocking, or file deletion is part of this exercise.

Preserve raw and derived artifacts separately

raw JSONL -> checked hash -> sorted view / duplicate review -> report
     |                                                     |
 unchanged raw hash                                  report hash

A matching digest supports an integrity comparison, not source truthfulness or collection completeness.

Actual volatile snapshot values are captured locally; saved lesson output does not invent a fixed PID.

Rows and events are different counts

The raw fixture contains five rows. E2 is repeated exactly; four unique fixture events remain after the duplicate policy is verified.

A repeated ID is not universally a duplicate: IDs can recur across hosts/sources or conflict. The builder refuses conflicting same-ID records instead of silently choosing one.

Original rows are retained.

Chronology is not intent

14:00 E1 auth_failure
14:01 E2 auth_failure
14:02 E3 auth_success
14:03 E4 service_restart (CHG-42 reference)

All fixture times use UTC Z with equal precision. Two failures before success can have legitimate explanations. The maintenance reference needs its own corroboration.

Clock skew and mixed timestamp formats constrain real cross-host ordering.

Match the intended field exactly

jq -r 'select(.source == "192.0.2.25") | .event_id' candidates.jsonl

The fixture selects A and excludes the different address ending in .250.

A watch-list match is a review cue with provenance, not an automatic malicious classification. No indicator address is contacted.

Inventory adds context, not attribution

The supplied account list includes student and operator; CHG-42 appears in approved changes.

An account name does not prove which human acted. An approved-change reference does not by itself establish execution scope/time.

Keep observations, competing hypotheses, corroborating evidence, and next checks separate.

The builder has a narrow checked contract

  • Supplied one-host JSONL scenario only.
  • Required fields and conflicting IDs checked.
  • Output staged and published after success.
  • Output aliasing raw input refused.
  • Report contains counts, timeline, scope, and limitations.
  • Attribution is not established.

For the fixture: raw 5, unique 4, failed-auth events 2, successful-auth events 1.

Verify failure and recovery too

Case Outcome
Malformed JSON / conflicting IDs Refuse; preserve prior report
Output aliases input Refuse; preserve raw data
Empty input Refuse
Wrong argument count Status 2
Recovery after failure Identical report; staging cleaned

All six contracts pass on macOS and both Linux environments. This is not exhaustive timing/concurrency coverage.

Assemble the collection on your VM

Assemble the collection with raw inputs, scope/method/status records, integrity manifest, reviewed timeline, findings, hypotheses, and limits.

Another authorized reader should reproduce the counts from preserved inputs. A valid collection/report is not proof of a complete forensic investigation or permission for containment.

Context: NIST SP 800-61 Rev. 3 and earlier ThinkBash modules, linked in the lessons. All event/account/address records are synthetic.