Miguel commited on
Commit
8e93ae4
·
1 Parent(s): f1d068a

feat: add stix object retrieval for an attack id

Browse files
pyproject.toml CHANGED
@@ -13,6 +13,8 @@ requires-python = ">=3.10,<4"
13
  readme = "README.md"
14
  license = ""
15
  dependencies = [
 
 
16
  "cachetools>=6.0.0",
17
  "gradio[mcp]>=5.32.1",
18
  "python-whois>=0.9.5",
 
13
  readme = "README.md"
14
  license = ""
15
  dependencies = [
16
+ "attackcti>=0.5.4",
17
+ "black>=25.1.0",
18
  "cachetools>=6.0.0",
19
  "gradio[mcp]>=5.32.1",
20
  "python-whois>=0.9.5",
requirements.txt CHANGED
@@ -1,21 +1,26 @@
1
- # This file was autogenerated by uv via the following command:
2
- # uv export --format requirements-txt --no-hashes --no-dev -o requirements.txt
3
  aiofiles==24.1.0
4
  aiohappyeyeballs==2.6.1
5
  aiohttp==3.12.8
6
  aiosignal==1.3.2
7
  annotated-types==0.7.0
 
8
  anyio==4.9.0
9
- async-timeout==5.0.1 ; python_full_version < '3.11'
 
10
  attrs==25.3.0
11
- audioop-lts==0.2.1 ; python_full_version >= '3.13'
 
 
12
  cachetools==6.0.0
13
  certifi==2025.4.26
 
14
  charset-normalizer==3.4.2
15
- click==8.2.1 ; sys_platform != 'emscripten'
16
- colorama==0.4.6 ; sys_platform == 'win32'
17
  coverage==7.8.2
18
- exceptiongroup==1.3.0 ; python_full_version < '3.11'
 
 
 
19
  fastapi==0.115.12
20
  ffmpy==0.6.0
21
  filelock==3.18.0
@@ -25,31 +30,47 @@ gradio==5.32.1
25
  gradio-client==1.10.2
26
  groovy==0.1.2
27
  h11==0.16.0
28
- hf-xet==1.1.2 ; platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'
29
  httpcore==1.0.9
30
  httpx==0.28.1
31
  httpx-sse==0.4.0
32
  huggingface-hub==0.32.4
 
33
  idna==3.10
34
  iniconfig==2.1.0
35
  jinja2==3.1.6
36
- markdown-it-py==3.0.0 ; sys_platform != 'emscripten'
 
37
  markupsafe==3.0.2
38
  mcp==1.9.0
39
- mdurl==0.1.2 ; sys_platform != 'emscripten'
 
40
  multidict==6.4.4
 
 
 
41
  numpy==2.2.6
42
  orjson==3.10.18
 
43
  packaging==25.0
44
  pandas==2.2.3
 
45
  pillow==11.2.1
 
 
 
 
 
46
  pluggy==1.6.0
 
47
  propcache==0.3.1
 
48
  pydantic==2.11.5
49
  pydantic-core==2.33.2
50
  pydantic-settings==2.9.1
51
  pydub==0.25.1
52
- pygments==2.19.1 ; sys_platform != 'emscripten'
 
53
  pytest==7.4.4
54
  pytest-cov==4.1.0
55
  pytest-randomly==3.16.0
@@ -60,24 +81,31 @@ python-whois==0.9.5
60
  pytz==2025.2
61
  pyyaml==6.0.2
62
  requests==2.32.3
63
- rich==14.0.0 ; sys_platform != 'emscripten'
64
- ruff==0.11.12 ; sys_platform != 'emscripten'
65
  safehttpx==0.1.6
66
  semantic-version==2.10.0
67
- shellingham==1.5.4 ; sys_platform != 'emscripten'
 
68
  six==1.17.0
69
  sniffio==1.3.1
 
70
  sse-starlette==2.3.6
71
  starlette==0.46.2
72
- tomli==2.2.1 ; python_full_version <= '3.11'
 
 
 
 
73
  tomlkit==0.13.2
74
  tqdm==4.67.1
75
- typer==0.16.0 ; sys_platform != 'emscripten'
76
  typing-extensions==4.14.0
77
  typing-inspection==0.4.1
78
  tzdata==2025.2
79
  urllib3==2.4.0
80
- uvicorn==0.34.3 ; sys_platform != 'emscripten'
 
81
  vt-py==0.21.0
82
  websockets==15.0.1
83
  xdoctest==1.2.0
 
 
 
1
  aiofiles==24.1.0
2
  aiohappyeyeballs==2.6.1
3
  aiohttp==3.12.8
4
  aiosignal==1.3.2
5
  annotated-types==0.7.0
6
+ antlr4-python3-runtime==4.9.3
7
  anyio==4.9.0
8
+ async-timeout==5.0.1
9
+ attackcti==0.5.4
10
  attrs==25.3.0
11
+ black==25.1.0
12
+ boolean-py==5.0
13
+ cachecontrol==0.14.3
14
  cachetools==6.0.0
15
  certifi==2025.4.26
16
+ cfgv==3.4.0
17
  charset-normalizer==3.4.2
18
+ click==8.2.1
 
19
  coverage==7.8.2
20
+ cyclonedx-python-lib==9.1.0
21
+ defusedxml==0.7.1
22
+ distlib==0.3.9
23
+ exceptiongroup==1.3.0
24
  fastapi==0.115.12
25
  ffmpy==0.6.0
26
  filelock==3.18.0
 
30
  gradio-client==1.10.2
31
  groovy==0.1.2
32
  h11==0.16.0
33
+ hf-xet==1.1.2
34
  httpcore==1.0.9
35
  httpx==0.28.1
36
  httpx-sse==0.4.0
37
  huggingface-hub==0.32.4
38
+ identify==2.6.12
39
  idna==3.10
40
  iniconfig==2.1.0
41
  jinja2==3.1.6
42
+ license-expression==30.4.1
43
+ markdown-it-py==3.0.0
44
  markupsafe==3.0.2
45
  mcp==1.9.0
46
+ mdurl==0.1.2
47
+ msgpack==1.1.0
48
  multidict==6.4.4
49
+ mypy==1.16.0
50
+ mypy-extensions==1.1.0
51
+ nodeenv==1.9.1
52
  numpy==2.2.6
53
  orjson==3.10.18
54
+ packageurl-python==0.16.0
55
  packaging==25.0
56
  pandas==2.2.3
57
+ pathspec==0.12.1
58
  pillow==11.2.1
59
+ pip==25.1.1
60
+ pip-api==0.0.34
61
+ pip-audit==2.9.0
62
+ pip-requirements-parser==32.0.1
63
+ platformdirs==4.3.8
64
  pluggy==1.6.0
65
+ pre-commit==3.8.0
66
  propcache==0.3.1
67
+ py-serializable==2.0.0
68
  pydantic==2.11.5
69
  pydantic-core==2.33.2
70
  pydantic-settings==2.9.1
71
  pydub==0.25.1
72
+ pygments==2.19.1
73
+ pyparsing==3.2.3
74
  pytest==7.4.4
75
  pytest-cov==4.1.0
76
  pytest-randomly==3.16.0
 
81
  pytz==2025.2
82
  pyyaml==6.0.2
83
  requests==2.32.3
84
+ rich==14.0.0
85
+ ruff==0.11.12
86
  safehttpx==0.1.6
87
  semantic-version==2.10.0
88
+ shellingham==1.5.4
89
+ simplejson==3.20.1
90
  six==1.17.0
91
  sniffio==1.3.1
92
+ sortedcontainers==2.4.0
93
  sse-starlette==2.3.6
94
  starlette==0.46.2
95
+ stix2==3.0.1
96
+ stix2-patterns==2.0.0
97
+ taxii2-client==2.3.0
98
+ toml==0.10.2
99
+ tomli==2.2.1
100
  tomlkit==0.13.2
101
  tqdm==4.67.1
102
+ typer==0.16.0
103
  typing-extensions==4.14.0
104
  typing-inspection==0.4.1
105
  tzdata==2025.2
106
  urllib3==2.4.0
107
+ uvicorn==0.34.3
108
+ virtualenv==20.31.2
109
  vt-py==0.21.0
110
  websockets==15.0.1
111
  xdoctest==1.2.0
tdagent/tools/retrieve_from_mitre_attack_information ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ from attackcti import attack_client
4
+
5
+
6
+ def get_stix_object_of_attack_id(attack_id: str, object_type: str = "attack-pattern") -> dict[str, Any]:
7
+ """Retrieves a specific STIX object identified by an ATT&CK ID across all ATT&CK matrices.
8
+
9
+ Args:
10
+ attack_id (str): The ATT&CK ID (e.g., 'T1234') of the STIX object to retrieve.
11
+ object_type (str): The type of STIX object to retrieve, such as 'attack-pattern', 'course-of-action', 'intrusion-set',
12
+ 'malware', 'tool', or 'x-mitre-data-component'. Default is 'attack-pattern'
13
+
14
+ Returns:
15
+ List: A list containing the matched STIX object, either in its raw STIX format or as a custom dictionary
16
+ following the structure defined by the relevant Pydantic model, depending on the 'stix_format' flag.
17
+ """
18
+ lift = attack_client()
19
+ return lift.get_object_by_attack_id(object_type=object_type, attack_id=attack_id)[0]
uv.lock CHANGED
The diff for this file is too large to render. See raw diff