Skip to content

Commit 6ca3fb4

Browse files
amit-sllclaude
andcommitted
update readme with run_detections.py documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2a5c671 commit 6ca3fb4

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

total_replay/readme.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,73 @@ From there, you can choose whether to replay only detection GUIDs, only analytic
118118
119119
C. TOTAL-REPLAY downloads the required Attack Data each time you execute or replay data during detection testing or development. To help reduce disk space usage, the tool generates a cached .yml file for every downloaded dataset. You can then use the `local_data_path` parameter to replay the cached data, allowing you to avoid downloading the same Attack Data again.
120120
121+
---
122+
123+
## Run Detections
124+
125+
In addition to replaying attack data, TOTAL-REPLAY includes a detection runner tool (`run_detections.py`) that executes SPL queries from Security Content detection YAML files directly against your Splunk instance and outputs results to a JSONL file.
126+
127+
### Environment Variables
128+
129+
The detection runner requires the following environment variables (or config file settings):
130+
131+
| Environment Variable | Description |
132+
|------------------------|--------------------------------------|
133+
| **SPLUNK_HOST** | Splunk server IP/hostname |
134+
| **SPLUNK_USERNAME** | Splunk username for REST API auth |
135+
| **SPLUNK_PASSWORD** | Splunk password for REST API auth |
136+
137+
```bash
138+
export SPLUNK_HOST=<IP_ADDRESS>
139+
export SPLUNK_USERNAME=<USERNAME>
140+
export SPLUNK_PASSWORD=<PASSWORD>
141+
```
142+
143+
Alternatively, configure these in `configuration/config.yml`:
144+
```yaml
145+
splunk:
146+
host: "your-splunk-server"
147+
username: "admin"
148+
password: "your-password"
149+
```
150+
151+
### Usage Examples
152+
153+
```bash
154+
# Run all detections
155+
python3 run_detections.py --all
156+
157+
# Filter by detection name
158+
python3 run_detections.py -n 'Windows Remote Services, CMLUA Or CMSTPLUA UAC Bypass'
159+
160+
# Filter by MITRE ATT&CK technique ID
161+
python3 run_detections.py -tid 'T1021, T1059'
162+
163+
# Filter by detection GUID
164+
python3 run_detections.py -g '01d29b48-ff6f-11eb-b81e-acde48001123'
165+
166+
# Filter by analytic story
167+
python3 run_detections.py -as 'AgentTesla, Remcos'
168+
169+
# Custom output file and time range
170+
python3 run_detections.py -as 'AgentTesla' --output results.jsonl --earliest -24h --latest now
171+
```
172+
173+
### Options
174+
175+
| Option | Description |
176+
|---------------------------|--------------------------------------------------|
177+
| `-n, --name` | Comma-separated detection names or filenames |
178+
| `-tid, --technique_id` | Comma-separated MITRE ATT&CK technique IDs |
179+
| `-g, --guid` | Comma-separated detection GUIDs |
180+
| `-as, --analytic_story` | Comma-separated analytic stories |
181+
| `-a, --all` | Run all detection YAML files |
182+
| `-o, --output` | Output JSONL file path (default: detection_results.jsonl) |
183+
| `-e, --earliest` | Earliest time for search (default: 0 = all time) |
184+
| `-l, --latest` | Latest time for search (default: now) |
185+
186+
---
187+
121188
### Other
122189

123190
For replaying captured datasets or event logs during detection development or testing outside of the Splunk Security Content or Splunk Attack Data GitHub repositories, we recommend using the built-in replay.py feature provided by either Splunk Attack Range or Attack Data.

0 commit comments

Comments
 (0)