binalyze-air-sdk 1.0.2__py3-none-any.whl → 1.0.3__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.
- binalyze_air/__init__.py +77 -77
- binalyze_air/apis/__init__.py +67 -27
- binalyze_air/apis/acquisitions.py +107 -0
- binalyze_air/apis/api_tokens.py +49 -0
- binalyze_air/apis/assets.py +161 -0
- binalyze_air/apis/audit_logs.py +26 -0
- binalyze_air/apis/{authentication.py → auth.py} +29 -27
- binalyze_air/apis/auto_asset_tags.py +79 -75
- binalyze_air/apis/backup.py +177 -0
- binalyze_air/apis/baseline.py +46 -0
- binalyze_air/apis/cases.py +225 -0
- binalyze_air/apis/cloud_forensics.py +116 -0
- binalyze_air/apis/event_subscription.py +96 -96
- binalyze_air/apis/evidence.py +249 -53
- binalyze_air/apis/interact.py +153 -36
- binalyze_air/apis/investigation_hub.py +234 -0
- binalyze_air/apis/license.py +104 -0
- binalyze_air/apis/logger.py +83 -0
- binalyze_air/apis/multipart_upload.py +201 -0
- binalyze_air/apis/notifications.py +115 -0
- binalyze_air/apis/organizations.py +267 -0
- binalyze_air/apis/params.py +44 -39
- binalyze_air/apis/policies.py +186 -0
- binalyze_air/apis/preset_filters.py +79 -0
- binalyze_air/apis/recent_activities.py +71 -0
- binalyze_air/apis/relay_server.py +104 -0
- binalyze_air/apis/settings.py +395 -27
- binalyze_air/apis/tasks.py +80 -0
- binalyze_air/apis/triage.py +197 -0
- binalyze_air/apis/user_management.py +183 -74
- binalyze_air/apis/webhook_executions.py +50 -0
- binalyze_air/apis/webhooks.py +322 -230
- binalyze_air/base.py +207 -133
- binalyze_air/client.py +217 -1337
- binalyze_air/commands/__init__.py +175 -145
- binalyze_air/commands/acquisitions.py +661 -387
- binalyze_air/commands/api_tokens.py +55 -0
- binalyze_air/commands/assets.py +324 -362
- binalyze_air/commands/{authentication.py → auth.py} +36 -36
- binalyze_air/commands/auto_asset_tags.py +230 -230
- binalyze_air/commands/backup.py +47 -0
- binalyze_air/commands/baseline.py +32 -396
- binalyze_air/commands/cases.py +609 -602
- binalyze_air/commands/cloud_forensics.py +88 -0
- binalyze_air/commands/event_subscription.py +101 -101
- binalyze_air/commands/evidences.py +918 -988
- binalyze_air/commands/interact.py +172 -58
- binalyze_air/commands/investigation_hub.py +315 -0
- binalyze_air/commands/license.py +183 -0
- binalyze_air/commands/logger.py +126 -0
- binalyze_air/commands/multipart_upload.py +363 -0
- binalyze_air/commands/notifications.py +45 -0
- binalyze_air/commands/organizations.py +200 -221
- binalyze_air/commands/policies.py +175 -203
- binalyze_air/commands/preset_filters.py +55 -0
- binalyze_air/commands/recent_activities.py +32 -0
- binalyze_air/commands/relay_server.py +144 -0
- binalyze_air/commands/settings.py +431 -29
- binalyze_air/commands/tasks.py +95 -56
- binalyze_air/commands/triage.py +224 -360
- binalyze_air/commands/user_management.py +351 -126
- binalyze_air/commands/webhook_executions.py +77 -0
- binalyze_air/config.py +244 -244
- binalyze_air/exceptions.py +49 -49
- binalyze_air/http_client.py +426 -305
- binalyze_air/models/__init__.py +287 -285
- binalyze_air/models/acquisitions.py +365 -250
- binalyze_air/models/api_tokens.py +73 -0
- binalyze_air/models/assets.py +438 -438
- binalyze_air/models/audit.py +247 -272
- binalyze_air/models/audit_logs.py +14 -0
- binalyze_air/models/{authentication.py → auth.py} +69 -69
- binalyze_air/models/auto_asset_tags.py +227 -116
- binalyze_air/models/backup.py +138 -0
- binalyze_air/models/baseline.py +231 -231
- binalyze_air/models/cases.py +275 -275
- binalyze_air/models/cloud_forensics.py +145 -0
- binalyze_air/models/event_subscription.py +170 -171
- binalyze_air/models/evidence.py +65 -65
- binalyze_air/models/evidences.py +367 -348
- binalyze_air/models/interact.py +266 -135
- binalyze_air/models/investigation_hub.py +265 -0
- binalyze_air/models/license.py +150 -0
- binalyze_air/models/logger.py +83 -0
- binalyze_air/models/multipart_upload.py +352 -0
- binalyze_air/models/notifications.py +138 -0
- binalyze_air/models/organizations.py +293 -293
- binalyze_air/models/params.py +153 -127
- binalyze_air/models/policies.py +260 -249
- binalyze_air/models/preset_filters.py +79 -0
- binalyze_air/models/recent_activities.py +70 -0
- binalyze_air/models/relay_server.py +121 -0
- binalyze_air/models/settings.py +538 -84
- binalyze_air/models/tasks.py +215 -149
- binalyze_air/models/triage.py +141 -142
- binalyze_air/models/user_management.py +200 -97
- binalyze_air/models/webhook_executions.py +33 -0
- binalyze_air/queries/__init__.py +121 -133
- binalyze_air/queries/acquisitions.py +155 -155
- binalyze_air/queries/api_tokens.py +46 -0
- binalyze_air/queries/assets.py +186 -105
- binalyze_air/queries/audit.py +400 -416
- binalyze_air/queries/{authentication.py → auth.py} +55 -55
- binalyze_air/queries/auto_asset_tags.py +59 -59
- binalyze_air/queries/backup.py +66 -0
- binalyze_air/queries/baseline.py +21 -185
- binalyze_air/queries/cases.py +292 -292
- binalyze_air/queries/cloud_forensics.py +137 -0
- binalyze_air/queries/event_subscription.py +54 -54
- binalyze_air/queries/evidence.py +139 -139
- binalyze_air/queries/evidences.py +279 -279
- binalyze_air/queries/interact.py +140 -28
- binalyze_air/queries/investigation_hub.py +329 -0
- binalyze_air/queries/license.py +85 -0
- binalyze_air/queries/logger.py +58 -0
- binalyze_air/queries/multipart_upload.py +180 -0
- binalyze_air/queries/notifications.py +71 -0
- binalyze_air/queries/organizations.py +222 -222
- binalyze_air/queries/params.py +154 -115
- binalyze_air/queries/policies.py +149 -149
- binalyze_air/queries/preset_filters.py +60 -0
- binalyze_air/queries/recent_activities.py +44 -0
- binalyze_air/queries/relay_server.py +42 -0
- binalyze_air/queries/settings.py +533 -20
- binalyze_air/queries/tasks.py +125 -81
- binalyze_air/queries/triage.py +230 -230
- binalyze_air/queries/user_management.py +193 -83
- binalyze_air/queries/webhook_executions.py +39 -0
- binalyze_air_sdk-1.0.3.dist-info/METADATA +752 -0
- binalyze_air_sdk-1.0.3.dist-info/RECORD +132 -0
- {binalyze_air_sdk-1.0.2.dist-info → binalyze_air_sdk-1.0.3.dist-info}/WHEEL +1 -1
- binalyze_air/apis/endpoints.py +0 -22
- binalyze_air/apis/evidences.py +0 -216
- binalyze_air/apis/users.py +0 -68
- binalyze_air/commands/users.py +0 -101
- binalyze_air/models/endpoints.py +0 -76
- binalyze_air/models/users.py +0 -82
- binalyze_air/queries/endpoints.py +0 -25
- binalyze_air/queries/users.py +0 -69
- binalyze_air_sdk-1.0.2.dist-info/METADATA +0 -706
- binalyze_air_sdk-1.0.2.dist-info/RECORD +0 -82
- {binalyze_air_sdk-1.0.2.dist-info → binalyze_air_sdk-1.0.3.dist-info}/top_level.txt +0 -0
@@ -1,29 +1,431 @@
|
|
1
|
-
"""
|
2
|
-
Settings commands for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Dict, Any, Union
|
6
|
-
|
7
|
-
from ..base import Command
|
8
|
-
from ..models.settings import
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
"""
|
2
|
+
Settings commands for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Dict, Any, Union
|
6
|
+
|
7
|
+
from ..base import Command
|
8
|
+
from ..models.settings import (
|
9
|
+
BannerSettings, UpdateBannerSettingsRequest, GeneralSettingsRequest,
|
10
|
+
UpdateProxySettingsRequest, ValidateProxySettingsRequest,
|
11
|
+
UpdateActiveDirectorySettingsRequest, ValidateActiveDirectorySettingsRequest,
|
12
|
+
UpdateSMTPSettingsRequest, ValidateSMTPSettingsRequest,
|
13
|
+
UpdateConsoleAddressSettingsRequest, ValidateConsoleAddressSettingsRequest,
|
14
|
+
UpdatePolicySettingsRequest, UpdateEnforceTFASettingsRequest,
|
15
|
+
UpdateAutoAssetTaggingSettingsRequest, UpdateInteractSettingsRequest,
|
16
|
+
UpdateRFC3161SettingsRequest, UpdateResponderSettingsRequest,
|
17
|
+
UpdateLocardSettingsRequest, UpdateUninstallationPasswordProtectionSettingsRequest
|
18
|
+
)
|
19
|
+
from ..queries.settings import (
|
20
|
+
UpdateProxySettingsQuery, ValidateProxySettingsQuery,
|
21
|
+
UpdateActiveDirectorySettingsQuery, ValidateActiveDirectorySettingsQuery,
|
22
|
+
UpdateSMTPSettingsQuery, ValidateSMTPSettingsQuery,
|
23
|
+
UpdateConsoleAddressSettingsQuery, ValidateConsoleAddressSettingsQuery,
|
24
|
+
UpdatePolicySettingsQuery, UpdateEnforceTFASettingsQuery,
|
25
|
+
UpdateAutoAssetTaggingSettingsQuery, UpdateInteractSettingsQuery,
|
26
|
+
UpdateRFC3161SettingsQuery, UpdateResponderSettingsQuery,
|
27
|
+
UpdateLocardSettingsQuery, UpdateUninstallationPasswordProtectionSettingsQuery,
|
28
|
+
UpdateSyslogSettingsQuery, ValidateSyslogSettingsQuery,
|
29
|
+
UpdateBackupRestoreSettingsQuery, ValidateBackupSftpSettingsQuery,
|
30
|
+
UpdateSslSettingsQuery, ValidateSslSettingsQuery,
|
31
|
+
UpdateSingleSignOnSettingsQuery, GetSsoCallbackUrlQuery
|
32
|
+
)
|
33
|
+
from ..http_client import HTTPClient
|
34
|
+
|
35
|
+
|
36
|
+
class UpdateGeneralSettingsCommand(Command[Dict[str, Any]]):
|
37
|
+
"""Command to update general settings."""
|
38
|
+
|
39
|
+
def __init__(self, http_client: HTTPClient, request: Union[GeneralSettingsRequest, Dict[str, Any]]):
|
40
|
+
self.http_client = http_client
|
41
|
+
self.request = request
|
42
|
+
|
43
|
+
def execute(self):
|
44
|
+
"""Execute the update general settings command."""
|
45
|
+
# Handle both dict and model objects
|
46
|
+
if isinstance(self.request, dict):
|
47
|
+
payload = self.request
|
48
|
+
else:
|
49
|
+
# Use by_alias=True to ensure field aliases are properly mapped to API field names
|
50
|
+
payload = self.request.model_dump(exclude_none=True, by_alias=True)
|
51
|
+
|
52
|
+
response = self.http_client.put("settings/general", json_data=payload)
|
53
|
+
return response
|
54
|
+
|
55
|
+
|
56
|
+
class UpdateBannerSettingsCommand(Command[BannerSettings]):
|
57
|
+
"""Command to update banner settings."""
|
58
|
+
|
59
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateBannerSettingsRequest, Dict[str, Any]]):
|
60
|
+
self.http_client = http_client
|
61
|
+
self.request = request
|
62
|
+
|
63
|
+
def execute(self):
|
64
|
+
"""Execute the update banner settings command."""
|
65
|
+
# Handle both dict and model objects
|
66
|
+
if isinstance(self.request, dict):
|
67
|
+
payload = self.request
|
68
|
+
else:
|
69
|
+
# Use by_alias=True to ensure field aliases are properly mapped to API field names
|
70
|
+
payload = self.request.model_dump(exclude_none=True, by_alias=True)
|
71
|
+
|
72
|
+
response = self.http_client.put("settings/banner", json_data=payload)
|
73
|
+
return response
|
74
|
+
|
75
|
+
|
76
|
+
class UpdateProxySettingsCommand(Command[Dict[str, Any]]):
|
77
|
+
"""Command to update proxy settings."""
|
78
|
+
|
79
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateProxySettingsRequest, Dict[str, Any]]):
|
80
|
+
self.http_client = http_client
|
81
|
+
self.request = request
|
82
|
+
|
83
|
+
def execute(self) -> Dict[str, Any]:
|
84
|
+
"""Execute the update proxy settings command."""
|
85
|
+
query = UpdateProxySettingsQuery(self.request)
|
86
|
+
form_data = query.build_form_data()
|
87
|
+
files = query.build_files()
|
88
|
+
|
89
|
+
if files:
|
90
|
+
response = self.http_client.upload_multipart(
|
91
|
+
"settings/proxy",
|
92
|
+
data=form_data,
|
93
|
+
files=files,
|
94
|
+
method='PUT'
|
95
|
+
)
|
96
|
+
else:
|
97
|
+
response = self.http_client.put("settings/proxy", data=form_data)
|
98
|
+
|
99
|
+
return response
|
100
|
+
|
101
|
+
|
102
|
+
class ValidateProxySettingsCommand(Command[Dict[str, Any]]):
|
103
|
+
"""Command to validate proxy settings."""
|
104
|
+
|
105
|
+
def __init__(self, http_client: HTTPClient, request: Union[ValidateProxySettingsRequest, Dict[str, Any]]):
|
106
|
+
self.http_client = http_client
|
107
|
+
self.request = request
|
108
|
+
|
109
|
+
def execute(self) -> Dict[str, Any]:
|
110
|
+
"""Execute the validate proxy settings command."""
|
111
|
+
query = ValidateProxySettingsQuery(self.request)
|
112
|
+
form_data = query.build_form_data()
|
113
|
+
files = query.build_files()
|
114
|
+
|
115
|
+
if files:
|
116
|
+
response = self.http_client.upload_multipart(
|
117
|
+
"settings/validate-proxy",
|
118
|
+
data=form_data,
|
119
|
+
files=files,
|
120
|
+
method='POST'
|
121
|
+
)
|
122
|
+
else:
|
123
|
+
response = self.http_client.post("settings/validate-proxy", data=form_data)
|
124
|
+
|
125
|
+
return response
|
126
|
+
|
127
|
+
|
128
|
+
class UpdateActiveDirectorySettingsCommand(Command[Dict[str, Any]]):
|
129
|
+
"""Command to update Active Directory settings."""
|
130
|
+
|
131
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateActiveDirectorySettingsRequest, Dict[str, Any]]):
|
132
|
+
self.http_client = http_client
|
133
|
+
self.request = request
|
134
|
+
|
135
|
+
def execute(self) -> Dict[str, Any]:
|
136
|
+
"""Execute the update Active Directory settings command."""
|
137
|
+
query = UpdateActiveDirectorySettingsQuery(self.request)
|
138
|
+
payload = query.build_body()
|
139
|
+
|
140
|
+
response = self.http_client.put("settings/active-directory", json_data=payload)
|
141
|
+
return response
|
142
|
+
|
143
|
+
|
144
|
+
class ValidateActiveDirectorySettingsCommand(Command[Dict[str, Any]]):
|
145
|
+
"""Command to validate Active Directory settings."""
|
146
|
+
|
147
|
+
def __init__(self, http_client: HTTPClient, request: Union[ValidateActiveDirectorySettingsRequest, Dict[str, Any]]):
|
148
|
+
self.http_client = http_client
|
149
|
+
self.request = request
|
150
|
+
|
151
|
+
def execute(self) -> Dict[str, Any]:
|
152
|
+
"""Execute the validate Active Directory settings command."""
|
153
|
+
query = ValidateActiveDirectorySettingsQuery(self.request)
|
154
|
+
payload = query.build_body()
|
155
|
+
|
156
|
+
response = self.http_client.post("settings/active-directory", json_data=payload)
|
157
|
+
return response
|
158
|
+
|
159
|
+
|
160
|
+
class UpdateSMTPSettingsCommand(Command[Dict[str, Any]]):
|
161
|
+
"""Command to update SMTP settings."""
|
162
|
+
|
163
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateSMTPSettingsRequest, Dict[str, Any]]):
|
164
|
+
self.http_client = http_client
|
165
|
+
self.request = request
|
166
|
+
|
167
|
+
def execute(self) -> Dict[str, Any]:
|
168
|
+
"""Execute the update SMTP settings command."""
|
169
|
+
query = UpdateSMTPSettingsQuery(self.request)
|
170
|
+
payload = query.build_body()
|
171
|
+
|
172
|
+
response = self.http_client.put("settings/smtp", json_data=payload)
|
173
|
+
return response
|
174
|
+
|
175
|
+
|
176
|
+
class ValidateSMTPSettingsCommand(Command[Dict[str, Any]]):
|
177
|
+
"""Command to validate SMTP settings."""
|
178
|
+
|
179
|
+
def __init__(self, http_client: HTTPClient, request: Union[ValidateSMTPSettingsRequest, Dict[str, Any]]):
|
180
|
+
self.http_client = http_client
|
181
|
+
self.request = request
|
182
|
+
|
183
|
+
def execute(self) -> Dict[str, Any]:
|
184
|
+
"""Execute the validate SMTP settings command."""
|
185
|
+
query = ValidateSMTPSettingsQuery(self.request)
|
186
|
+
payload = query.build_body()
|
187
|
+
|
188
|
+
response = self.http_client.post("settings/validate-smtp", json_data=payload)
|
189
|
+
return response
|
190
|
+
|
191
|
+
|
192
|
+
class UpdateConsoleAddressSettingsCommand(Command[Dict[str, Any]]):
|
193
|
+
"""Command to update console address settings."""
|
194
|
+
|
195
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateConsoleAddressSettingsRequest, Dict[str, Any]]):
|
196
|
+
self.http_client = http_client
|
197
|
+
self.request = request
|
198
|
+
|
199
|
+
def execute(self) -> Dict[str, Any]:
|
200
|
+
"""Execute the update console address settings command."""
|
201
|
+
query = UpdateConsoleAddressSettingsQuery(self.request)
|
202
|
+
form_data = query.build_form_data()
|
203
|
+
files = query.build_files()
|
204
|
+
|
205
|
+
if files:
|
206
|
+
response = self.http_client.upload_multipart(
|
207
|
+
"settings/console-address",
|
208
|
+
data=form_data,
|
209
|
+
files=files,
|
210
|
+
method='PUT'
|
211
|
+
)
|
212
|
+
else:
|
213
|
+
response = self.http_client.put("settings/console-address", data=form_data)
|
214
|
+
|
215
|
+
return response
|
216
|
+
|
217
|
+
|
218
|
+
class ValidateConsoleAddressSettingsCommand(Command[Dict[str, Any]]):
|
219
|
+
"""Command to validate console address settings."""
|
220
|
+
|
221
|
+
def __init__(self, http_client: HTTPClient, request: Union[ValidateConsoleAddressSettingsRequest, Dict[str, Any]]):
|
222
|
+
self.http_client = http_client
|
223
|
+
self.request = request
|
224
|
+
|
225
|
+
def execute(self) -> Dict[str, Any]:
|
226
|
+
"""Execute the validate console address settings command."""
|
227
|
+
query = ValidateConsoleAddressSettingsQuery(self.request)
|
228
|
+
payload = query.build_body()
|
229
|
+
|
230
|
+
response = self.http_client.post("settings/validate-console-address", json_data=payload)
|
231
|
+
return response
|
232
|
+
|
233
|
+
|
234
|
+
# Simple JSON-based settings commands (most have the same pattern)
|
235
|
+
class UpdatePolicySettingsCommand(Command[Dict[str, Any]]):
|
236
|
+
"""Command to update policy settings."""
|
237
|
+
|
238
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdatePolicySettingsRequest, Dict[str, Any]]):
|
239
|
+
self.http_client = http_client
|
240
|
+
self.request = request
|
241
|
+
|
242
|
+
def execute(self) -> Dict[str, Any]:
|
243
|
+
query = UpdatePolicySettingsQuery(self.request)
|
244
|
+
payload = query.build_body()
|
245
|
+
return self.http_client.put("settings/policy", json_data=payload)
|
246
|
+
|
247
|
+
|
248
|
+
class UpdateEnforceTFASettingsCommand(Command[Dict[str, Any]]):
|
249
|
+
"""Command to update enforce TFA settings."""
|
250
|
+
|
251
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateEnforceTFASettingsRequest, Dict[str, Any]]):
|
252
|
+
self.http_client = http_client
|
253
|
+
self.request = request
|
254
|
+
|
255
|
+
def execute(self) -> Dict[str, Any]:
|
256
|
+
query = UpdateEnforceTFASettingsQuery(self.request)
|
257
|
+
payload = query.build_body()
|
258
|
+
return self.http_client.put("settings/enforce-tfa", json_data=payload)
|
259
|
+
|
260
|
+
|
261
|
+
class UpdateAutoAssetTaggingSettingsCommand(Command[Dict[str, Any]]):
|
262
|
+
"""Command to update auto asset tagging settings."""
|
263
|
+
|
264
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateAutoAssetTaggingSettingsRequest, Dict[str, Any]]):
|
265
|
+
self.http_client = http_client
|
266
|
+
self.request = request
|
267
|
+
|
268
|
+
def execute(self) -> Dict[str, Any]:
|
269
|
+
query = UpdateAutoAssetTaggingSettingsQuery(self.request)
|
270
|
+
payload = query.build_body()
|
271
|
+
return self.http_client.put("settings/auto-asset-tagging", json_data=payload)
|
272
|
+
|
273
|
+
|
274
|
+
class UpdateInteractSettingsCommand(Command[Dict[str, Any]]):
|
275
|
+
"""Command to update InterACT settings."""
|
276
|
+
|
277
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateInteractSettingsRequest, Dict[str, Any]]):
|
278
|
+
self.http_client = http_client
|
279
|
+
self.request = request
|
280
|
+
|
281
|
+
def execute(self) -> Dict[str, Any]:
|
282
|
+
query = UpdateInteractSettingsQuery(self.request)
|
283
|
+
payload = query.build_body()
|
284
|
+
return self.http_client.put("settings/interact", json_data=payload)
|
285
|
+
|
286
|
+
|
287
|
+
class UpdateRFC3161SettingsCommand(Command[Dict[str, Any]]):
|
288
|
+
"""Command to update RFC3161 settings."""
|
289
|
+
|
290
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateRFC3161SettingsRequest, Dict[str, Any]]):
|
291
|
+
self.http_client = http_client
|
292
|
+
self.request = request
|
293
|
+
|
294
|
+
def execute(self) -> Dict[str, Any]:
|
295
|
+
query = UpdateRFC3161SettingsQuery(self.request)
|
296
|
+
payload = query.build_body()
|
297
|
+
return self.http_client.put("settings/rfc3161", json_data=payload)
|
298
|
+
|
299
|
+
|
300
|
+
class UpdateResponderSettingsCommand(Command[Dict[str, Any]]):
|
301
|
+
"""Command to update responder/agent settings."""
|
302
|
+
|
303
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateResponderSettingsRequest, Dict[str, Any]]):
|
304
|
+
self.http_client = http_client
|
305
|
+
self.request = request
|
306
|
+
|
307
|
+
def execute(self) -> Dict[str, Any]:
|
308
|
+
query = UpdateResponderSettingsQuery(self.request)
|
309
|
+
payload = query.build_body()
|
310
|
+
return self.http_client.put("settings/agent", json_data=payload)
|
311
|
+
|
312
|
+
|
313
|
+
class UpdateLocardSettingsCommand(Command[Dict[str, Any]]):
|
314
|
+
"""Command to update Locard settings."""
|
315
|
+
|
316
|
+
def __init__(self, http_client: HTTPClient, request: Union[UpdateLocardSettingsRequest, Dict[str, Any]]):
|
317
|
+
self.http_client = http_client
|
318
|
+
self.request = request
|
319
|
+
|
320
|
+
def execute(self) -> Dict[str, Any]:
|
321
|
+
query = UpdateLocardSettingsQuery(self.request)
|
322
|
+
payload = query.build_body()
|
323
|
+
return self.http_client.put("settings/locard", json_data=payload)
|
324
|
+
|
325
|
+
|
326
|
+
class UpdateUninstallationPasswordProtectionSettingsCommand(Command):
|
327
|
+
"""Command for updating uninstallation password protection settings"""
|
328
|
+
|
329
|
+
def __init__(self, http_client: HTTPClient):
|
330
|
+
self.http_client = http_client
|
331
|
+
|
332
|
+
def execute(self, query: UpdateUninstallationPasswordProtectionSettingsQuery) -> Dict[str, Any]:
|
333
|
+
"""Execute update uninstallation password protection settings command"""
|
334
|
+
payload = query.build_body()
|
335
|
+
return self.http_client.put("settings/uninstallation-password-protection", json_data=payload)
|
336
|
+
|
337
|
+
|
338
|
+
class UpdateSyslogSettingsCommand(Command):
|
339
|
+
"""Command for updating syslog settings"""
|
340
|
+
|
341
|
+
def __init__(self, http_client: HTTPClient):
|
342
|
+
self.http_client = http_client
|
343
|
+
|
344
|
+
def execute(self, query: UpdateSyslogSettingsQuery) -> Dict[str, Any]:
|
345
|
+
"""Execute update syslog settings command"""
|
346
|
+
payload = query.build_body()
|
347
|
+
return self.http_client.put("settings/syslog", json_data=payload)
|
348
|
+
|
349
|
+
|
350
|
+
class ValidateSyslogSettingsCommand(Command):
|
351
|
+
"""Command for validating syslog settings"""
|
352
|
+
|
353
|
+
def __init__(self, http_client: HTTPClient):
|
354
|
+
self.http_client = http_client
|
355
|
+
|
356
|
+
def execute(self, query: ValidateSyslogSettingsQuery) -> Dict[str, Any]:
|
357
|
+
"""Execute validate syslog settings command"""
|
358
|
+
payload = query.build_body()
|
359
|
+
return self.http_client.post("settings/validate-syslog", json_data=payload)
|
360
|
+
|
361
|
+
|
362
|
+
class UpdateBackupRestoreSettingsCommand(Command):
|
363
|
+
"""Command for updating backup restore settings"""
|
364
|
+
|
365
|
+
def __init__(self, http_client: HTTPClient):
|
366
|
+
self.http_client = http_client
|
367
|
+
|
368
|
+
def execute(self, query: UpdateBackupRestoreSettingsQuery) -> Dict[str, Any]:
|
369
|
+
"""Execute update backup restore settings command"""
|
370
|
+
payload = query.build_body()
|
371
|
+
return self.http_client.put("settings/backup-restore", json_data=payload)
|
372
|
+
|
373
|
+
|
374
|
+
class ValidateBackupSftpSettingsCommand(Command):
|
375
|
+
"""Command for validating backup SFTP settings"""
|
376
|
+
|
377
|
+
def __init__(self, http_client: HTTPClient):
|
378
|
+
self.http_client = http_client
|
379
|
+
|
380
|
+
def execute(self, query: ValidateBackupSftpSettingsQuery) -> Dict[str, Any]:
|
381
|
+
"""Execute validate backup SFTP settings command"""
|
382
|
+
payload = query.build_body()
|
383
|
+
return self.http_client.post("settings/validate-backup-sftp", json_data=payload)
|
384
|
+
|
385
|
+
|
386
|
+
class UpdateSslSettingsCommand(Command):
|
387
|
+
"""Command for updating SSL settings"""
|
388
|
+
|
389
|
+
def __init__(self, http_client: HTTPClient):
|
390
|
+
self.http_client = http_client
|
391
|
+
|
392
|
+
def execute(self, query: UpdateSslSettingsQuery) -> Dict[str, Any]:
|
393
|
+
"""Execute update SSL settings command"""
|
394
|
+
payload = query.build_body()
|
395
|
+
return self.http_client.put("settings/ssl", data=payload)
|
396
|
+
|
397
|
+
|
398
|
+
class ValidateSslSettingsCommand(Command):
|
399
|
+
"""Command for validating SSL settings"""
|
400
|
+
|
401
|
+
def __init__(self, http_client: HTTPClient):
|
402
|
+
self.http_client = http_client
|
403
|
+
|
404
|
+
def execute(self, query: ValidateSslSettingsQuery) -> Dict[str, Any]:
|
405
|
+
"""Execute validate SSL settings command"""
|
406
|
+
payload = query.build_body()
|
407
|
+
return self.http_client.post("settings/validate-ssl", data=payload)
|
408
|
+
|
409
|
+
|
410
|
+
class UpdateSingleSignOnSettingsCommand(Command):
|
411
|
+
"""Command for updating single sign-on settings"""
|
412
|
+
|
413
|
+
def __init__(self, http_client: HTTPClient):
|
414
|
+
self.http_client = http_client
|
415
|
+
|
416
|
+
def execute(self, query: UpdateSingleSignOnSettingsQuery) -> Dict[str, Any]:
|
417
|
+
"""Execute update single sign-on settings command"""
|
418
|
+
payload = query.build_body()
|
419
|
+
return self.http_client.put("settings/single-sign-on", json_data=payload)
|
420
|
+
|
421
|
+
|
422
|
+
class GetSsoCallbackUrlCommand(Command):
|
423
|
+
"""Command for getting SSO callback URL by type"""
|
424
|
+
|
425
|
+
def __init__(self, http_client: HTTPClient):
|
426
|
+
self.http_client = http_client
|
427
|
+
|
428
|
+
def execute(self, query: GetSsoCallbackUrlQuery) -> Dict[str, Any]:
|
429
|
+
"""Execute get SSO callback URL command"""
|
430
|
+
sso_type = query.get_sso_type()
|
431
|
+
return self.http_client.get(f"settings/sso/{sso_type}/callback-url")
|
binalyze_air/commands/tasks.py
CHANGED
@@ -1,56 +1,95 @@
|
|
1
|
-
"""
|
2
|
-
Task-related commands for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Dict, Any
|
6
|
-
|
7
|
-
from ..base import Command
|
8
|
-
from ..http_client import HTTPClient
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
self.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
self.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
self.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
self.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
1
|
+
"""
|
2
|
+
Task-related commands for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Dict, Any, Union
|
6
|
+
|
7
|
+
from ..base import Command
|
8
|
+
from ..http_client import HTTPClient
|
9
|
+
from ..models.tasks import CancelTaskByFilterRequest, GenerateOffNetworkZipPasswordRequest
|
10
|
+
|
11
|
+
|
12
|
+
class CancelTaskCommand(Command[Dict[str, Any]]):
|
13
|
+
"""Command to cancel a task."""
|
14
|
+
|
15
|
+
def __init__(self, http_client: HTTPClient, task_id: str):
|
16
|
+
self.http_client = http_client
|
17
|
+
self.task_id = task_id
|
18
|
+
|
19
|
+
def execute(self) -> Dict[str, Any]:
|
20
|
+
"""Execute the cancel task command."""
|
21
|
+
return self.http_client.post(f"tasks/{self.task_id}/cancel", json_data={})
|
22
|
+
|
23
|
+
|
24
|
+
class CancelTaskAssignmentCommand(Command[Dict[str, Any]]):
|
25
|
+
"""Command to cancel a task assignment."""
|
26
|
+
|
27
|
+
def __init__(self, http_client: HTTPClient, assignment_id: str):
|
28
|
+
self.http_client = http_client
|
29
|
+
self.assignment_id = assignment_id
|
30
|
+
|
31
|
+
def execute(self) -> Dict[str, Any]:
|
32
|
+
"""Execute the cancel task assignment command."""
|
33
|
+
return self.http_client.post(f"tasks/assignments/{self.assignment_id}/cancel", json_data={})
|
34
|
+
|
35
|
+
|
36
|
+
class DeleteTaskAssignmentCommand(Command[Dict[str, Any]]):
|
37
|
+
"""Command to delete a task assignment."""
|
38
|
+
|
39
|
+
def __init__(self, http_client: HTTPClient, assignment_id: str):
|
40
|
+
self.http_client = http_client
|
41
|
+
self.assignment_id = assignment_id
|
42
|
+
|
43
|
+
def execute(self) -> Dict[str, Any]:
|
44
|
+
"""Execute the delete task assignment command."""
|
45
|
+
return self.http_client.delete(f"tasks/assignments/{self.assignment_id}")
|
46
|
+
|
47
|
+
|
48
|
+
class DeleteTaskCommand(Command[Dict[str, Any]]):
|
49
|
+
"""Command to delete a task."""
|
50
|
+
|
51
|
+
def __init__(self, http_client: HTTPClient, task_id: str):
|
52
|
+
self.http_client = http_client
|
53
|
+
self.task_id = task_id
|
54
|
+
|
55
|
+
def execute(self) -> Dict[str, Any]:
|
56
|
+
"""Execute the delete task command."""
|
57
|
+
return self.http_client.delete(f"tasks/{self.task_id}")
|
58
|
+
|
59
|
+
|
60
|
+
class CancelTaskByFilterCommand(Command[Dict[str, Any]]):
|
61
|
+
"""Command to cancel tasks by filter."""
|
62
|
+
|
63
|
+
def __init__(self, http_client: HTTPClient, request_data: Union[CancelTaskByFilterRequest, Dict[str, Any]]):
|
64
|
+
self.http_client = http_client
|
65
|
+
self.request_data = request_data
|
66
|
+
|
67
|
+
def execute(self) -> Dict[str, Any]:
|
68
|
+
"""Execute the cancel task by filter command."""
|
69
|
+
if isinstance(self.request_data, CancelTaskByFilterRequest):
|
70
|
+
payload = self.request_data.model_dump(by_alias=True)
|
71
|
+
else:
|
72
|
+
payload = self.request_data
|
73
|
+
|
74
|
+
# Ensure organizationIds are string values (API expects UUID strings)
|
75
|
+
if 'organizationIds' in payload and isinstance(payload['organizationIds'], list):
|
76
|
+
payload['organizationIds'] = [str(x) for x in payload['organizationIds']]
|
77
|
+
|
78
|
+
return self.http_client.post("tasks/cancel-by-filter", json_data=payload)
|
79
|
+
|
80
|
+
|
81
|
+
class GenerateOffNetworkZipPasswordCommand(Command[Dict[str, Any]]):
|
82
|
+
"""Command to generate off-network zip password."""
|
83
|
+
|
84
|
+
def __init__(self, http_client: HTTPClient, request_data: Union[GenerateOffNetworkZipPasswordRequest, Dict[str, Any]]):
|
85
|
+
self.http_client = http_client
|
86
|
+
self.request_data = request_data
|
87
|
+
|
88
|
+
def execute(self) -> Dict[str, Any]:
|
89
|
+
"""Execute the generate off-network zip password command."""
|
90
|
+
if isinstance(self.request_data, GenerateOffNetworkZipPasswordRequest):
|
91
|
+
payload = self.request_data.model_dump(by_alias=True)
|
92
|
+
else:
|
93
|
+
payload = self.request_data
|
94
|
+
|
95
|
+
return self.http_client.post("tasks/off-network/generate-zip-password", json_data=payload)
|