txt2detection 1.0.11__tar.gz → 1.0.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of txt2detection might be problematic. Click here for more details.
- {txt2detection-1.0.11 → txt2detection-1.0.12}/PKG-INFO +3 -5
- {txt2detection-1.0.11 → txt2detection-1.0.12}/README.md +2 -4
- {txt2detection-1.0.11 → txt2detection-1.0.12}/pyproject.toml +1 -1
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-attack-enterprise.yml +1 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-master.yml +23 -6
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-title.yml +1 -0
- txt2detection-1.0.12/tests/manual-tests/README.md +1 -0
- txt2detection-1.0.12/tests/manual-tests/input-file-mode.md +148 -0
- txt2detection-1.0.11/tests/manual-tests/README.md → txt2detection-1.0.12/tests/manual-tests/input-sigma-mode.md +34 -192
- txt2detection-1.0.12/tests/manual-tests/input-text-mode.md +23 -0
- txt2detection-1.0.12/tests/src/__init__.py +0 -0
- txt2detection-1.0.12/tests/src/test_attack_flow.py +7 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_bundler.py +139 -17
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_main.py +108 -3
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_main_run_txt2detction.py +30 -9
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_models.py +6 -50
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/__main__.py +31 -36
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/base.py +0 -23
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/deepseek.py +5 -4
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/prompts.py +7 -129
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/utils.py +1 -1
- txt2detection-1.0.12/txt2detection/attack_navigator.py +66 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/bundler.py +66 -36
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/models.py +6 -7
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/observables.py +0 -24
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/utils.py +5 -0
- txt2detection-1.0.11/tests/src/test_attack_flow.py +0 -519
- txt2detection-1.0.11/txt2detection/ai_extractor/models.py +0 -34
- txt2detection-1.0.11/txt2detection/attack_flow.py +0 -231
- {txt2detection-1.0.11 → txt2detection-1.0.12}/.env.example +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/.env.markdown +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/.github/workflows/create-release.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/.github/workflows/run-tests.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/.gitignore +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/LICENSE +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/config/detection_languages.yaml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/docs/README.md +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/docs/txt2detection.png +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/requirements.txt +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/CVE-2024-56520.txt +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/EC2-exfil.txt +0 -0
- /txt2detection-1.0.11/tests/src/__init__.py → /txt2detection-1.0.12/tests/files/generate-multiple-rules.txt +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/observables.txt +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-attack-flow.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-custom-tags.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-existing-related.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-author.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-date.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-description.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-level.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-license.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-status.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-no-tags.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-observables.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/files/sigma-rule-one-date.yml +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/conftest.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/requirements.txt +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_observables.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/tests/src/test_utils.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/__init__.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/__init__.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/anthropic.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/gemini.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/openai.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/ai_extractor/openrouter.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection/credential_checker.py +0 -0
- {txt2detection-1.0.11 → txt2detection-1.0.12}/txt2detection.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: txt2detection
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: A command line tool that takes a txt file containing threat intelligence and turns it into a detection rule.
|
|
5
5
|
Project-URL: Homepage, https://github.com/muchdogesec/txt2detection
|
|
6
6
|
Project-URL: Issues, https://github.com/muchdogesec/txt2detection/issues
|
|
@@ -162,8 +162,7 @@ Use this mode to generate a set of rules from an input text file;
|
|
|
162
162
|
* Provider (env var required `ANTHROPIC_API_KEY`): `anthropic:`, models e.g.: `claude-3-5-sonnet-latest`, `claude-3-5-haiku-latest`, `claude-3-opus-latest` ([More here](https://docs.anthropic.com/en/docs/about-claude/models))
|
|
163
163
|
* Provider (env var required `GOOGLE_API_KEY`): `gemini:models/`, models: `gemini-1.5-pro-latest`, `gemini-1.5-flash-latest` ([More here](https://ai.google.dev/gemini-api/docs/models/gemini))
|
|
164
164
|
* Provider (env var required `DEEPSEEK_API_KEY`): `deepseek:`, models `deepseek-chat` ([More here](https://api-docs.deepseek.com/quick_start/pricing))
|
|
165
|
-
* `--
|
|
166
|
-
* `--ai_create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only. You don't need to pass this if `--ai_create_attack_flow` is set to `true` (as this mode relies on this setting being true)
|
|
165
|
+
* `--create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only.
|
|
167
166
|
|
|
168
167
|
Note, in this mode, the following values will be automatically assigned to the rule
|
|
169
168
|
|
|
@@ -190,8 +189,7 @@ Note, in this mode you should be aware of a few things;
|
|
|
190
189
|
* `--external_refs` (optional): txt2detection will automatically populate the `external_references` of the report object it creates for the input. You can use this value to add additional objects to `external_references`. Note, you can only add `source_name` and `external_id` values currently. Pass as `source_name=external_id`. e.g. `--external_refs txt2stix=demo1 source=id` would create the following objects under the `external_references` property: `{"source_name":"txt2stix","external_id":"demo1"},{"source_name":"source","external_id":"id"}`
|
|
191
190
|
* `status` (optional): either `stable`, `test`, `experimental`, `deprecated`, `unsupported`. If passed, will overwrite any existing `status` recorded in the rule
|
|
192
191
|
* `level` (optional): either `informational`, `low`, `medium`, `high`, `critical`. If passed, will overwrite any existing `level` recorded in the rule
|
|
193
|
-
* `--
|
|
194
|
-
* `--ai_create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only. You don't need to pass this if `--ai_create_attack_flow` is set to `true` (as this mode relies on this setting being true)
|
|
192
|
+
* `--create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags.
|
|
195
193
|
|
|
196
194
|
### A note on observable extraction
|
|
197
195
|
|
|
@@ -121,8 +121,7 @@ Use this mode to generate a set of rules from an input text file;
|
|
|
121
121
|
* Provider (env var required `ANTHROPIC_API_KEY`): `anthropic:`, models e.g.: `claude-3-5-sonnet-latest`, `claude-3-5-haiku-latest`, `claude-3-opus-latest` ([More here](https://docs.anthropic.com/en/docs/about-claude/models))
|
|
122
122
|
* Provider (env var required `GOOGLE_API_KEY`): `gemini:models/`, models: `gemini-1.5-pro-latest`, `gemini-1.5-flash-latest` ([More here](https://ai.google.dev/gemini-api/docs/models/gemini))
|
|
123
123
|
* Provider (env var required `DEEPSEEK_API_KEY`): `deepseek:`, models `deepseek-chat` ([More here](https://api-docs.deepseek.com/quick_start/pricing))
|
|
124
|
-
* `--
|
|
125
|
-
* `--ai_create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only. You don't need to pass this if `--ai_create_attack_flow` is set to `true` (as this mode relies on this setting being true)
|
|
124
|
+
* `--create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only.
|
|
126
125
|
|
|
127
126
|
Note, in this mode, the following values will be automatically assigned to the rule
|
|
128
127
|
|
|
@@ -149,8 +148,7 @@ Note, in this mode you should be aware of a few things;
|
|
|
149
148
|
* `--external_refs` (optional): txt2detection will automatically populate the `external_references` of the report object it creates for the input. You can use this value to add additional objects to `external_references`. Note, you can only add `source_name` and `external_id` values currently. Pass as `source_name=external_id`. e.g. `--external_refs txt2stix=demo1 source=id` would create the following objects under the `external_references` property: `{"source_name":"txt2stix","external_id":"demo1"},{"source_name":"source","external_id":"id"}`
|
|
150
149
|
* `status` (optional): either `stable`, `test`, `experimental`, `deprecated`, `unsupported`. If passed, will overwrite any existing `status` recorded in the rule
|
|
151
150
|
* `level` (optional): either `informational`, `low`, `medium`, `high`, `critical`. If passed, will overwrite any existing `level` recorded in the rule
|
|
152
|
-
* `--
|
|
153
|
-
* `--ai_create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags. Note, Sigma currently supports ATT&CK Enterprise only. You don't need to pass this if `--ai_create_attack_flow` is set to `true` (as this mode relies on this setting being true)
|
|
151
|
+
* `--create_attack_navigator_layer` (boolean, default `false`): passing this flag will generate a [MITRE ATT&CK Navigator layer](https://mitre-attack.github.io/attack-navigator/) for MITRE ATT&CK tags.
|
|
154
152
|
|
|
155
153
|
### A note on observable extraction
|
|
156
154
|
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
title: Okta Policy Modified or Deleted
|
|
2
|
+
name: Always optional
|
|
2
3
|
id: 1667a172-ed4c-463c-9969-efd92195319a
|
|
3
|
-
|
|
4
|
+
related:
|
|
5
|
+
- id: 08fbc97d-0a2f-491c-ae21-8ffcfd3174e9
|
|
6
|
+
type: derived
|
|
7
|
+
- id: 929a690e-bef0-4204-a928-ef5e620d6fcc
|
|
8
|
+
type: obsolete
|
|
4
9
|
description: Detects when an Okta policy is modified or deleted.
|
|
5
10
|
references:
|
|
6
11
|
- https://developer.okta.com/docs/reference/api/system-log/
|
|
7
12
|
- https://developer.okta.com/docs/reference/api/event-types/
|
|
8
|
-
author:
|
|
9
|
-
date:
|
|
10
|
-
modified:
|
|
13
|
+
author: dogesec tests
|
|
14
|
+
date: 2020-01-01
|
|
15
|
+
modified: 2023-12-25
|
|
11
16
|
tags:
|
|
12
|
-
- tlp.
|
|
17
|
+
- tlp.clear
|
|
13
18
|
- attack.t1547
|
|
19
|
+
- attack.t1671
|
|
20
|
+
- attack.t1025
|
|
14
21
|
- attack.command-and-control
|
|
15
|
-
-
|
|
22
|
+
- attack.credential_access # not sigma spec format, but still supported
|
|
23
|
+
- attack.t1661 # will fail is mobile
|
|
24
|
+
- custom.tag
|
|
16
25
|
logsource:
|
|
17
26
|
product: okta
|
|
18
27
|
service: okta
|
|
28
|
+
category: login
|
|
29
|
+
definition: Logging must be enabled.
|
|
19
30
|
detection:
|
|
20
31
|
selection:
|
|
21
32
|
eventtype:
|
|
@@ -26,5 +37,11 @@ falsepositives:
|
|
|
26
37
|
- Okta Policies being modified or deleted may be performed by a system administrator.
|
|
27
38
|
- Verify whether the user identity, user agent, and/or hostname should be making changes in your environment.
|
|
28
39
|
- Okta Policies modified or deleted from unfamiliar users should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
|
|
40
|
+
fields:
|
|
41
|
+
- sourceIPAddress
|
|
42
|
+
- userIdentity.arn
|
|
43
|
+
scope:
|
|
44
|
+
- server
|
|
45
|
+
status: test
|
|
29
46
|
level: low
|
|
30
47
|
license: MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Tests
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# File mode tests
|
|
2
|
+
|
|
3
|
+
## Check TLP
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
python3 txt2detection.py file \
|
|
7
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
8
|
+
--name "Check TLP" \
|
|
9
|
+
--ai_provider openai:gpt-4o \
|
|
10
|
+
--tlp_level red \
|
|
11
|
+
--report_id e91a49ba-f935-4844-8b37-0d5e963f0683
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Check labels
|
|
15
|
+
|
|
16
|
+
Should fail because no namespace
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
python3 txt2detection.py file \
|
|
20
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
21
|
+
--name "Check bad labels" \
|
|
22
|
+
--ai_provider openai:gpt-4o \
|
|
23
|
+
--labels "label1","label_2" \
|
|
24
|
+
--report_id 139d8b41-c5c8-48fa-aa25-39a54dfa1227
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Should pass
|
|
28
|
+
|
|
29
|
+
```shell
|
|
30
|
+
python3 txt2detection.py file \
|
|
31
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
32
|
+
--name "Check labels" \
|
|
33
|
+
--ai_provider openai:gpt-4o \
|
|
34
|
+
--labels "namespace.label1" "namespace.label_2" \
|
|
35
|
+
--report_id a3731edf-e834-43d2-95b8-e03f37bde9ba
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Check special labels
|
|
39
|
+
|
|
40
|
+
Should fail because disallowed tag
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
python3 txt2detection.py file \
|
|
44
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
45
|
+
--name "Disallowed tag" \
|
|
46
|
+
--ai_provider openai:gpt-4o \
|
|
47
|
+
--labels "tlp.red" \
|
|
48
|
+
--report_id a6f2aaff-4e33-4280-bb01-ab1bd3b95362
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Should have cve tag and matching vulnerability object
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
python3 txt2detection.py file \
|
|
55
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
56
|
+
--name "CVE tags" \
|
|
57
|
+
--ai_provider openai:gpt-4o \
|
|
58
|
+
--labels "cve.2025-3593" \
|
|
59
|
+
--report_id fab3707e-00fc-4f35-9d6d-e72dc0b6ba08
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Should have attack tags and matching attack pattern and x-mitre-tactic objects
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
python3 txt2detection.py file \
|
|
66
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
67
|
+
--name "ATT&CK tags tag" \
|
|
68
|
+
--ai_provider openai:gpt-4o \
|
|
69
|
+
--labels "attack.t1071.001" "attack.command-and-control" \
|
|
70
|
+
--report_id 940e8807-381e-41df-a27e-08914bafd93c
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Check custom identity
|
|
74
|
+
|
|
75
|
+
```shell
|
|
76
|
+
python3 txt2detection.py file \
|
|
77
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
78
|
+
--name "Check custom identity" \
|
|
79
|
+
--ai_provider openai:gpt-4o \
|
|
80
|
+
--use_identity '{"type":"identity","spec_version":"2.1","id":"identity--8ef05850-cb0d-51f7-80be-50e4376dbe63","created_by_ref":"identity--9779a2db-f98c-5f4b-8d08-8ee04e02dbb5","created":"2020-01-01T00:00:00.000Z","modified":"2020-01-01T00:00:00.000Z","name":"siemrules","description":"https://github.com/muchdogesec/siemrules","identity_class":"system","sectors":["technology"],"contact_information":"https://www.dogesec.com/contact/","object_marking_refs":["marking-definition--94868c89-83c2-464b-929b-a1a8aa3c8487","marking-definition--97ba4e8b-04f6-57e8-8f6e-3a0f0a7dc0fb"]}' \
|
|
81
|
+
--report_id f6f5bcb9-095f-47fb-b286-92b6a2aee221
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Check created by time
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
python3 txt2detection.py file \
|
|
88
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
89
|
+
--name "Check created by time" \
|
|
90
|
+
--ai_provider openai:gpt-4o \
|
|
91
|
+
--created 2010-01-01T00:00:00 \
|
|
92
|
+
--report_id 17ea21d3-a73d-44ec-bb12-eb1d34890027
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## External references
|
|
96
|
+
|
|
97
|
+
```shell
|
|
98
|
+
python3 txt2detection.py file \
|
|
99
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
100
|
+
--name "External references" \
|
|
101
|
+
--external_refs txt2stix=demo1 source=id \
|
|
102
|
+
--ai_provider openai:gpt-4o \
|
|
103
|
+
--report_id 79be13c7-15dd-4b66-a29a-8161fca77877
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Reference URLs
|
|
107
|
+
|
|
108
|
+
```shell
|
|
109
|
+
python3 txt2detection.py file \
|
|
110
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
111
|
+
--name "Reference URLs" \
|
|
112
|
+
--reference_urls "https://www.google.com/" "https://www.facebook.com/" \
|
|
113
|
+
--ai_provider openai:gpt-4o \
|
|
114
|
+
--report_id a9928bf1-b0ab-4748-8ab8-47eb7a34ca80
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Check Vulmatch / CTI Butler
|
|
118
|
+
|
|
119
|
+
```shell
|
|
120
|
+
python3 txt2detection.py file \
|
|
121
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
122
|
+
--name "Check Vulmatch / CTI Butler" \
|
|
123
|
+
--ai_provider openai:gpt-4o \
|
|
124
|
+
--report_id 9c78f6e4-4955-4c48-91f0-c669f744b44e
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## Check license
|
|
130
|
+
|
|
131
|
+
```shell
|
|
132
|
+
python3 txt2detection.py file \
|
|
133
|
+
--input_file tests/files/CVE-2024-56520.txt \
|
|
134
|
+
--name "Check license" \
|
|
135
|
+
--ai_provider openai:gpt-4o \
|
|
136
|
+
--license MIT \
|
|
137
|
+
--report_id e37506ca-b3e4-45b8-8205-77b815b88d7f
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Check observable extraction
|
|
141
|
+
|
|
142
|
+
```shell
|
|
143
|
+
python3 txt2detection.py file \
|
|
144
|
+
--input_file tests/files/observables.txt \
|
|
145
|
+
--name "Check observables" \
|
|
146
|
+
--ai_provider openai:gpt-4o \
|
|
147
|
+
--report_id 4aa5924b-2081-42ed-9934-ebf200427302
|
|
148
|
+
```
|
|
@@ -1,165 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Sigma Mode
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Good test cases
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
python3 txt2detection.py file \
|
|
7
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
8
|
-
--name "Check TLP" \
|
|
9
|
-
--ai_provider openai:gpt-4o \
|
|
10
|
-
--tlp_level red \
|
|
11
|
-
--report_id e91a49ba-f935-4844-8b37-0d5e963f0683
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Check labels
|
|
15
|
-
|
|
16
|
-
Should fail because no namespace
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
python3 txt2detection.py file \
|
|
20
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
21
|
-
--name "Check bad labels" \
|
|
22
|
-
--ai_provider openai:gpt-4o \
|
|
23
|
-
--labels "label1","label_2" \
|
|
24
|
-
--report_id 139d8b41-c5c8-48fa-aa25-39a54dfa1227
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Should pass
|
|
28
|
-
|
|
29
|
-
```shell
|
|
30
|
-
python3 txt2detection.py file \
|
|
31
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
32
|
-
--name "Check labels" \
|
|
33
|
-
--ai_provider openai:gpt-4o \
|
|
34
|
-
--labels "namespace.label1" "namespace.label_2" \
|
|
35
|
-
--report_id a3731edf-e834-43d2-95b8-e03f37bde9ba
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Check special labels
|
|
39
|
-
|
|
40
|
-
Should fail because disallowed tag
|
|
41
|
-
|
|
42
|
-
```shell
|
|
43
|
-
python3 txt2detection.py file \
|
|
44
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
45
|
-
--name "Disallowed tag" \
|
|
46
|
-
--ai_provider openai:gpt-4o \
|
|
47
|
-
--labels "tlp.red" \
|
|
48
|
-
--report_id a6f2aaff-4e33-4280-bb01-ab1bd3b95362
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Should have cve tag and matching vulnerability object
|
|
52
|
-
|
|
53
|
-
```shell
|
|
54
|
-
python3 txt2detection.py file \
|
|
55
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
56
|
-
--name "CVE tags" \
|
|
57
|
-
--ai_provider openai:gpt-4o \
|
|
58
|
-
--labels "cve.2025-3593" \
|
|
59
|
-
--report_id fab3707e-00fc-4f35-9d6d-e72dc0b6ba08
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Should have attack tags and matching attack pattern and x-mitre-tactic objects
|
|
5
|
+
### A rule with all properties
|
|
63
6
|
|
|
64
7
|
```shell
|
|
65
|
-
python3 txt2detection.py
|
|
66
|
-
--
|
|
67
|
-
--name "
|
|
68
|
-
--
|
|
69
|
-
--
|
|
70
|
-
--report_id
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Check custom identity
|
|
74
|
-
|
|
75
|
-
```shell
|
|
76
|
-
python3 txt2detection.py file \
|
|
77
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
78
|
-
--name "Check custom identity" \
|
|
79
|
-
--ai_provider openai:gpt-4o \
|
|
80
|
-
--use_identity '{"type":"identity","spec_version":"2.1","id":"identity--8ef05850-cb0d-51f7-80be-50e4376dbe63","created_by_ref":"identity--9779a2db-f98c-5f4b-8d08-8ee04e02dbb5","created":"2020-01-01T00:00:00.000Z","modified":"2020-01-01T00:00:00.000Z","name":"siemrules","description":"https://github.com/muchdogesec/siemrules","identity_class":"system","sectors":["technology"],"contact_information":"https://www.dogesec.com/contact/","object_marking_refs":["marking-definition--94868c89-83c2-464b-929b-a1a8aa3c8487","marking-definition--97ba4e8b-04f6-57e8-8f6e-3a0f0a7dc0fb"]}' \
|
|
81
|
-
--report_id f6f5bcb9-095f-47fb-b286-92b6a2aee221
|
|
8
|
+
python3 txt2detection.py sigma \
|
|
9
|
+
--sigma_file tests/files/sigma-rule-master.yml \
|
|
10
|
+
--name "Complete Sigma Rule" \
|
|
11
|
+
--create_attack_navigator_layer \
|
|
12
|
+
--ai_provider openai:gpt-5 \
|
|
13
|
+
--report_id a18e76d1-f152-4b87-a552-d46f41afd637
|
|
82
14
|
```
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```shell
|
|
87
|
-
python3 txt2detection.py file \
|
|
88
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
89
|
-
--name "Check created by time" \
|
|
90
|
-
--ai_provider openai:gpt-4o \
|
|
91
|
-
--created 2010-01-01T00:00:00 \
|
|
92
|
-
--report_id 17ea21d3-a73d-44ec-bb12-eb1d34890027
|
|
93
|
-
```
|
|
16
|
+
Check that derived is created (original rule id is 1667a172-ed4c-463c-9969-efd92195319a) and rule id matches the report it
|
|
94
17
|
|
|
95
|
-
|
|
18
|
+
### Test with no report ID passed
|
|
96
19
|
|
|
97
20
|
```shell
|
|
98
|
-
python3 txt2detection.py
|
|
99
|
-
--
|
|
100
|
-
--name "
|
|
101
|
-
--
|
|
102
|
-
--ai_provider openai:gpt-
|
|
103
|
-
--report_id 79be13c7-15dd-4b66-a29a-8161fca77877
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Reference URLs
|
|
107
|
-
|
|
108
|
-
```shell
|
|
109
|
-
python3 txt2detection.py file \
|
|
110
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
111
|
-
--name "Reference URLs" \
|
|
112
|
-
--reference_urls "https://www.google.com/" "https://www.facebook.com/" \
|
|
113
|
-
--ai_provider openai:gpt-4o \
|
|
114
|
-
--report_id a9928bf1-b0ab-4748-8ab8-47eb7a34ca80
|
|
21
|
+
python3 txt2detection.py sigma \
|
|
22
|
+
--sigma_file tests/files/sigma-rule-master.yml \
|
|
23
|
+
--name "Complete Sigma Rule" \
|
|
24
|
+
--create_attack_navigator_layer \
|
|
25
|
+
--ai_provider openai:gpt-5
|
|
115
26
|
```
|
|
116
27
|
|
|
117
|
-
|
|
28
|
+
Check that derived is created (original rule id is 1667a172-ed4c-463c-9969-efd92195319a). Rule id generation (and report) is random. This happens because we can't be sure all id's in Rules uploaded will conform to UUIDv4 RFC.
|
|
118
29
|
|
|
119
|
-
|
|
120
|
-
python3 txt2detection.py file \
|
|
121
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
122
|
-
--name "Check Vulmatch / CTI Butler" \
|
|
123
|
-
--ai_provider openai:gpt-4o \
|
|
124
|
-
--report_id 9c78f6e4-4955-4c48-91f0-c669f744b44e
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Testing input txt
|
|
30
|
+
### Check required properties CLI overide
|
|
128
31
|
|
|
129
32
|
```shell
|
|
130
|
-
python3 txt2detection.py
|
|
131
|
-
--
|
|
132
|
-
--name "
|
|
133
|
-
--
|
|
134
|
-
--report_id ca20d4a1-e40d-47a9-a454-1324beff4727
|
|
33
|
+
python3 txt2detection.py sigma \
|
|
34
|
+
--sigma_file tests/files/sigma-rule-no-title.yml \
|
|
35
|
+
--name "A new title" \
|
|
36
|
+
--report_id 272daf95-2790-4fd5-9ca6-ee8cef08315d
|
|
135
37
|
```
|
|
136
38
|
|
|
137
|
-
|
|
39
|
+
Here rule contains no name, but is passed in the request to ensure compliance so script will generate a rule.
|
|
138
40
|
|
|
139
|
-
|
|
140
|
-
python3 txt2detection.py file \
|
|
141
|
-
--input_file tests/files/CVE-2024-56520.txt \
|
|
142
|
-
--name "Check license" \
|
|
143
|
-
--ai_provider openai:gpt-4o \
|
|
144
|
-
--license MIT \
|
|
145
|
-
--report_id e37506ca-b3e4-45b8-8205-77b815b88d7f
|
|
146
|
-
```
|
|
41
|
+
### Append related
|
|
147
42
|
|
|
148
|
-
|
|
43
|
+
`related` property exist, check append of new related property for this run is correct
|
|
149
44
|
|
|
150
45
|
```shell
|
|
151
|
-
python3 txt2detection.py
|
|
152
|
-
--
|
|
153
|
-
--name "
|
|
154
|
-
--
|
|
155
|
-
--report_id 4aa5924b-2081-42ed-9934-ebf200427302
|
|
46
|
+
python3 txt2detection.py sigma \
|
|
47
|
+
--sigma_file tests/files/sigma-rule-existing-related.yml \
|
|
48
|
+
--name "Append related" \
|
|
49
|
+
--report_id 655f0689-5209-4ad5-a6de-3f198c696060
|
|
156
50
|
```
|
|
157
51
|
|
|
158
|
-
|
|
52
|
+
## Bad test cases
|
|
159
53
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
Should fail
|
|
54
|
+
### No title
|
|
163
55
|
|
|
164
56
|
```shell
|
|
165
57
|
python3 txt2detection.py sigma \
|
|
@@ -169,49 +61,10 @@ python3 txt2detection.py sigma \
|
|
|
169
61
|
|
|
170
62
|
Title, but report name is override by CLI input
|
|
171
63
|
|
|
172
|
-
```shell
|
|
173
|
-
python3 txt2detection.py sigma \
|
|
174
|
-
--sigma_file tests/files/sigma-rule-master.yml \
|
|
175
|
-
--name "A new title" \
|
|
176
|
-
--report_id 272daf95-2790-4fd5-9ca6-ee8cef08315d
|
|
177
|
-
```
|
|
178
64
|
|
|
179
|
-
## No description
|
|
180
65
|
|
|
181
|
-
```shell
|
|
182
|
-
python3 txt2detection.py sigma \
|
|
183
|
-
--sigma_file tests/files/sigma-rule-no-description.yml \
|
|
184
|
-
--name "No description" \
|
|
185
|
-
--report_id fd38cd23-93af-41ad-ab43-a6fa0ca69bf5
|
|
186
|
-
```
|
|
187
66
|
|
|
188
|
-
## Check that derived-from is created
|
|
189
67
|
|
|
190
|
-
```shell
|
|
191
|
-
python3 txt2detection.py sigma \
|
|
192
|
-
--sigma_file tests/files/sigma-rule-master.yml \
|
|
193
|
-
--name "Manual Rule Gen" \
|
|
194
|
-
--report_id 80fc4d1c-f02c-4bff-80bf-d97490a04542
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## Random ID
|
|
198
|
-
|
|
199
|
-
```shell
|
|
200
|
-
python3 txt2detection.py sigma \
|
|
201
|
-
--sigma_file tests/files/sigma-rule-master.yml \
|
|
202
|
-
--name "Random ID"
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
## Append related
|
|
206
|
-
|
|
207
|
-
`related` property exist, check append is correct
|
|
208
|
-
|
|
209
|
-
```shell
|
|
210
|
-
python3 txt2detection.py sigma \
|
|
211
|
-
--sigma_file tests/files/sigma-rule-existing-related.yml \
|
|
212
|
-
--name "Append related" \
|
|
213
|
-
--report_id 655f0689-5209-4ad5-a6de-3f198c696060
|
|
214
|
-
```
|
|
215
68
|
|
|
216
69
|
## Check dates
|
|
217
70
|
|
|
@@ -448,16 +301,6 @@ python3 txt2detection.py sigma \
|
|
|
448
301
|
```
|
|
449
302
|
|
|
450
303
|
|
|
451
|
-
## Attack Flow
|
|
452
|
-
|
|
453
|
-
```shell
|
|
454
|
-
python3 txt2detection.py sigma \
|
|
455
|
-
--sigma_file tests/files/sigma-rule-attack-flow.yml \
|
|
456
|
-
--name "Create ATT&CK Flow" \
|
|
457
|
-
--report_id 330e2030-1dc2-45e6-be13-9342b102621b \
|
|
458
|
-
--ai_provider openai:gpt-5 \
|
|
459
|
-
--ai_create_attack_flow
|
|
460
|
-
```
|
|
461
304
|
|
|
462
305
|
## Attack Navigator
|
|
463
306
|
|
|
@@ -468,10 +311,9 @@ python3 txt2detection.py sigma \
|
|
|
468
311
|
--sigma_file tests/files/sigma-rule-attack-enterprise.yml \
|
|
469
312
|
--name "Attack Navigator Enterprise" \
|
|
470
313
|
--report_id a18e76d1-f152-4b87-a552-d46f41afd637 \
|
|
314
|
+
--create_attack_navigator_layer \
|
|
471
315
|
--ai_provider openai:gpt-5 \
|
|
472
|
-
|
|
316
|
+
|
|
473
317
|
```
|
|
474
318
|
|
|
475
|
-
### Mobile / ICS
|
|
476
|
-
|
|
477
|
-
Not currently supported by Sigma.
|
|
319
|
+
### Mobile / ICS
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## Testing input txt
|
|
2
|
+
|
|
3
|
+
Basic input
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
python3 txt2detection.py text \
|
|
7
|
+
--input_text "a rule detecting suspicious logins on windows systems" \
|
|
8
|
+
--name "Testing input txt" \
|
|
9
|
+
--ai_provider openai:gpt-5 \
|
|
10
|
+
--report_id ca20d4a1-e40d-47a9-a454-1324beff4727
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Write multiple rules
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
python3 txt2detection.py text \
|
|
18
|
+
--input_text "Write rule to detect 1.1.1.1.\n Write a second rule to detect google.com" \
|
|
19
|
+
--name "Multi rule" \
|
|
20
|
+
--ai_provider openai:gpt-5 \
|
|
21
|
+
--create_attack_navigator_layer \
|
|
22
|
+
--report_id 3daabf35-a632-43be-a2b0-1c35a93069b1
|
|
23
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from unittest.mock import MagicMock
|
|
2
|
+
|
|
3
|
+
def make_fake_tactics(*tactic_name):
|
|
4
|
+
return {k: dict(external_references=dict(external_id=tactic_name)) for k in tactic_name}
|
|
5
|
+
def test_map_technique_tactic():
|
|
6
|
+
global_tactics = make_fake_tactics('initial-access', 'defense-evasion')
|
|
7
|
+
rule_tactics = make_fake_tactics('defense-evasion', 'exfiltration')
|