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
binalyze_air/models/policies.py
CHANGED
@@ -1,250 +1,261 @@
|
|
1
|
-
"""
|
2
|
-
Policy-related data models for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import List, Optional, Dict, Any
|
6
|
-
from datetime import datetime
|
7
|
-
from enum import Enum
|
8
|
-
from pydantic import Field
|
9
|
-
|
10
|
-
from ..base import AIRBaseModel, Filter, PaginatedResponse
|
11
|
-
|
12
|
-
|
13
|
-
class PolicyType(str, Enum):
|
14
|
-
"""Policy type."""
|
15
|
-
ACQUISITION = "acquisition"
|
16
|
-
SECURITY = "security"
|
17
|
-
COMPLIANCE = "compliance"
|
18
|
-
CUSTOM = "custom"
|
19
|
-
|
20
|
-
|
21
|
-
class PolicyStatus(str, Enum):
|
22
|
-
"""Policy status."""
|
23
|
-
ACTIVE = "active"
|
24
|
-
INACTIVE = "inactive"
|
25
|
-
DRAFT = "draft"
|
26
|
-
|
27
|
-
|
28
|
-
class PolicyCondition(AIRBaseModel):
|
29
|
-
"""Policy condition model based on API structure."""
|
30
|
-
|
31
|
-
# For leaf conditions
|
32
|
-
field: Optional[str] = None
|
33
|
-
operator: Optional[str] = None
|
34
|
-
value: Optional[Any] = None
|
35
|
-
|
36
|
-
# For nested conditions (when this is a group)
|
37
|
-
conditions: Optional[List['PolicyCondition']] = None
|
38
|
-
|
39
|
-
|
40
|
-
class PolicyAction(AIRBaseModel):
|
41
|
-
"""Policy action model."""
|
42
|
-
|
43
|
-
type: str
|
44
|
-
parameters: Dict[str, Any] = {}
|
45
|
-
enabled: bool = True
|
46
|
-
|
47
|
-
|
48
|
-
class PolicyRule(AIRBaseModel):
|
49
|
-
"""Policy rule model."""
|
50
|
-
|
51
|
-
id: str
|
52
|
-
name: str
|
53
|
-
description: Optional[str] = None
|
54
|
-
conditions: List[PolicyCondition] = []
|
55
|
-
actions: List[PolicyAction] = []
|
56
|
-
enabled: bool = True
|
57
|
-
priority: int = 0
|
58
|
-
|
59
|
-
|
60
|
-
class PolicyFilterStructure(AIRBaseModel):
|
61
|
-
"""Policy filter model based on API structure."""
|
62
|
-
|
63
|
-
operator: str
|
64
|
-
conditions: List[PolicyCondition]
|
65
|
-
|
66
|
-
|
67
|
-
class PolicyCpuSettings(AIRBaseModel):
|
68
|
-
"""Policy CPU settings."""
|
69
|
-
|
70
|
-
limit: int
|
71
|
-
|
72
|
-
|
73
|
-
class PolicySaveToSettings(AIRBaseModel):
|
74
|
-
"""Policy save-to settings for a platform."""
|
75
|
-
|
76
|
-
location: str
|
77
|
-
path: Optional[str] = None
|
78
|
-
repository_id: Optional[str] = Field(default=None, alias="repositoryId")
|
79
|
-
use_most_free_volume: bool = Field(default=True, alias="useMostFreeVolume")
|
80
|
-
volume: Optional[str] = None
|
81
|
-
tmp: Optional[str] = None
|
82
|
-
|
83
|
-
|
84
|
-
class PolicySaveTo(AIRBaseModel):
|
85
|
-
"""Policy save-to settings for all platforms."""
|
86
|
-
|
87
|
-
windows: Optional[PolicySaveToSettings] = None
|
88
|
-
linux: Optional[PolicySaveToSettings] = None
|
89
|
-
macos: Optional[PolicySaveToSettings] = None
|
90
|
-
|
91
|
-
|
92
|
-
class PolicyEncryption(AIRBaseModel):
|
93
|
-
"""Policy encryption settings."""
|
94
|
-
|
95
|
-
enabled: bool
|
96
|
-
password: Optional[str] = None
|
97
|
-
|
98
|
-
|
99
|
-
class PolicyCompression(AIRBaseModel):
|
100
|
-
"""Policy compression settings."""
|
101
|
-
|
102
|
-
enabled: bool
|
103
|
-
encryption: Optional[PolicyEncryption] = None
|
104
|
-
|
105
|
-
|
106
|
-
class PolicySendTo(AIRBaseModel):
|
107
|
-
"""Policy send-to settings."""
|
108
|
-
|
109
|
-
location: str
|
110
|
-
repository_id: Optional[str] = Field(default=None, alias="repositoryId")
|
111
|
-
|
112
|
-
|
113
|
-
class
|
114
|
-
"""
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
class
|
165
|
-
"""Policy
|
166
|
-
|
167
|
-
id: str
|
168
|
-
policy_id: str
|
169
|
-
endpoint_id: str
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
1
|
+
"""
|
2
|
+
Policy-related data models for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import List, Optional, Dict, Any
|
6
|
+
from datetime import datetime
|
7
|
+
from enum import Enum
|
8
|
+
from pydantic import Field
|
9
|
+
|
10
|
+
from ..base import AIRBaseModel, Filter, PaginatedResponse
|
11
|
+
|
12
|
+
|
13
|
+
class PolicyType(str, Enum):
|
14
|
+
"""Policy type."""
|
15
|
+
ACQUISITION = "acquisition"
|
16
|
+
SECURITY = "security"
|
17
|
+
COMPLIANCE = "compliance"
|
18
|
+
CUSTOM = "custom"
|
19
|
+
|
20
|
+
|
21
|
+
class PolicyStatus(str, Enum):
|
22
|
+
"""Policy status."""
|
23
|
+
ACTIVE = "active"
|
24
|
+
INACTIVE = "inactive"
|
25
|
+
DRAFT = "draft"
|
26
|
+
|
27
|
+
|
28
|
+
class PolicyCondition(AIRBaseModel):
|
29
|
+
"""Policy condition model based on API structure."""
|
30
|
+
|
31
|
+
# For leaf conditions
|
32
|
+
field: Optional[str] = None
|
33
|
+
operator: Optional[str] = None
|
34
|
+
value: Optional[Any] = None
|
35
|
+
|
36
|
+
# For nested conditions (when this is a group)
|
37
|
+
conditions: Optional[List['PolicyCondition']] = None
|
38
|
+
|
39
|
+
|
40
|
+
class PolicyAction(AIRBaseModel):
|
41
|
+
"""Policy action model."""
|
42
|
+
|
43
|
+
type: str
|
44
|
+
parameters: Dict[str, Any] = {}
|
45
|
+
enabled: bool = True
|
46
|
+
|
47
|
+
|
48
|
+
class PolicyRule(AIRBaseModel):
|
49
|
+
"""Policy rule model."""
|
50
|
+
|
51
|
+
id: str
|
52
|
+
name: str
|
53
|
+
description: Optional[str] = None
|
54
|
+
conditions: List[PolicyCondition] = []
|
55
|
+
actions: List[PolicyAction] = []
|
56
|
+
enabled: bool = True
|
57
|
+
priority: int = 0
|
58
|
+
|
59
|
+
|
60
|
+
class PolicyFilterStructure(AIRBaseModel):
|
61
|
+
"""Policy filter model based on API structure."""
|
62
|
+
|
63
|
+
operator: str
|
64
|
+
conditions: List[PolicyCondition]
|
65
|
+
|
66
|
+
|
67
|
+
class PolicyCpuSettings(AIRBaseModel):
|
68
|
+
"""Policy CPU settings."""
|
69
|
+
|
70
|
+
limit: int
|
71
|
+
|
72
|
+
|
73
|
+
class PolicySaveToSettings(AIRBaseModel):
|
74
|
+
"""Policy save-to settings for a platform."""
|
75
|
+
|
76
|
+
location: str
|
77
|
+
path: Optional[str] = None
|
78
|
+
repository_id: Optional[str] = Field(default=None, alias="repositoryId")
|
79
|
+
use_most_free_volume: bool = Field(default=True, alias="useMostFreeVolume")
|
80
|
+
volume: Optional[str] = None
|
81
|
+
tmp: Optional[str] = None
|
82
|
+
|
83
|
+
|
84
|
+
class PolicySaveTo(AIRBaseModel):
|
85
|
+
"""Policy save-to settings for all platforms."""
|
86
|
+
|
87
|
+
windows: Optional[PolicySaveToSettings] = None
|
88
|
+
linux: Optional[PolicySaveToSettings] = None
|
89
|
+
macos: Optional[PolicySaveToSettings] = None
|
90
|
+
|
91
|
+
|
92
|
+
class PolicyEncryption(AIRBaseModel):
|
93
|
+
"""Policy encryption settings."""
|
94
|
+
|
95
|
+
enabled: bool
|
96
|
+
password: Optional[str] = None
|
97
|
+
|
98
|
+
|
99
|
+
class PolicyCompression(AIRBaseModel):
|
100
|
+
"""Policy compression settings."""
|
101
|
+
|
102
|
+
enabled: bool
|
103
|
+
encryption: Optional[PolicyEncryption] = None
|
104
|
+
|
105
|
+
|
106
|
+
class PolicySendTo(AIRBaseModel):
|
107
|
+
"""Policy send-to settings."""
|
108
|
+
|
109
|
+
location: str
|
110
|
+
repository_id: Optional[str] = Field(default=None, alias="repositoryId")
|
111
|
+
|
112
|
+
|
113
|
+
class IsolationAllowedProcess(AIRBaseModel):
|
114
|
+
"""Isolation allowed process model - matches API response format."""
|
115
|
+
|
116
|
+
platform: str # e.g., "linux", "windows", "macos"
|
117
|
+
process_path: str = Field(alias="processPath") # e.g., "firefox", "/usr/bin/firefox"
|
118
|
+
|
119
|
+
|
120
|
+
class Policy(AIRBaseModel):
|
121
|
+
"""Policy model based on API response structure."""
|
122
|
+
|
123
|
+
id: str = Field(alias="_id")
|
124
|
+
name: str
|
125
|
+
organization_ids: List[int] = Field(default=[], alias="organizationIds")
|
126
|
+
default: Optional[bool] = None
|
127
|
+
order: Optional[int] = None
|
128
|
+
created_by: Optional[str] = Field(default=None, alias="createdBy")
|
129
|
+
updated_at: Optional[datetime] = Field(default=None, alias="updatedAt")
|
130
|
+
|
131
|
+
# Policy configuration
|
132
|
+
filter: Optional[PolicyFilterStructure] = None
|
133
|
+
cpu: Optional[PolicyCpuSettings] = None
|
134
|
+
save_to: Optional[PolicySaveTo] = Field(default=None, alias="saveTo")
|
135
|
+
send_to: Optional[PolicySendTo] = Field(default=None, alias="sendTo")
|
136
|
+
compression: Optional[PolicyCompression] = None
|
137
|
+
|
138
|
+
# Optional fields that may be present
|
139
|
+
bandwidth: Optional[Dict[str, Any]] = None
|
140
|
+
disk_space: Optional[Dict[str, Any]] = Field(default=None, alias="diskSpace")
|
141
|
+
triage_local_drives_only: Optional[Dict[str, Any]] = Field(default=None, alias="triageLocalDrivesOnly")
|
142
|
+
isolation_allowed_ips: Optional[List[str]] = Field(default=None, alias="isolationAllowedIps")
|
143
|
+
isolation_allowed_processes: Optional[List[IsolationAllowedProcess]] = Field(default=None, alias="isolationAllowedProcesses")
|
144
|
+
|
145
|
+
def to_dict(self) -> Dict[str, Any]:
|
146
|
+
"""Convert Policy object to dictionary for JSON serialization."""
|
147
|
+
return self.model_dump(exclude_none=True, by_alias=True)
|
148
|
+
|
149
|
+
|
150
|
+
class PolicyPriority(AIRBaseModel):
|
151
|
+
"""Policy priority update model."""
|
152
|
+
|
153
|
+
id: str = Field(alias="_id")
|
154
|
+
order: int
|
155
|
+
|
156
|
+
|
157
|
+
class PolicyMatchStats(AIRBaseModel):
|
158
|
+
"""Policy match statistics model."""
|
159
|
+
|
160
|
+
total_matches: int = Field(alias="totalMatches")
|
161
|
+
policy_matches: List[Dict[str, Any]] = Field(default=[], alias="policyMatches")
|
162
|
+
|
163
|
+
|
164
|
+
class PolicyAssignment(AIRBaseModel):
|
165
|
+
"""Policy assignment model."""
|
166
|
+
|
167
|
+
id: str
|
168
|
+
policy_id: str
|
169
|
+
endpoint_id: str
|
170
|
+
assigned_at: Optional[datetime] = None
|
171
|
+
assigned_by: str
|
172
|
+
status: str = "active"
|
173
|
+
|
174
|
+
|
175
|
+
class PolicyExecution(AIRBaseModel):
|
176
|
+
"""Policy execution result model."""
|
177
|
+
|
178
|
+
id: str
|
179
|
+
policy_id: str
|
180
|
+
endpoint_id: str
|
181
|
+
executed_at: Optional[datetime] = None
|
182
|
+
status: str
|
183
|
+
result: Dict[str, Any] = {}
|
184
|
+
errors: List[str] = []
|
185
|
+
duration: Optional[int] = None
|
186
|
+
|
187
|
+
|
188
|
+
class CreatePolicyRequest(AIRBaseModel):
|
189
|
+
"""Request model for creating a policy - matches API specification exactly."""
|
190
|
+
|
191
|
+
name: str
|
192
|
+
organizationIds: List[int] # Use camelCase to match API
|
193
|
+
filter: PolicyFilterStructure
|
194
|
+
cpu: PolicyCpuSettings
|
195
|
+
saveTo: PolicySaveTo # Use camelCase to match API
|
196
|
+
sendTo: PolicySendTo # Use camelCase to match API
|
197
|
+
compression: PolicyCompression
|
198
|
+
|
199
|
+
# Optional fields
|
200
|
+
bandwidth: Optional[Dict[str, Any]] = None
|
201
|
+
diskSpace: Optional[Dict[str, Any]] = None # Use camelCase
|
202
|
+
triageLocalDrivesOnly: Optional[Dict[str, Any]] = None # Use camelCase
|
203
|
+
isolationAllowedIps: Optional[List[str]] = None # Use camelCase
|
204
|
+
isolationAllowedProcesses: Optional[List[IsolationAllowedProcess]] = None # Use camelCase
|
205
|
+
|
206
|
+
|
207
|
+
class UpdatePolicyRequest(AIRBaseModel):
|
208
|
+
"""Request model for updating a policy - matches API specification exactly."""
|
209
|
+
|
210
|
+
name: str # Required by API
|
211
|
+
organizationIds: List[int] # Required by API - use camelCase
|
212
|
+
filter: PolicyFilterStructure # Required by API
|
213
|
+
cpu: PolicyCpuSettings # Required by API
|
214
|
+
saveTo: PolicySaveTo # Required by API - use camelCase
|
215
|
+
sendTo: PolicySendTo # Required by API - use camelCase
|
216
|
+
compression: PolicyCompression # Required by API
|
217
|
+
|
218
|
+
# Optional fields that may be present
|
219
|
+
bandwidth: Optional[Dict[str, Any]] = None
|
220
|
+
diskSpace: Optional[Dict[str, Any]] = None # Use camelCase
|
221
|
+
triageLocalDrivesOnly: Optional[Dict[str, Any]] = None # Use camelCase
|
222
|
+
isolationAllowedIps: Optional[List[str]] = None # Use camelCase
|
223
|
+
isolationAllowedProcesses: Optional[List[IsolationAllowedProcess]] = None # Use camelCase
|
224
|
+
|
225
|
+
|
226
|
+
class UpdatePoliciesPrioritiesRequest(AIRBaseModel):
|
227
|
+
"""Request model for updating policy priorities."""
|
228
|
+
|
229
|
+
policies: List[PolicyPriority]
|
230
|
+
|
231
|
+
|
232
|
+
class PolicyFilter(Filter):
|
233
|
+
"""Filter for policy queries."""
|
234
|
+
|
235
|
+
organization_ids: Optional[List[int]] = None
|
236
|
+
|
237
|
+
def to_params(self) -> Dict[str, Any]:
|
238
|
+
"""Convert filter to query parameters."""
|
239
|
+
params = {}
|
240
|
+
if self.organization_ids:
|
241
|
+
params["filter[organizationIds]"] = ",".join([str(x) for x in self.organization_ids])
|
242
|
+
return params
|
243
|
+
|
244
|
+
|
245
|
+
class PoliciesPaginatedResponse(PaginatedResponse[Policy]):
|
246
|
+
"""Paginated response for policies."""
|
247
|
+
|
248
|
+
# Add field aliases for pagination fields
|
249
|
+
total_entity_count: int = Field(alias="totalEntityCount")
|
250
|
+
current_page: int = Field(alias="currentPage")
|
251
|
+
page_size: int = Field(alias="pageSize")
|
252
|
+
total_page_count: int = Field(alias="totalPageCount")
|
253
|
+
|
254
|
+
|
255
|
+
class AssignPolicyRequest(AIRBaseModel):
|
256
|
+
"""Request model for assigning policy to endpoints."""
|
257
|
+
|
258
|
+
policy_id: str
|
259
|
+
endpoint_ids: List[str] = []
|
260
|
+
organization_ids: List[int] = []
|
250
261
|
filter_params: Optional[Dict[str, Any]] = None
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"""
|
2
|
+
Preset Filters models for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Optional, List, Dict, Any
|
6
|
+
from datetime import datetime
|
7
|
+
from pydantic import Field
|
8
|
+
|
9
|
+
from ..base import AIRBaseModel
|
10
|
+
|
11
|
+
|
12
|
+
class PresetFilter(AIRBaseModel):
|
13
|
+
"""Preset filter model."""
|
14
|
+
|
15
|
+
id: int
|
16
|
+
organization_id: int = Field(alias="organizationId")
|
17
|
+
type: str
|
18
|
+
name: str
|
19
|
+
filter: List[Dict[str, Any]]
|
20
|
+
created_by: str = Field(alias="createdBy")
|
21
|
+
created_at: datetime = Field(alias="createdAt")
|
22
|
+
updated_at: datetime = Field(alias="updatedAt")
|
23
|
+
|
24
|
+
|
25
|
+
class PresetFiltersList(AIRBaseModel):
|
26
|
+
"""Preset filters list response model."""
|
27
|
+
|
28
|
+
entities: List[PresetFilter]
|
29
|
+
total_entity_count: Optional[int] = Field(alias="totalEntityCount", default=None)
|
30
|
+
current_page: Optional[int] = Field(alias="currentPage", default=None)
|
31
|
+
page_size: Optional[int] = Field(alias="pageSize", default=None)
|
32
|
+
previous_page: Optional[int] = Field(alias="previousPage", default=None)
|
33
|
+
total_page_count: Optional[int] = Field(alias="totalPageCount", default=None)
|
34
|
+
next_page: Optional[int] = Field(alias="nextPage", default=None)
|
35
|
+
filters: Optional[List[Dict[str, Any]]] = None
|
36
|
+
sortables: Optional[List[str]] = None
|
37
|
+
|
38
|
+
|
39
|
+
class PresetFiltersFilter(AIRBaseModel):
|
40
|
+
"""Filter parameters for preset filters queries."""
|
41
|
+
|
42
|
+
organization_id: Optional[int] = None
|
43
|
+
type: Optional[str] = None
|
44
|
+
name: Optional[str] = None
|
45
|
+
created_by: Optional[str] = None
|
46
|
+
page_size: Optional[int] = None
|
47
|
+
page_number: Optional[int] = None
|
48
|
+
sort_by: Optional[str] = None
|
49
|
+
sort_type: Optional[str] = None
|
50
|
+
|
51
|
+
|
52
|
+
class CreatePresetFilterRequest(AIRBaseModel):
|
53
|
+
"""Request model for creating a preset filter."""
|
54
|
+
|
55
|
+
name: str
|
56
|
+
organization_id: int = Field(alias="organizationId")
|
57
|
+
type: str = Field(default="ENDPOINT", alias="type")
|
58
|
+
filter: List[Dict[str, Any]]
|
59
|
+
created_by: str = Field(alias="createdBy")
|
60
|
+
|
61
|
+
def to_dict(self) -> dict:
|
62
|
+
"""Convert to dictionary for API requests, always forcing type to 'ENDPOINT'."""
|
63
|
+
d = self.model_dump(exclude_none=True, by_alias=True)
|
64
|
+
d["type"] = "ENDPOINT"
|
65
|
+
return d
|
66
|
+
|
67
|
+
|
68
|
+
class UpdatePresetFilterRequest(AIRBaseModel):
|
69
|
+
"""Request model for updating a preset filter."""
|
70
|
+
|
71
|
+
name: Optional[str] = None
|
72
|
+
type: Optional[str] = Field(default="ENDPOINT", alias="type")
|
73
|
+
filter: Optional[List[Dict[str, Any]]] = None
|
74
|
+
|
75
|
+
def to_dict(self) -> dict:
|
76
|
+
"""Convert to dictionary for API requests, always forcing type to 'ENDPOINT'."""
|
77
|
+
d = self.model_dump(exclude_none=True, by_alias=True)
|
78
|
+
d["type"] = "ENDPOINT"
|
79
|
+
return d
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"""
|
2
|
+
Recent Activities models for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Optional, List, Dict, Any
|
6
|
+
from datetime import datetime
|
7
|
+
from pydantic import Field
|
8
|
+
|
9
|
+
from ..base import AIRBaseModel
|
10
|
+
|
11
|
+
|
12
|
+
class RecentActivityUser(AIRBaseModel):
|
13
|
+
"""User information in recent activity model."""
|
14
|
+
|
15
|
+
id: str = Field(alias="_id")
|
16
|
+
username: str
|
17
|
+
profile: Dict[str, Any]
|
18
|
+
|
19
|
+
|
20
|
+
class RecentActivity(AIRBaseModel):
|
21
|
+
"""Recent activity model."""
|
22
|
+
|
23
|
+
id: str = Field(alias="_id")
|
24
|
+
type: str
|
25
|
+
username: str
|
26
|
+
entity_id: str = Field(alias="entityId")
|
27
|
+
organization_id: int = Field(alias="organizationId")
|
28
|
+
last_used_at: datetime = Field(alias="lastUsedAt")
|
29
|
+
created_at: datetime = Field(alias="createdAt")
|
30
|
+
updated_at: datetime = Field(alias="updatedAt")
|
31
|
+
user: RecentActivityUser
|
32
|
+
data: Dict[str, Any]
|
33
|
+
|
34
|
+
|
35
|
+
class RecentActivitiesList(AIRBaseModel):
|
36
|
+
"""Recent activities list response model."""
|
37
|
+
|
38
|
+
entities: List[RecentActivity]
|
39
|
+
total_entity_count: Optional[int] = None
|
40
|
+
current_page: Optional[int] = None
|
41
|
+
page_size: Optional[int] = None
|
42
|
+
previous_page: Optional[int] = None
|
43
|
+
total_page_count: Optional[int] = None
|
44
|
+
next_page: Optional[int] = None
|
45
|
+
filters: Optional[List[Dict[str, Any]]] = None
|
46
|
+
sortables: Optional[List[str]] = None
|
47
|
+
|
48
|
+
|
49
|
+
class RecentActivitiesFilter(AIRBaseModel):
|
50
|
+
"""Filter parameters for recent activities queries."""
|
51
|
+
|
52
|
+
organization_id: Optional[int] = None
|
53
|
+
type: Optional[str] = None
|
54
|
+
username: Optional[str] = None
|
55
|
+
search_term: Optional[str] = None
|
56
|
+
page_size: Optional[int] = None
|
57
|
+
page_number: Optional[int] = None
|
58
|
+
sort_by: Optional[str] = None
|
59
|
+
sort_type: Optional[str] = None
|
60
|
+
|
61
|
+
|
62
|
+
class CreateRecentActivityRequest(AIRBaseModel):
|
63
|
+
"""Request model for creating a recent activity."""
|
64
|
+
|
65
|
+
type: str
|
66
|
+
entity_id: str = Field(alias="entityId")
|
67
|
+
# Optional fields - API will auto-populate from authenticated user
|
68
|
+
username: Optional[str] = None
|
69
|
+
organization_id: Optional[int] = None
|
70
|
+
data: Optional[Dict[str, Any]] = None
|