crowdsec-tracker-api 1.92.0__py3-none-any.whl
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.
- crowdsec_tracker_api/__init__.py +59 -0
- crowdsec_tracker_api/base_model.py +58 -0
- crowdsec_tracker_api/http_client.py +153 -0
- crowdsec_tracker_api/models.py +945 -0
- crowdsec_tracker_api/services/__init__.py +0 -0
- crowdsec_tracker_api/services/cves.py +179 -0
- crowdsec_tracker_api/services/integrations.py +172 -0
- crowdsec_tracker_api-1.92.0.dist-info/METADATA +35 -0
- crowdsec_tracker_api-1.92.0.dist-info/RECORD +12 -0
- crowdsec_tracker_api-1.92.0.dist-info/WHEEL +5 -0
- crowdsec_tracker_api-1.92.0.dist-info/licenses/LICENSE +21 -0
- crowdsec_tracker_api-1.92.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from types import NoneType
|
|
3
|
+
from typing import Optional, Union, Annotated
|
|
4
|
+
|
|
5
|
+
from ..models import *
|
|
6
|
+
from ..base_model import Page, Service
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
from pydantic.fields import FieldInfo
|
|
9
|
+
from httpx import Auth
|
|
10
|
+
from ..http_client import HttpClient
|
|
11
|
+
|
|
12
|
+
class Cves(Service):
|
|
13
|
+
def __init__(self, auth: Auth, base_url: str = "https://admin.api.crowdsec.net/v1") -> None:
|
|
14
|
+
super().__init__(base_url=base_url, auth=auth)
|
|
15
|
+
|
|
16
|
+
def get_cves(
|
|
17
|
+
self,
|
|
18
|
+
query: Optional[str] = None,
|
|
19
|
+
sort_by: Optional[GetCVEsSortBy] = GetCVEsSortBy("rule_release_date"),
|
|
20
|
+
sort_order: Optional[GetCVEsSortOrder] = GetCVEsSortOrder("desc"),
|
|
21
|
+
page: int = 1,
|
|
22
|
+
size: int = 50,
|
|
23
|
+
)-> GetCVEsResponsePage:
|
|
24
|
+
endpoint_url = "/cves/"
|
|
25
|
+
loc = locals()
|
|
26
|
+
headers = {}
|
|
27
|
+
params = json.loads(
|
|
28
|
+
CvesGetCvesQueryParameters(**loc).model_dump_json(
|
|
29
|
+
exclude_none=True
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
path_params = {}
|
|
33
|
+
|
|
34
|
+
response = self.http_client.get(
|
|
35
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return GetCVEsResponsePage(_client=self, **response.json())
|
|
39
|
+
|
|
40
|
+
def get_cve(
|
|
41
|
+
self,
|
|
42
|
+
cve_id: str,
|
|
43
|
+
)-> GetCVEResponse:
|
|
44
|
+
endpoint_url = "/cves/{cve_id}"
|
|
45
|
+
loc = locals()
|
|
46
|
+
headers = {}
|
|
47
|
+
params = {}
|
|
48
|
+
path_params = json.loads(
|
|
49
|
+
CvesGetCvePathParameters(**loc).model_dump_json(
|
|
50
|
+
exclude_none=True
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
response = self.http_client.get(
|
|
55
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return GetCVEResponse(**response.json())
|
|
59
|
+
|
|
60
|
+
def download_cve_ips(
|
|
61
|
+
self,
|
|
62
|
+
cve_id: str,
|
|
63
|
+
)-> str:
|
|
64
|
+
endpoint_url = "/cves/{cve_id}/ips-download"
|
|
65
|
+
loc = locals()
|
|
66
|
+
headers = {}
|
|
67
|
+
params = {}
|
|
68
|
+
path_params = json.loads(
|
|
69
|
+
CvesDownloadCveIpsPathParameters(**loc).model_dump_json(
|
|
70
|
+
exclude_none=True
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = self.http_client.get(
|
|
75
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return response.text
|
|
79
|
+
|
|
80
|
+
def get_cve_ips_details(
|
|
81
|
+
self,
|
|
82
|
+
cve_id: str,
|
|
83
|
+
since: Optional[str] = "14d",
|
|
84
|
+
page: int = 1,
|
|
85
|
+
size: int = 50,
|
|
86
|
+
)-> GetCVEIPsResponsePage:
|
|
87
|
+
endpoint_url = "/cves/{cve_id}/ips-details"
|
|
88
|
+
loc = locals()
|
|
89
|
+
headers = {}
|
|
90
|
+
params = json.loads(
|
|
91
|
+
CvesGetCveIpsDetailsQueryParameters(**loc).model_dump_json(
|
|
92
|
+
exclude_none=True
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
path_params = json.loads(
|
|
96
|
+
CvesGetCveIpsDetailsPathParameters(**loc).model_dump_json(
|
|
97
|
+
exclude_none=True
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = self.http_client.get(
|
|
102
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return GetCVEIPsResponsePage(_client=self, **response.json())
|
|
106
|
+
|
|
107
|
+
def get_cve_subscribed_integrations(
|
|
108
|
+
self,
|
|
109
|
+
cve_id: str,
|
|
110
|
+
page: int = 1,
|
|
111
|
+
size: int = 50,
|
|
112
|
+
)-> GetCVESubscribedIntegrationsResponsePage:
|
|
113
|
+
endpoint_url = "/cves/{cve_id}/integrations"
|
|
114
|
+
loc = locals()
|
|
115
|
+
headers = {}
|
|
116
|
+
params = json.loads(
|
|
117
|
+
CvesGetCveSubscribedIntegrationsQueryParameters(**loc).model_dump_json(
|
|
118
|
+
exclude_none=True
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
path_params = json.loads(
|
|
122
|
+
CvesGetCveSubscribedIntegrationsPathParameters(**loc).model_dump_json(
|
|
123
|
+
exclude_none=True
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = self.http_client.get(
|
|
128
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return GetCVESubscribedIntegrationsResponsePage(_client=self, **response.json())
|
|
132
|
+
|
|
133
|
+
def subscribe_integration_to_cve(
|
|
134
|
+
self,
|
|
135
|
+
request: SubscribeCVEIntegrationRequest,
|
|
136
|
+
cve_id: str,
|
|
137
|
+
):
|
|
138
|
+
endpoint_url = "/cves/{cve_id}/integrations"
|
|
139
|
+
loc = locals()
|
|
140
|
+
headers = {}
|
|
141
|
+
params = {}
|
|
142
|
+
path_params = json.loads(
|
|
143
|
+
CvesSubscribeIntegrationToCvePathParameters(**loc).model_dump_json(
|
|
144
|
+
exclude_none=True
|
|
145
|
+
)
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
payload = json.loads(
|
|
149
|
+
request.model_dump_json(
|
|
150
|
+
exclude_none=True
|
|
151
|
+
)
|
|
152
|
+
) if "request" in loc else None
|
|
153
|
+
response = self.http_client.post(
|
|
154
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers, json=payload
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
def unsubscribe_integration_from_cve(
|
|
160
|
+
self,
|
|
161
|
+
cve_id: str,
|
|
162
|
+
integration_name: str,
|
|
163
|
+
):
|
|
164
|
+
endpoint_url = "/cves/{cve_id}/integrations/{integration_name}"
|
|
165
|
+
loc = locals()
|
|
166
|
+
headers = {}
|
|
167
|
+
params = {}
|
|
168
|
+
path_params = json.loads(
|
|
169
|
+
CvesUnsubscribeIntegrationFromCvePathParameters(**loc).model_dump_json(
|
|
170
|
+
exclude_none=True
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
response = self.http_client.delete(
|
|
175
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
return None
|
|
179
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from types import NoneType
|
|
3
|
+
from typing import Optional, Union, Annotated
|
|
4
|
+
|
|
5
|
+
from ..models import *
|
|
6
|
+
from ..base_model import Page, Service
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
from pydantic.fields import FieldInfo
|
|
9
|
+
from httpx import Auth
|
|
10
|
+
from ..http_client import HttpClient
|
|
11
|
+
|
|
12
|
+
class Integrations(Service):
|
|
13
|
+
def __init__(self, auth: Auth, base_url: str = "https://admin.api.crowdsec.net/v1") -> None:
|
|
14
|
+
super().__init__(base_url=base_url, auth=auth)
|
|
15
|
+
|
|
16
|
+
def get_integrations(
|
|
17
|
+
self,
|
|
18
|
+
tag: Optional[list[str]] = None,
|
|
19
|
+
)-> IntegrationGetResponsePage:
|
|
20
|
+
endpoint_url = "/integrations"
|
|
21
|
+
loc = locals()
|
|
22
|
+
headers = {}
|
|
23
|
+
params = json.loads(
|
|
24
|
+
IntegrationsGetIntegrationsQueryParameters(**loc).model_dump_json(
|
|
25
|
+
exclude_none=True
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
path_params = {}
|
|
29
|
+
|
|
30
|
+
response = self.http_client.get(
|
|
31
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return IntegrationGetResponsePage(_client=self, **response.json())
|
|
35
|
+
|
|
36
|
+
def create_integration(
|
|
37
|
+
self,
|
|
38
|
+
request: IntegrationCreateRequest,
|
|
39
|
+
)-> IntegrationCreateResponse:
|
|
40
|
+
endpoint_url = "/integrations"
|
|
41
|
+
loc = locals()
|
|
42
|
+
headers = {}
|
|
43
|
+
params = {}
|
|
44
|
+
path_params = {}
|
|
45
|
+
|
|
46
|
+
payload = json.loads(
|
|
47
|
+
request.model_dump_json(
|
|
48
|
+
exclude_none=True
|
|
49
|
+
)
|
|
50
|
+
) if "request" in loc else None
|
|
51
|
+
response = self.http_client.post(
|
|
52
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers, json=payload
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
return IntegrationCreateResponse(**response.json())
|
|
56
|
+
|
|
57
|
+
def get_integration(
|
|
58
|
+
self,
|
|
59
|
+
integration_id: str,
|
|
60
|
+
)-> IntegrationGetResponse:
|
|
61
|
+
endpoint_url = "/integrations/{integration_id}"
|
|
62
|
+
loc = locals()
|
|
63
|
+
headers = {}
|
|
64
|
+
params = {}
|
|
65
|
+
path_params = json.loads(
|
|
66
|
+
IntegrationsGetIntegrationPathParameters(**loc).model_dump_json(
|
|
67
|
+
exclude_none=True
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
response = self.http_client.get(
|
|
72
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return IntegrationGetResponse(**response.json())
|
|
76
|
+
|
|
77
|
+
def delete_integration(
|
|
78
|
+
self,
|
|
79
|
+
integration_id: str,
|
|
80
|
+
):
|
|
81
|
+
endpoint_url = "/integrations/{integration_id}"
|
|
82
|
+
loc = locals()
|
|
83
|
+
headers = {}
|
|
84
|
+
params = {}
|
|
85
|
+
path_params = json.loads(
|
|
86
|
+
IntegrationsDeleteIntegrationPathParameters(**loc).model_dump_json(
|
|
87
|
+
exclude_none=True
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
response = self.http_client.delete(
|
|
92
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
def update_integration(
|
|
98
|
+
self,
|
|
99
|
+
request: IntegrationUpdateRequest,
|
|
100
|
+
integration_id: str,
|
|
101
|
+
)-> IntegrationUpdateResponse:
|
|
102
|
+
endpoint_url = "/integrations/{integration_id}"
|
|
103
|
+
loc = locals()
|
|
104
|
+
headers = {}
|
|
105
|
+
params = {}
|
|
106
|
+
path_params = json.loads(
|
|
107
|
+
IntegrationsUpdateIntegrationPathParameters(**loc).model_dump_json(
|
|
108
|
+
exclude_none=True
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
response = self.http_client.patch(
|
|
113
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers, json=json.loads(
|
|
114
|
+
request.model_dump_json(
|
|
115
|
+
exclude_unset=True
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return IntegrationUpdateResponse(**response.json())
|
|
121
|
+
|
|
122
|
+
def get_integration_content(
|
|
123
|
+
self,
|
|
124
|
+
integration_id: str,
|
|
125
|
+
page: int = 1,
|
|
126
|
+
page_size: Optional[int] = None,
|
|
127
|
+
):
|
|
128
|
+
endpoint_url = "/integrations/{integration_id}/content"
|
|
129
|
+
loc = locals()
|
|
130
|
+
headers = {}
|
|
131
|
+
params = json.loads(
|
|
132
|
+
IntegrationsGetIntegrationContentQueryParameters(**loc).model_dump_json(
|
|
133
|
+
exclude_none=True
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
path_params = json.loads(
|
|
137
|
+
IntegrationsGetIntegrationContentPathParameters(**loc).model_dump_json(
|
|
138
|
+
exclude_none=True
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
response = self.http_client.get(
|
|
143
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
return None
|
|
147
|
+
|
|
148
|
+
def get_integration_content_stream(
|
|
149
|
+
self,
|
|
150
|
+
integration_id: str,
|
|
151
|
+
startup: bool = False,
|
|
152
|
+
):
|
|
153
|
+
endpoint_url = "/integrations/{integration_id}/v1/decisions/stream"
|
|
154
|
+
loc = locals()
|
|
155
|
+
headers = {}
|
|
156
|
+
params = json.loads(
|
|
157
|
+
IntegrationsGetIntegrationContentStreamQueryParameters(**loc).model_dump_json(
|
|
158
|
+
exclude_none=True
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
path_params = json.loads(
|
|
162
|
+
IntegrationsGetIntegrationContentStreamPathParameters(**loc).model_dump_json(
|
|
163
|
+
exclude_none=True
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
response = self.http_client.get(
|
|
168
|
+
url=endpoint_url, path_params=path_params, params=params, headers=headers
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
return None
|
|
172
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crowdsec_tracker_api
|
|
3
|
+
Version: 1.92.0
|
|
4
|
+
Summary: This is the API to manage Crowdsec Live Exploit Tracker service
|
|
5
|
+
Author-email: crowdsec <info@crowdsec.net>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: httpx==0.27.0
|
|
11
|
+
Requires-Dist: botocore
|
|
12
|
+
Requires-Dist: pydantic[email,timezone]<3.0.0,>=2.5.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# crowdsec_tracker_api
|
|
16
|
+
|
|
17
|
+
**crowdsec_tracker_api** is a Python SDK for the [CrowdSec Tracker API](https://docs.crowdsec.net/u/tracker_api/intro/).
|
|
18
|
+
This library enables you to manage CrowdSec Live Exploit Tracker resources such as CVEs data, IPs from a specific CVE and manage integrations.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install crowdsec_tracker_api
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
You can follow this [documentation](https://docs.crowdsec.net/u/tracker_api/intro/) to see the basic usage of the SDK.
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
You can access the full usage documentation [here](https://github.com/crowdsecurity/crowdsec-tracker-api-sdk-python/tree/main/doc).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
This SDK is auto-generated from the API specification. You can open an issue on this repository if you find a bug or if you want to add a feature.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
crowdsec_tracker_api/__init__.py,sha256=qVgdTR0nEMf7N9E1vr2W8fushTJNNahUiKRrkKPK5eE,1359
|
|
2
|
+
crowdsec_tracker_api/base_model.py,sha256=UMpRf5Y9N85ldRqsfjfjZJW8LwLugrgJTWpMOulu4cY,1909
|
|
3
|
+
crowdsec_tracker_api/http_client.py,sha256=7Ub19T1aRnbMz5TcLgzFWq3sy08-6PwuyGFVFrivUf0,4627
|
|
4
|
+
crowdsec_tracker_api/models.py,sha256=oQVYZ9V_DsIigbToqOhkmLBCIGyABjoKdR5aLvDquNw,31563
|
|
5
|
+
crowdsec_tracker_api/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
crowdsec_tracker_api/services/cves.py,sha256=LAeOeChFpUQoH6UgGrFchuvMSpREPv28_fubsvTuFQM,5394
|
|
7
|
+
crowdsec_tracker_api/services/integrations.py,sha256=Gu-hMno46E6huEh6maqyvho-epam3mecUuKt4fblhhk,5250
|
|
8
|
+
crowdsec_tracker_api-1.92.0.dist-info/licenses/LICENSE,sha256=fDPfY1qTG2iqaRIHXQOfPol7DIaWatUayHa8SUPk4cE,1064
|
|
9
|
+
crowdsec_tracker_api-1.92.0.dist-info/METADATA,sha256=Pcf69OFxq2SYVssVKQba7uktpXMEyUbnoWiZd_CiucQ,1206
|
|
10
|
+
crowdsec_tracker_api-1.92.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
crowdsec_tracker_api-1.92.0.dist-info/top_level.txt,sha256=PjzuJQNS-E2cYLihw-evV3MrsY9OWAb8QNKEFEg1hhE,21
|
|
12
|
+
crowdsec_tracker_api-1.92.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Crowdsec
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
crowdsec_tracker_api
|