binalyze-air-sdk 1.0.1__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.1.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.1.dist-info/METADATA +0 -635
- binalyze_air_sdk-1.0.1.dist-info/RECORD +0 -82
- {binalyze_air_sdk-1.0.1.dist-info → binalyze_air_sdk-1.0.3.dist-info}/top_level.txt +0 -0
@@ -1,83 +1,193 @@
|
|
1
|
-
"""
|
2
|
-
User Management-related queries for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import List, Optional
|
6
|
-
|
7
|
-
from ..base import Query
|
8
|
-
from ..models.user_management import
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
1
|
+
"""
|
2
|
+
User Management-related queries for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import List, Optional
|
6
|
+
|
7
|
+
from ..base import Query
|
8
|
+
from ..models.user_management import (
|
9
|
+
UserManagementUser, AIUser, APIUser, UserFilter,
|
10
|
+
Role, Privilege, UserGroup, UserGroupFilter
|
11
|
+
)
|
12
|
+
from ..http_client import HTTPClient
|
13
|
+
|
14
|
+
|
15
|
+
class ListUsersQuery(Query[List[UserManagementUser]]):
|
16
|
+
"""Query to list users."""
|
17
|
+
|
18
|
+
def __init__(self, http_client: HTTPClient, filter_params: Optional[UserFilter] = None):
|
19
|
+
self.http_client = http_client
|
20
|
+
self.filter_params = filter_params
|
21
|
+
|
22
|
+
def execute(self) -> List[UserManagementUser]:
|
23
|
+
"""Execute the list users query."""
|
24
|
+
params = {}
|
25
|
+
if self.filter_params:
|
26
|
+
params = self.filter_params.model_dump(exclude_none=True)
|
27
|
+
|
28
|
+
# FIX: Add default organization ID handling to prevent validation errors
|
29
|
+
# API requires organizationIds parameter to be non-empty
|
30
|
+
if "filter[organizationIds]" not in params and "organizationIds" not in params:
|
31
|
+
params["filter[organizationIds]"] = "0" # Default to organization 0
|
32
|
+
|
33
|
+
response = self.http_client.get("user-management/users", params=params)
|
34
|
+
|
35
|
+
if response.get("success"):
|
36
|
+
users_data = response.get("result", {}).get("entities", [])
|
37
|
+
return [UserManagementUser(**user) for user in users_data]
|
38
|
+
|
39
|
+
return []
|
40
|
+
|
41
|
+
|
42
|
+
class GetUserQuery(Query[UserManagementUser]):
|
43
|
+
"""Query to get user by ID."""
|
44
|
+
|
45
|
+
def __init__(self, http_client: HTTPClient, user_id: str):
|
46
|
+
self.http_client = http_client
|
47
|
+
self.user_id = user_id
|
48
|
+
|
49
|
+
def execute(self) -> UserManagementUser:
|
50
|
+
"""Execute the get user query."""
|
51
|
+
response = self.http_client.get(f"user-management/users/{self.user_id}")
|
52
|
+
|
53
|
+
if response.get("success"):
|
54
|
+
user_data = response.get("result", {})
|
55
|
+
return UserManagementUser(**user_data)
|
56
|
+
|
57
|
+
raise Exception(f"User not found: {self.user_id}")
|
58
|
+
|
59
|
+
|
60
|
+
class GetAIUserQuery(Query[AIUser]):
|
61
|
+
"""Query to get AI user."""
|
62
|
+
|
63
|
+
def __init__(self, http_client: HTTPClient):
|
64
|
+
self.http_client = http_client
|
65
|
+
|
66
|
+
def execute(self) -> AIUser:
|
67
|
+
"""Execute the get AI user query."""
|
68
|
+
response = self.http_client.get("user-management/users/ai-user")
|
69
|
+
|
70
|
+
if response.get("success"):
|
71
|
+
ai_user_data = response.get("result", {})
|
72
|
+
return AIUser(**ai_user_data)
|
73
|
+
|
74
|
+
raise Exception("AI user not found")
|
75
|
+
|
76
|
+
|
77
|
+
class GetAPIUserQuery(Query[APIUser]):
|
78
|
+
"""Query to get API user."""
|
79
|
+
|
80
|
+
def __init__(self, http_client: HTTPClient):
|
81
|
+
self.http_client = http_client
|
82
|
+
|
83
|
+
def execute(self) -> APIUser:
|
84
|
+
"""Execute the get API user query."""
|
85
|
+
response = self.http_client.get("user-management/users/api-user")
|
86
|
+
|
87
|
+
if response.get("success"):
|
88
|
+
api_user_data = response.get("result", {})
|
89
|
+
return APIUser(**api_user_data)
|
90
|
+
|
91
|
+
raise Exception("API user not found")
|
92
|
+
|
93
|
+
|
94
|
+
# Privilege Queries
|
95
|
+
class GetPrivilegesQuery(Query[List[Privilege]]):
|
96
|
+
"""Query to get privileges."""
|
97
|
+
|
98
|
+
def __init__(self, http_client: HTTPClient):
|
99
|
+
self.http_client = http_client
|
100
|
+
|
101
|
+
def execute(self) -> List[Privilege]:
|
102
|
+
"""Execute the get privileges query."""
|
103
|
+
response = self.http_client.get("user-management/roles") # Note: privileges endpoint shares same path
|
104
|
+
|
105
|
+
if response.get("success"):
|
106
|
+
# Extract privileges from the response - they're typically embedded in role data
|
107
|
+
privileges_data = response.get("result", [])
|
108
|
+
# This might need adjustment based on actual API response structure
|
109
|
+
return [Privilege(**privilege) for privilege in privileges_data]
|
110
|
+
|
111
|
+
return []
|
112
|
+
|
113
|
+
|
114
|
+
# Role Queries
|
115
|
+
class ListRolesQuery(Query[List[Role]]):
|
116
|
+
"""Query to list roles."""
|
117
|
+
|
118
|
+
def __init__(self, http_client: HTTPClient):
|
119
|
+
self.http_client = http_client
|
120
|
+
|
121
|
+
def execute(self) -> List[Role]:
|
122
|
+
"""Execute the list roles query."""
|
123
|
+
response = self.http_client.get("user-management/roles")
|
124
|
+
|
125
|
+
if response.get("success"):
|
126
|
+
roles_data = response.get("result", [])
|
127
|
+
return [Role(**role) for role in roles_data]
|
128
|
+
|
129
|
+
return []
|
130
|
+
|
131
|
+
|
132
|
+
class GetRoleQuery(Query[Role]):
|
133
|
+
"""Query to get role by ID."""
|
134
|
+
|
135
|
+
def __init__(self, http_client: HTTPClient, role_id: str):
|
136
|
+
self.http_client = http_client
|
137
|
+
self.role_id = role_id
|
138
|
+
|
139
|
+
def execute(self) -> Role:
|
140
|
+
"""Execute the get role query."""
|
141
|
+
response = self.http_client.get(f"user-management/roles/{self.role_id}")
|
142
|
+
|
143
|
+
if response.get("success"):
|
144
|
+
role_data = response.get("result", {})
|
145
|
+
return Role(**role_data)
|
146
|
+
|
147
|
+
raise Exception(f"Role not found: {self.role_id}")
|
148
|
+
|
149
|
+
|
150
|
+
# User Group Queries
|
151
|
+
class ListUserGroupsQuery(Query[List[UserGroup]]):
|
152
|
+
"""Query to list user groups."""
|
153
|
+
|
154
|
+
def __init__(self, http_client: HTTPClient, filter_params: Optional[UserGroupFilter] = None):
|
155
|
+
self.http_client = http_client
|
156
|
+
self.filter_params = filter_params
|
157
|
+
|
158
|
+
def execute(self) -> List[UserGroup]:
|
159
|
+
"""Execute the list user groups query."""
|
160
|
+
params = {}
|
161
|
+
if self.filter_params:
|
162
|
+
params = self.filter_params.model_dump(exclude_none=True)
|
163
|
+
|
164
|
+
# FIX: Add default organization ID handling to prevent validation errors
|
165
|
+
# API requires organizationIds parameter to be non-empty
|
166
|
+
if "filter[organizationIds]" not in params and "organizationIds" not in params:
|
167
|
+
params["filter[organizationIds]"] = "0" # Default to organization 0
|
168
|
+
|
169
|
+
response = self.http_client.get("user-management/user-groups", params=params)
|
170
|
+
|
171
|
+
if response.get("success"):
|
172
|
+
groups_data = response.get("result", {}).get("entities", [])
|
173
|
+
return [UserGroup(**group) for group in groups_data]
|
174
|
+
|
175
|
+
return []
|
176
|
+
|
177
|
+
|
178
|
+
class GetUserGroupQuery(Query[UserGroup]):
|
179
|
+
"""Query to get user group by ID."""
|
180
|
+
|
181
|
+
def __init__(self, http_client: HTTPClient, group_id: str):
|
182
|
+
self.http_client = http_client
|
183
|
+
self.group_id = group_id
|
184
|
+
|
185
|
+
def execute(self) -> UserGroup:
|
186
|
+
"""Execute the get user group query."""
|
187
|
+
response = self.http_client.get(f"user-management/user-groups/{self.group_id}")
|
188
|
+
|
189
|
+
if response.get("success"):
|
190
|
+
group_data = response.get("result", {})
|
191
|
+
return UserGroup(**group_data)
|
192
|
+
|
193
|
+
raise Exception(f"User group not found: {self.group_id}")
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"""
|
2
|
+
Webhook Executions queries for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from ..base import Query
|
6
|
+
from ..models.webhook_executions import TaskDetailsData
|
7
|
+
from ..http_client import HTTPClient
|
8
|
+
|
9
|
+
|
10
|
+
class GetTaskDetailsQuery(Query[TaskDetailsData]):
|
11
|
+
"""Query to get task details data for a webhook execution."""
|
12
|
+
|
13
|
+
def __init__(self, http_client: HTTPClient, slug: str, task_id: str, token: str):
|
14
|
+
self.http_client = http_client
|
15
|
+
self.slug = slug
|
16
|
+
self.task_id = task_id
|
17
|
+
self.token = token
|
18
|
+
|
19
|
+
def execute(self) -> TaskDetailsData:
|
20
|
+
"""Execute the query to get task details."""
|
21
|
+
params = {
|
22
|
+
'token': self.token,
|
23
|
+
'taskId': self.task_id
|
24
|
+
}
|
25
|
+
|
26
|
+
response = self.http_client.get(f'/api/webhook/{self.slug}/assignments', params=params)
|
27
|
+
|
28
|
+
# The response structure may vary, so we'll create a TaskDetailsData object
|
29
|
+
# with the available information
|
30
|
+
result_data = response.get('result', response)
|
31
|
+
|
32
|
+
return TaskDetailsData(
|
33
|
+
task_id=self.task_id,
|
34
|
+
task_name=result_data.get('taskName'),
|
35
|
+
task_status=result_data.get('taskStatus'),
|
36
|
+
task_type=result_data.get('taskType'),
|
37
|
+
created_at=result_data.get('createdAt'),
|
38
|
+
assignments=result_data.get('assignments', result_data)
|
39
|
+
)
|