txt2detection 1.0.3__tar.gz → 1.0.5__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.3 → txt2detection-1.0.5}/PKG-INFO +1 -1
- {txt2detection-1.0.3 → txt2detection-1.0.5}/pyproject.toml +1 -1
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_utils.py +1 -1
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/models.py +4 -4
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/utils.py +6 -4
- {txt2detection-1.0.3 → txt2detection-1.0.5}/.env.example +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/.env.markdown +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/.github/workflows/create-release.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/.github/workflows/run-tests.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/.gitignore +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/LICENSE +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/README.md +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/config/detection_languages.yaml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/docs/README.md +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/docs/txt2detection.png +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/requirements.txt +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/CVE-2024-56520.txt +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/EC2-exfil.txt +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/observables.txt +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-custom-tags.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-existing-related.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-master.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-author.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-date.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-description.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-level.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-license.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-status.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-tags.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-no-title.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-observables.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/files/sigma-rule-one-date.yml +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/manual-tests/README.md +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/__init__.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/requirements.txt +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_bundler.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_main.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_main_run_txt2detction.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_models.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/tests/src/test_observables.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/__init__.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/__main__.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/__init__.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/anthropic.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/base.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/deepseek.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/gemini.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/openai.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/openrouter.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/prompts.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/ai_extractor/utils.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/bundler.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/credential_checker.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/txt2detection/observables.py +0 -0
- {txt2detection-1.0.3 → txt2detection-1.0.5}/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.5
|
|
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
|
|
@@ -23,7 +23,7 @@ def test_as_date_with_datetime_and_date():
|
|
|
23
23
|
assert as_date(d_obj) == d_obj
|
|
24
24
|
|
|
25
25
|
def test_validate_token_count():
|
|
26
|
-
provider = parse_model('
|
|
26
|
+
provider = parse_model('anthropic')
|
|
27
27
|
with patch.object(type(provider), 'count_tokens') as mock_count_tokens:
|
|
28
28
|
mock_count_tokens.return_value = 1025
|
|
29
29
|
with pytest.raises(Exception):
|
|
@@ -3,9 +3,10 @@ import json
|
|
|
3
3
|
import re
|
|
4
4
|
import typing
|
|
5
5
|
import uuid
|
|
6
|
+
import requests
|
|
6
7
|
from slugify import slugify
|
|
7
8
|
from datetime import date as dt_date
|
|
8
|
-
from typing import Any, List, Literal, Optional, Union
|
|
9
|
+
from typing import Any, ClassVar, List, Literal, Optional, Union
|
|
9
10
|
from uuid import UUID
|
|
10
11
|
|
|
11
12
|
import jsonschema
|
|
@@ -194,6 +195,7 @@ class BaseDetection(BaseModel):
|
|
|
194
195
|
level: Level
|
|
195
196
|
_custom_id = None
|
|
196
197
|
_extra_data: dict
|
|
198
|
+
sigma_json_schema: ClassVar = requests.get("https://github.com/SigmaHQ/sigma-specification/raw/refs/heads/main/json-schema/sigma-detection-rule-schema.json").json()
|
|
197
199
|
|
|
198
200
|
def model_post_init(self, __context):
|
|
199
201
|
self.tags = self.tags or []
|
|
@@ -249,9 +251,7 @@ class BaseDetection(BaseModel):
|
|
|
249
251
|
def validate_rule_with_json_schema(self, rule):
|
|
250
252
|
jsonschema.validate(
|
|
251
253
|
rule,
|
|
252
|
-
|
|
253
|
-
"$ref": "https://github.com/SigmaHQ/sigma-specification/raw/refs/heads/main/json-schema/sigma-detection-rule-schema.json"
|
|
254
|
-
},
|
|
254
|
+
self.sigma_json_schema,
|
|
255
255
|
)
|
|
256
256
|
|
|
257
257
|
@property
|
|
@@ -55,11 +55,13 @@ def validate_token_count(max_tokens, input, extractor: BaseAIExtractor):
|
|
|
55
55
|
if token_count > max_tokens:
|
|
56
56
|
raise Exception(f"{extractor.extractor_name}: input_file token count ({token_count}) exceeds INPUT_TOKEN_LIMIT ({max_tokens})")
|
|
57
57
|
|
|
58
|
+
|
|
59
|
+
@lru_cache(maxsize=5)
|
|
60
|
+
def get_licenses(date):
|
|
61
|
+
resp = requests.get("https://github.com/spdx/license-list-data/raw/refs/heads/main/json/licenses.json")
|
|
62
|
+
return {l['licenseId']: l['name'] for l in resp.json()['licenses']}
|
|
63
|
+
|
|
58
64
|
def valid_licenses():
|
|
59
|
-
@lru_cache(maxsize=5)
|
|
60
|
-
def get_licenses(date):
|
|
61
|
-
resp = requests.get("https://github.com/spdx/license-list-data/raw/refs/heads/main/json/licenses.json")
|
|
62
|
-
return {l['licenseId']: l['name'] for l in resp.json()['licenses']}
|
|
63
65
|
return get_licenses(datetime.now().date().isoformat())
|
|
64
66
|
|
|
65
67
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|