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
@@ -0,0 +1,88 @@
|
|
1
|
+
"""
|
2
|
+
Cloud Forensics commands for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Dict, Any
|
6
|
+
|
7
|
+
from ..base import Command
|
8
|
+
from ..models.cloud_forensics import (
|
9
|
+
CloudAccount, CreateCloudAccountRequest, UpdateCloudAccountRequest,
|
10
|
+
CloudVendorSyncResult, CloudVendor
|
11
|
+
)
|
12
|
+
from ..http_client import HTTPClient
|
13
|
+
|
14
|
+
|
15
|
+
class CreateCloudAccountCommand(Command[CloudAccount]):
|
16
|
+
"""Command to create a new cloud account."""
|
17
|
+
|
18
|
+
def __init__(self, http_client: HTTPClient, request: CreateCloudAccountRequest):
|
19
|
+
self.http_client = http_client
|
20
|
+
self.request = request
|
21
|
+
|
22
|
+
def execute(self) -> CloudAccount:
|
23
|
+
"""Execute the command."""
|
24
|
+
response = self.http_client.post(
|
25
|
+
"cloud-forensics/accounts",
|
26
|
+
json_data=self.request.model_dump(by_alias=True, exclude_none=True)
|
27
|
+
)
|
28
|
+
return CloudAccount(**response["result"])
|
29
|
+
|
30
|
+
|
31
|
+
class UpdateCloudAccountCommand(Command[CloudAccount]):
|
32
|
+
"""Command to update an existing cloud account."""
|
33
|
+
|
34
|
+
def __init__(self, http_client: HTTPClient, account_id: str, request: UpdateCloudAccountRequest):
|
35
|
+
self.http_client = http_client
|
36
|
+
self.account_id = account_id
|
37
|
+
self.request = request
|
38
|
+
|
39
|
+
def execute(self) -> CloudAccount:
|
40
|
+
"""Execute the command."""
|
41
|
+
response = self.http_client.patch(
|
42
|
+
f"cloud-forensics/accounts/{self.account_id}",
|
43
|
+
json_data=self.request.model_dump(by_alias=True, exclude_none=True)
|
44
|
+
)
|
45
|
+
return CloudAccount(**response["result"])
|
46
|
+
|
47
|
+
|
48
|
+
class DeleteCloudAccountCommand(Command[Dict[str, Any]]):
|
49
|
+
"""Command to delete a cloud account."""
|
50
|
+
|
51
|
+
def __init__(self, http_client: HTTPClient, account_id: str):
|
52
|
+
self.http_client = http_client
|
53
|
+
self.account_id = account_id
|
54
|
+
|
55
|
+
def execute(self) -> Dict[str, Any]:
|
56
|
+
"""Execute the command."""
|
57
|
+
response = self.http_client.delete(f"cloud-forensics/accounts/{self.account_id}")
|
58
|
+
return response
|
59
|
+
|
60
|
+
|
61
|
+
class SyncCloudAccountsCommand(Command[CloudVendorSyncResult]):
|
62
|
+
"""Command to sync cloud accounts."""
|
63
|
+
|
64
|
+
def __init__(self, http_client: HTTPClient, cloud_vendor: CloudVendor):
|
65
|
+
self.http_client = http_client
|
66
|
+
self.cloud_vendor = cloud_vendor
|
67
|
+
|
68
|
+
def execute(self) -> CloudVendorSyncResult:
|
69
|
+
"""Execute the command."""
|
70
|
+
response = self.http_client.post(f"cloud-forensics/accounts/sync/{self.cloud_vendor}")
|
71
|
+
|
72
|
+
if response.get("success"):
|
73
|
+
result_data = response.get("result")
|
74
|
+
# Handle null result properly - API may return null
|
75
|
+
if result_data is None:
|
76
|
+
# Return a minimal CloudVendorSyncResult for null responses
|
77
|
+
from datetime import datetime
|
78
|
+
# Use model_validate instead of direct constructor to ensure proper field mapping
|
79
|
+
return CloudVendorSyncResult.model_validate({
|
80
|
+
"cloudVendor": self.cloud_vendor,
|
81
|
+
"accountsSynced": 0,
|
82
|
+
"totalAssetsDiscovered": 0,
|
83
|
+
"syncStartedAt": datetime.now(),
|
84
|
+
"accountResults": []
|
85
|
+
})
|
86
|
+
return CloudVendorSyncResult(**result_data)
|
87
|
+
|
88
|
+
raise Exception(f"Failed to sync cloud accounts: {response.get('errors', [])}")
|
@@ -1,102 +1,102 @@
|
|
1
|
-
"""
|
2
|
-
Event Subscription commands for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from typing import Dict, Any, Union
|
6
|
-
|
7
|
-
from ..base import Command
|
8
|
-
from ..models.event_subscription import EventSubscription, CreateEventSubscriptionRequest, UpdateEventSubscriptionRequest
|
9
|
-
from ..http_client import HTTPClient
|
10
|
-
|
11
|
-
|
12
|
-
class CreateEventSubscriptionCommand(Command[EventSubscription]):
|
13
|
-
"""Command to create an event subscription."""
|
14
|
-
|
15
|
-
def __init__(self, http_client: HTTPClient, request: Union[CreateEventSubscriptionRequest, Dict[str, Any]]):
|
16
|
-
self.http_client = http_client
|
17
|
-
self.request = request
|
18
|
-
|
19
|
-
def execute(self) -> EventSubscription:
|
20
|
-
"""Execute the command to create an event subscription."""
|
21
|
-
# Handle both dict and model objects
|
22
|
-
if isinstance(self.request, dict):
|
23
|
-
data = self.request
|
24
|
-
else:
|
25
|
-
data = self.request.model_dump(exclude_none=True)
|
26
|
-
|
27
|
-
response = self.http_client.post("event-subscription", json_data=data)
|
28
|
-
|
29
|
-
# Handle null result from API
|
30
|
-
result = response.get("result")
|
31
|
-
if result is None:
|
32
|
-
# If result is null but status is success, create a basic EventSubscription
|
33
|
-
if response.get("success"):
|
34
|
-
# Use Pydantic parsing with proper field aliasing
|
35
|
-
basic_data = {
|
36
|
-
"id": data.get("name", "unknown"), # Use name as fallback ID
|
37
|
-
"name": data.get("name", ""),
|
38
|
-
"url": data.get("url", ""),
|
39
|
-
"active": data.get("active", True),
|
40
|
-
"events": data.get("events", []),
|
41
|
-
"organizationId": data.get("organizationId", 0)
|
42
|
-
}
|
43
|
-
return EventSubscription.model_validate(basic_data)
|
44
|
-
else:
|
45
|
-
# Create empty EventSubscription for failed requests
|
46
|
-
basic_data = {
|
47
|
-
"id": "failed",
|
48
|
-
"name": "Failed Creation"
|
49
|
-
}
|
50
|
-
return EventSubscription.model_validate(basic_data)
|
51
|
-
|
52
|
-
# Convert id to string as Pydantic expects
|
53
|
-
if "id" in result:
|
54
|
-
result["id"] = str(result["id"])
|
55
|
-
|
56
|
-
# Use Pydantic parsing with proper field aliasing
|
57
|
-
return EventSubscription.model_validate(result)
|
58
|
-
|
59
|
-
|
60
|
-
class UpdateEventSubscriptionCommand(Command[EventSubscription]):
|
61
|
-
"""Command to update an event subscription."""
|
62
|
-
|
63
|
-
def __init__(self, http_client: HTTPClient, subscription_id: str, request: Union[UpdateEventSubscriptionRequest, Dict[str, Any]]):
|
64
|
-
self.http_client = http_client
|
65
|
-
self.subscription_id = subscription_id
|
66
|
-
self.request = request
|
67
|
-
|
68
|
-
def execute(self) -> EventSubscription:
|
69
|
-
"""Execute the command to update an event subscription."""
|
70
|
-
# Handle both dict and model objects
|
71
|
-
if isinstance(self.request, dict):
|
72
|
-
data = self.request
|
73
|
-
else:
|
74
|
-
data = self.request.model_dump(exclude_none=True)
|
75
|
-
|
76
|
-
response = self.http_client.put(
|
77
|
-
f"event-subscription/{self.subscription_id}",
|
78
|
-
json_data=data
|
79
|
-
)
|
80
|
-
|
81
|
-
result = response.get("result", {})
|
82
|
-
|
83
|
-
# Convert id to string as Pydantic expects
|
84
|
-
if "id" in result:
|
85
|
-
result["id"] = str(result["id"])
|
86
|
-
|
87
|
-
# Use Pydantic parsing with proper field aliasing
|
88
|
-
return EventSubscription.model_validate(result)
|
89
|
-
|
90
|
-
|
91
|
-
class DeleteEventSubscriptionCommand(Command[Dict[str, Any]]):
|
92
|
-
"""Command to delete an event subscription."""
|
93
|
-
|
94
|
-
def __init__(self, http_client: HTTPClient, subscription_id: str):
|
95
|
-
self.http_client = http_client
|
96
|
-
self.subscription_id = subscription_id
|
97
|
-
|
98
|
-
def execute(self) -> Dict[str, Any]:
|
99
|
-
"""Execute the command to delete an event subscription."""
|
100
|
-
response = self.http_client.delete(f"event-subscription/{self.subscription_id}")
|
101
|
-
|
1
|
+
"""
|
2
|
+
Event Subscription commands for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Dict, Any, Union
|
6
|
+
|
7
|
+
from ..base import Command
|
8
|
+
from ..models.event_subscription import EventSubscription, CreateEventSubscriptionRequest, UpdateEventSubscriptionRequest
|
9
|
+
from ..http_client import HTTPClient
|
10
|
+
|
11
|
+
|
12
|
+
class CreateEventSubscriptionCommand(Command[EventSubscription]):
|
13
|
+
"""Command to create an event subscription."""
|
14
|
+
|
15
|
+
def __init__(self, http_client: HTTPClient, request: Union[CreateEventSubscriptionRequest, Dict[str, Any]]):
|
16
|
+
self.http_client = http_client
|
17
|
+
self.request = request
|
18
|
+
|
19
|
+
def execute(self) -> EventSubscription:
|
20
|
+
"""Execute the command to create an event subscription."""
|
21
|
+
# Handle both dict and model objects
|
22
|
+
if isinstance(self.request, dict):
|
23
|
+
data = self.request
|
24
|
+
else:
|
25
|
+
data = self.request.model_dump(exclude_none=True)
|
26
|
+
|
27
|
+
response = self.http_client.post("event-subscription", json_data=data)
|
28
|
+
|
29
|
+
# Handle null result from API
|
30
|
+
result = response.get("result")
|
31
|
+
if result is None:
|
32
|
+
# If result is null but status is success, create a basic EventSubscription
|
33
|
+
if response.get("success"):
|
34
|
+
# Use Pydantic parsing with proper field aliasing
|
35
|
+
basic_data = {
|
36
|
+
"id": data.get("name", "unknown"), # Use name as fallback ID
|
37
|
+
"name": data.get("name", ""),
|
38
|
+
"url": data.get("url", ""),
|
39
|
+
"active": data.get("active", True),
|
40
|
+
"events": data.get("events", []),
|
41
|
+
"organizationId": data.get("organizationId", 0)
|
42
|
+
}
|
43
|
+
return EventSubscription.model_validate(basic_data)
|
44
|
+
else:
|
45
|
+
# Create empty EventSubscription for failed requests
|
46
|
+
basic_data = {
|
47
|
+
"id": "failed",
|
48
|
+
"name": "Failed Creation"
|
49
|
+
}
|
50
|
+
return EventSubscription.model_validate(basic_data)
|
51
|
+
|
52
|
+
# Convert id to string as Pydantic expects
|
53
|
+
if "id" in result:
|
54
|
+
result["id"] = str(result["id"])
|
55
|
+
|
56
|
+
# Use Pydantic parsing with proper field aliasing
|
57
|
+
return EventSubscription.model_validate(result)
|
58
|
+
|
59
|
+
|
60
|
+
class UpdateEventSubscriptionCommand(Command[EventSubscription]):
|
61
|
+
"""Command to update an event subscription."""
|
62
|
+
|
63
|
+
def __init__(self, http_client: HTTPClient, subscription_id: str, request: Union[UpdateEventSubscriptionRequest, Dict[str, Any]]):
|
64
|
+
self.http_client = http_client
|
65
|
+
self.subscription_id = subscription_id
|
66
|
+
self.request = request
|
67
|
+
|
68
|
+
def execute(self) -> EventSubscription:
|
69
|
+
"""Execute the command to update an event subscription."""
|
70
|
+
# Handle both dict and model objects
|
71
|
+
if isinstance(self.request, dict):
|
72
|
+
data = self.request
|
73
|
+
else:
|
74
|
+
data = self.request.model_dump(exclude_none=True)
|
75
|
+
|
76
|
+
response = self.http_client.put(
|
77
|
+
f"event-subscription/{self.subscription_id}",
|
78
|
+
json_data=data
|
79
|
+
)
|
80
|
+
|
81
|
+
result = response.get("result", {})
|
82
|
+
|
83
|
+
# Convert id to string as Pydantic expects
|
84
|
+
if "id" in result:
|
85
|
+
result["id"] = str(result["id"])
|
86
|
+
|
87
|
+
# Use Pydantic parsing with proper field aliasing
|
88
|
+
return EventSubscription.model_validate(result)
|
89
|
+
|
90
|
+
|
91
|
+
class DeleteEventSubscriptionCommand(Command[Dict[str, Any]]):
|
92
|
+
"""Command to delete an event subscription."""
|
93
|
+
|
94
|
+
def __init__(self, http_client: HTTPClient, subscription_id: str):
|
95
|
+
self.http_client = http_client
|
96
|
+
self.subscription_id = subscription_id
|
97
|
+
|
98
|
+
def execute(self) -> Dict[str, Any]:
|
99
|
+
"""Execute the command to delete an event subscription."""
|
100
|
+
response = self.http_client.delete(f"event-subscription/{self.subscription_id}")
|
101
|
+
|
102
102
|
return response
|