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/__init__.py
CHANGED
@@ -1,77 +1,77 @@
|
|
1
|
-
"""
|
2
|
-
Binalyze AIR Python SDK
|
3
|
-
|
4
|
-
A comprehensive Python SDK for interacting with the Binalyze AIR API using CQRS architecture.
|
5
|
-
"""
|
6
|
-
|
7
|
-
from .client import AIRClient
|
8
|
-
from .config import AIRConfig
|
9
|
-
from .exceptions import (
|
10
|
-
AIRAPIError,
|
11
|
-
AuthenticationError,
|
12
|
-
NotFoundError,
|
13
|
-
ValidationError,
|
14
|
-
RateLimitError,
|
15
|
-
)
|
16
|
-
|
17
|
-
# Export commonly used models
|
18
|
-
from .models import (
|
19
|
-
# Assets
|
20
|
-
Asset, AssetDetail, AssetTask, AssetFilter, AssetTaskFilter,
|
21
|
-
# Cases
|
22
|
-
Case, CaseActivity, CaseEndpoint, CaseTask, User, CaseFilter, CaseActivityFilter,
|
23
|
-
CreateCaseRequest, UpdateCaseRequest, CaseStatus,
|
24
|
-
# Tasks
|
25
|
-
Task, TaskFilter, TaskStatus, TaskType,
|
26
|
-
# Acquisitions
|
27
|
-
AcquisitionProfile, AcquisitionProfileDetails, AcquisitionFilter,
|
28
|
-
AcquisitionTaskRequest, ImageAcquisitionTaskRequest, CreateAcquisitionProfileRequest,
|
29
|
-
AuditLog, AuditFilter, AuditLogsFilter, AuditSummary, AuditUserActivity, AuditSystemEvent,
|
30
|
-
)
|
31
|
-
|
32
|
-
__version__ = "1.0.1"
|
33
|
-
__all__ = [
|
34
|
-
# Core classes
|
35
|
-
"AIRClient",
|
36
|
-
"AIRConfig",
|
37
|
-
|
38
|
-
# Exceptions
|
39
|
-
"AIRAPIError",
|
40
|
-
"AuthenticationError",
|
41
|
-
"NotFoundError",
|
42
|
-
"ValidationError",
|
43
|
-
"RateLimitError",
|
44
|
-
|
45
|
-
# Asset models
|
46
|
-
"Asset",
|
47
|
-
"AssetDetail",
|
48
|
-
"AssetTask",
|
49
|
-
"AssetFilter",
|
50
|
-
"AssetTaskFilter",
|
51
|
-
|
52
|
-
# Case models
|
53
|
-
"Case",
|
54
|
-
"CaseActivity",
|
55
|
-
"CaseEndpoint",
|
56
|
-
"CaseTask",
|
57
|
-
"User",
|
58
|
-
"CaseFilter",
|
59
|
-
"CaseActivityFilter",
|
60
|
-
"CreateCaseRequest",
|
61
|
-
"UpdateCaseRequest",
|
62
|
-
"CaseStatus",
|
63
|
-
|
64
|
-
# Task models
|
65
|
-
"Task",
|
66
|
-
"TaskFilter",
|
67
|
-
"TaskStatus",
|
68
|
-
"TaskType",
|
69
|
-
|
70
|
-
# Acquisition models
|
71
|
-
"AcquisitionProfile",
|
72
|
-
"AcquisitionProfileDetails",
|
73
|
-
"AcquisitionFilter",
|
74
|
-
"AcquisitionTaskRequest",
|
75
|
-
"ImageAcquisitionTaskRequest",
|
76
|
-
"CreateAcquisitionProfileRequest",
|
77
|
-
]
|
1
|
+
"""
|
2
|
+
Binalyze AIR Python SDK
|
3
|
+
|
4
|
+
A comprehensive Python SDK for interacting with the Binalyze AIR API using CQRS architecture.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from .client import AIRClient
|
8
|
+
from .config import AIRConfig
|
9
|
+
from .exceptions import (
|
10
|
+
AIRAPIError,
|
11
|
+
AuthenticationError,
|
12
|
+
NotFoundError,
|
13
|
+
ValidationError,
|
14
|
+
RateLimitError,
|
15
|
+
)
|
16
|
+
|
17
|
+
# Export commonly used models
|
18
|
+
from .models import (
|
19
|
+
# Assets
|
20
|
+
Asset, AssetDetail, AssetTask, AssetFilter, AssetTaskFilter,
|
21
|
+
# Cases
|
22
|
+
Case, CaseActivity, CaseEndpoint, CaseTask, User, CaseFilter, CaseActivityFilter,
|
23
|
+
CreateCaseRequest, UpdateCaseRequest, CaseStatus,
|
24
|
+
# Tasks
|
25
|
+
Task, TaskFilter, TaskStatus, TaskType,
|
26
|
+
# Acquisitions
|
27
|
+
AcquisitionProfile, AcquisitionProfileDetails, AcquisitionFilter,
|
28
|
+
AcquisitionTaskRequest, ImageAcquisitionTaskRequest, CreateAcquisitionProfileRequest,
|
29
|
+
AuditLog, AuditFilter, AuditLogsFilter, AuditSummary, AuditUserActivity, AuditSystemEvent,
|
30
|
+
)
|
31
|
+
|
32
|
+
__version__ = "1.0.1"
|
33
|
+
__all__ = [
|
34
|
+
# Core classes
|
35
|
+
"AIRClient",
|
36
|
+
"AIRConfig",
|
37
|
+
|
38
|
+
# Exceptions
|
39
|
+
"AIRAPIError",
|
40
|
+
"AuthenticationError",
|
41
|
+
"NotFoundError",
|
42
|
+
"ValidationError",
|
43
|
+
"RateLimitError",
|
44
|
+
|
45
|
+
# Asset models
|
46
|
+
"Asset",
|
47
|
+
"AssetDetail",
|
48
|
+
"AssetTask",
|
49
|
+
"AssetFilter",
|
50
|
+
"AssetTaskFilter",
|
51
|
+
|
52
|
+
# Case models
|
53
|
+
"Case",
|
54
|
+
"CaseActivity",
|
55
|
+
"CaseEndpoint",
|
56
|
+
"CaseTask",
|
57
|
+
"User",
|
58
|
+
"CaseFilter",
|
59
|
+
"CaseActivityFilter",
|
60
|
+
"CreateCaseRequest",
|
61
|
+
"UpdateCaseRequest",
|
62
|
+
"CaseStatus",
|
63
|
+
|
64
|
+
# Task models
|
65
|
+
"Task",
|
66
|
+
"TaskFilter",
|
67
|
+
"TaskStatus",
|
68
|
+
"TaskType",
|
69
|
+
|
70
|
+
# Acquisition models
|
71
|
+
"AcquisitionProfile",
|
72
|
+
"AcquisitionProfileDetails",
|
73
|
+
"AcquisitionFilter",
|
74
|
+
"AcquisitionTaskRequest",
|
75
|
+
"ImageAcquisitionTaskRequest",
|
76
|
+
"CreateAcquisitionProfileRequest",
|
77
|
+
]
|
binalyze_air/apis/__init__.py
CHANGED
@@ -1,27 +1,67 @@
|
|
1
|
-
"""
|
2
|
-
API classes for the Binalyze AIR SDK.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from .
|
8
|
-
from .
|
9
|
-
from .
|
10
|
-
from .
|
11
|
-
from .
|
12
|
-
from .
|
13
|
-
from .
|
14
|
-
from .
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
"""
|
2
|
+
API classes for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from .assets import AssetsAPI
|
6
|
+
from .cases import CasesAPI
|
7
|
+
from .tasks import TasksAPI
|
8
|
+
from .acquisitions import AcquisitionsAPI
|
9
|
+
from .policies import PoliciesAPI
|
10
|
+
from .organizations import OrganizationsAPI
|
11
|
+
from .triage import TriageAPI
|
12
|
+
from .audit_logs import AuditAPI
|
13
|
+
from .baseline import BaselineAPI
|
14
|
+
from .auth import AuthAPI
|
15
|
+
from .evidence import EvidenceAPI
|
16
|
+
from .auto_asset_tags import AutoAssetTagsAPI
|
17
|
+
from .event_subscription import EventSubscriptionAPI
|
18
|
+
from .interact import InteractAPI
|
19
|
+
from .params import ParamsAPI
|
20
|
+
from .settings import SettingsAPI
|
21
|
+
from .webhooks import WebhookAPI
|
22
|
+
from .api_tokens import APITokensAPI
|
23
|
+
from .investigation_hub import InvestigationHubAPI
|
24
|
+
from .cloud_forensics import CloudForensicsAPI
|
25
|
+
from .backup import BackupAPI
|
26
|
+
from .license import LicenseAPI
|
27
|
+
from .logger import LoggerAPI
|
28
|
+
from .multipart_upload import MultipartUploadAPI
|
29
|
+
from .notifications import NotificationsAPI
|
30
|
+
from .preset_filters import PresetFiltersAPI
|
31
|
+
from .recent_activities import RecentActivitiesAPI
|
32
|
+
from .relay_server import RelayServerAPI
|
33
|
+
from .webhook_executions import WebhookExecutionsAPI
|
34
|
+
from .user_management import UserManagementAPI
|
35
|
+
|
36
|
+
__all__ = [
|
37
|
+
"AssetsAPI",
|
38
|
+
"CasesAPI",
|
39
|
+
"TasksAPI",
|
40
|
+
"AcquisitionsAPI",
|
41
|
+
"PoliciesAPI",
|
42
|
+
"OrganizationsAPI",
|
43
|
+
"TriageAPI",
|
44
|
+
"AuditAPI",
|
45
|
+
"BaselineAPI",
|
46
|
+
"AuthAPI",
|
47
|
+
"EvidenceAPI",
|
48
|
+
"AutoAssetTagsAPI",
|
49
|
+
"EventSubscriptionAPI",
|
50
|
+
"InteractAPI",
|
51
|
+
"ParamsAPI",
|
52
|
+
"SettingsAPI",
|
53
|
+
"WebhookAPI",
|
54
|
+
"APITokensAPI",
|
55
|
+
"InvestigationHubAPI",
|
56
|
+
"CloudForensicsAPI",
|
57
|
+
"BackupAPI",
|
58
|
+
"LicenseAPI",
|
59
|
+
"LoggerAPI",
|
60
|
+
"MultipartUploadAPI",
|
61
|
+
"NotificationsAPI",
|
62
|
+
"PresetFiltersAPI",
|
63
|
+
"RecentActivitiesAPI",
|
64
|
+
"RelayServerAPI",
|
65
|
+
"WebhookExecutionsAPI",
|
66
|
+
"UserManagementAPI",
|
67
|
+
]
|
@@ -0,0 +1,107 @@
|
|
1
|
+
"""
|
2
|
+
Acquisitions API for the Binalyze AIR SDK using CQRS pattern.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import List, Optional, Dict, Any
|
6
|
+
from ..http_client import HTTPClient
|
7
|
+
from ..models.acquisitions import (
|
8
|
+
AcquisitionProfile, AcquisitionProfileDetails, AcquisitionFilter,
|
9
|
+
AcquisitionTaskRequest, ImageAcquisitionTaskRequest, CreateAcquisitionProfileRequest
|
10
|
+
)
|
11
|
+
from ..queries.acquisitions import (
|
12
|
+
ListAcquisitionProfilesQuery,
|
13
|
+
GetAcquisitionProfileQuery,
|
14
|
+
)
|
15
|
+
from ..commands.acquisitions import (
|
16
|
+
CreateAcquisitionCommand,
|
17
|
+
CreateImageAcquisitionCommand,
|
18
|
+
CreateAcquisitionProfileCommand,
|
19
|
+
AssignAcquisitionTaskCommand,
|
20
|
+
AssignImageAcquisitionTaskCommand,
|
21
|
+
UpdateAcquisitionProfileCommand,
|
22
|
+
DeleteAcquisitionProfileCommand,
|
23
|
+
CreateOffNetworkAcquisitionCommand,
|
24
|
+
UpdateScheduledEvidenceAcquisitionCommand,
|
25
|
+
UpdateScheduledImageAcquisitionCommand,
|
26
|
+
ValidateOsqueryCommand,
|
27
|
+
)
|
28
|
+
|
29
|
+
|
30
|
+
class AcquisitionsAPI:
|
31
|
+
"""Acquisitions API with CQRS pattern - separated queries and commands."""
|
32
|
+
|
33
|
+
def __init__(self, http_client: HTTPClient):
|
34
|
+
self.http_client = http_client
|
35
|
+
|
36
|
+
# QUERIES (Read operations)
|
37
|
+
def list_profiles(
|
38
|
+
self,
|
39
|
+
filter_params: Optional[AcquisitionFilter] = None,
|
40
|
+
organization_ids: Optional[List[int]] = None,
|
41
|
+
all_organizations: bool = False
|
42
|
+
) -> List[AcquisitionProfile]:
|
43
|
+
"""List acquisition profiles with optional filtering."""
|
44
|
+
query = ListAcquisitionProfilesQuery(self.http_client, filter_params, organization_ids, all_organizations)
|
45
|
+
return query.execute()
|
46
|
+
|
47
|
+
def get_profile(self, profile_id: str) -> AcquisitionProfileDetails:
|
48
|
+
"""Get a specific acquisition profile by ID."""
|
49
|
+
query = GetAcquisitionProfileQuery(self.http_client, profile_id)
|
50
|
+
return query.execute()
|
51
|
+
|
52
|
+
# COMMANDS (Write operations)
|
53
|
+
def acquire(self, request) -> Dict[str, Any]:
|
54
|
+
"""Assign evidence acquisition task by filter."""
|
55
|
+
command = CreateAcquisitionCommand(self.http_client, request)
|
56
|
+
return command.execute()
|
57
|
+
|
58
|
+
def acquire_image(self, request) -> Dict[str, Any]:
|
59
|
+
"""Assign image acquisition task by filter."""
|
60
|
+
command = CreateImageAcquisitionCommand(self.http_client, request)
|
61
|
+
return command.execute()
|
62
|
+
|
63
|
+
def create_profile(self, request: CreateAcquisitionProfileRequest) -> Dict[str, Any]:
|
64
|
+
"""Create acquisition profile."""
|
65
|
+
command = CreateAcquisitionProfileCommand(self.http_client, request)
|
66
|
+
return command.execute()
|
67
|
+
|
68
|
+
def update_profile(self, profile_id: str, request: CreateAcquisitionProfileRequest) -> Dict[str, Any]:
|
69
|
+
"""Update acquisition profile by ID."""
|
70
|
+
command = UpdateAcquisitionProfileCommand(self.http_client, profile_id, request)
|
71
|
+
return command.execute()
|
72
|
+
|
73
|
+
def delete_profile(self, profile_id: str) -> Dict[str, Any]:
|
74
|
+
"""Delete acquisition profile by ID."""
|
75
|
+
command = DeleteAcquisitionProfileCommand(self.http_client, profile_id)
|
76
|
+
return command.execute()
|
77
|
+
|
78
|
+
def acquire_off_network(self, request) -> Dict[str, Any]:
|
79
|
+
"""Create evidence acquisition off-network task."""
|
80
|
+
command = CreateOffNetworkAcquisitionCommand(self.http_client, request)
|
81
|
+
return command.execute()
|
82
|
+
|
83
|
+
def update_scheduled_evidence_acquisition(self, task_id: str, request: Dict[str, Any]) -> Dict[str, Any]:
|
84
|
+
"""Update scheduled evidence acquisition."""
|
85
|
+
command = UpdateScheduledEvidenceAcquisitionCommand(self.http_client, task_id, request)
|
86
|
+
return command.execute()
|
87
|
+
|
88
|
+
def update_scheduled_image_acquisition(self, task_id: str, request: Dict[str, Any]) -> Dict[str, Any]:
|
89
|
+
"""Update scheduled image acquisition."""
|
90
|
+
command = UpdateScheduledImageAcquisitionCommand(self.http_client, task_id, request)
|
91
|
+
return command.execute()
|
92
|
+
|
93
|
+
def validate_osquery(self, request: List[Dict[str, Any]]) -> Dict[str, Any]:
|
94
|
+
"""Validate osquery."""
|
95
|
+
command = ValidateOsqueryCommand(self.http_client, request)
|
96
|
+
return command.execute()
|
97
|
+
|
98
|
+
# Legacy method aliases for backwards compatibility
|
99
|
+
def assign_task(self, request: AcquisitionTaskRequest) -> List[Dict[str, Any]]:
|
100
|
+
"""Legacy alias for acquire method."""
|
101
|
+
command = AssignAcquisitionTaskCommand(self.http_client, request)
|
102
|
+
return command.execute()
|
103
|
+
|
104
|
+
def assign_image_task(self, request: ImageAcquisitionTaskRequest) -> List[Dict[str, Any]]:
|
105
|
+
"""Legacy alias for acquire_image method."""
|
106
|
+
command = AssignImageAcquisitionTaskCommand(self.http_client, request)
|
107
|
+
return command.execute()
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"""
|
2
|
+
API Tokens API for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Optional, Dict, Any
|
6
|
+
|
7
|
+
from ..http_client import HTTPClient
|
8
|
+
from ..models.api_tokens import (
|
9
|
+
APIToken, APITokensPaginatedResponse, APITokenFilter,
|
10
|
+
CreateAPITokenRequest, UpdateAPITokenRequest
|
11
|
+
)
|
12
|
+
from ..queries.api_tokens import ListAPITokensQuery, GetAPITokenQuery
|
13
|
+
from ..commands.api_tokens import (
|
14
|
+
CreateAPITokenCommand, UpdateAPITokenCommand, DeleteAPITokenCommand
|
15
|
+
)
|
16
|
+
|
17
|
+
|
18
|
+
class APITokensAPI:
|
19
|
+
"""API Tokens API with CQRS pattern - separated queries and commands."""
|
20
|
+
|
21
|
+
def __init__(self, http_client: HTTPClient):
|
22
|
+
self.http_client = http_client
|
23
|
+
|
24
|
+
# QUERIES (Read operations)
|
25
|
+
def list(self, filter_params: Optional[APITokenFilter] = None) -> APITokensPaginatedResponse:
|
26
|
+
"""List API tokens with optional filtering."""
|
27
|
+
query = ListAPITokensQuery(self.http_client, filter_params)
|
28
|
+
return query.execute()
|
29
|
+
|
30
|
+
def get(self, token_id: str) -> APIToken:
|
31
|
+
"""Get a specific API token by ID."""
|
32
|
+
query = GetAPITokenQuery(self.http_client, token_id)
|
33
|
+
return query.execute()
|
34
|
+
|
35
|
+
# COMMANDS (Write operations)
|
36
|
+
def create(self, request: CreateAPITokenRequest) -> APIToken:
|
37
|
+
"""Create a new API token."""
|
38
|
+
command = CreateAPITokenCommand(self.http_client, request)
|
39
|
+
return command.execute()
|
40
|
+
|
41
|
+
def update(self, token_id: str, request: UpdateAPITokenRequest) -> APIToken:
|
42
|
+
"""Update an existing API token."""
|
43
|
+
command = UpdateAPITokenCommand(self.http_client, token_id, request)
|
44
|
+
return command.execute()
|
45
|
+
|
46
|
+
def delete(self, token_id: str) -> Dict[str, Any]:
|
47
|
+
"""Delete an API token."""
|
48
|
+
command = DeleteAPITokenCommand(self.http_client, token_id)
|
49
|
+
return command.execute()
|
@@ -0,0 +1,161 @@
|
|
1
|
+
"""
|
2
|
+
Assets API for the Binalyze AIR SDK using CQRS pattern.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import List, Optional, Dict, Any, Union
|
6
|
+
from ..http_client import HTTPClient
|
7
|
+
from ..models.assets import Asset, AssetDetail, AssetTask, AssetFilter, AssetTaskFilter
|
8
|
+
from ..queries.assets import (
|
9
|
+
ListAssetsQuery,
|
10
|
+
GetAssetQuery,
|
11
|
+
GetAssetTasksQuery,
|
12
|
+
GetAssetGroupsByOrganizationIdQuery,
|
13
|
+
GetAssetGroupsByParentIdQuery,
|
14
|
+
GetAssetTagsQuery,
|
15
|
+
GetProcessorsByAssetTypeIdQuery,
|
16
|
+
GetProcessorTypesByAssetTypeQuery,
|
17
|
+
)
|
18
|
+
from ..commands.assets import (
|
19
|
+
IsolateAssetsCommand,
|
20
|
+
UnisolateAssetsCommand,
|
21
|
+
RebootAssetsCommand,
|
22
|
+
ShutdownAssetsCommand,
|
23
|
+
AddTagsToAssetsCommand,
|
24
|
+
RemoveTagsFromAssetsCommand,
|
25
|
+
UninstallAssetsCommand,
|
26
|
+
LogRetrievalCommand,
|
27
|
+
VersionUpdateCommand,
|
28
|
+
DeleteAssetTagByIdCommand,
|
29
|
+
DeleteAssetTagsByOrganizationIdCommand,
|
30
|
+
)
|
31
|
+
|
32
|
+
|
33
|
+
class AssetsAPI:
|
34
|
+
"""Assets API with CQRS pattern - separated queries and commands."""
|
35
|
+
|
36
|
+
def __init__(self, http_client: HTTPClient):
|
37
|
+
self.http_client = http_client
|
38
|
+
|
39
|
+
# QUERIES (Read operations)
|
40
|
+
def list(self, filter_params: Optional[AssetFilter] = None) -> List[Asset]:
|
41
|
+
"""List assets with optional filtering."""
|
42
|
+
query = ListAssetsQuery(self.http_client, filter_params)
|
43
|
+
return query.execute()
|
44
|
+
|
45
|
+
def get(self, asset_id: str) -> AssetDetail:
|
46
|
+
"""Get a specific asset by ID."""
|
47
|
+
query = GetAssetQuery(self.http_client, asset_id)
|
48
|
+
return query.execute()
|
49
|
+
|
50
|
+
def get_tasks(self, asset_id: str, filter_params: Optional[AssetTaskFilter] = None) -> List[AssetTask]:
|
51
|
+
"""Get tasks for a specific asset with optional filtering."""
|
52
|
+
query = GetAssetTasksQuery(self.http_client, asset_id, filter_params)
|
53
|
+
return query.execute()
|
54
|
+
|
55
|
+
def get_asset_groups_by_organization_id(self, organization_id: int) -> List[Dict[str, Any]]:
|
56
|
+
"""Get root asset groups by organization ID."""
|
57
|
+
query = GetAssetGroupsByOrganizationIdQuery(self.http_client, organization_id)
|
58
|
+
return query.execute()
|
59
|
+
|
60
|
+
def get_asset_groups_by_parent_id(self, group_id: str) -> List[Dict[str, Any]]:
|
61
|
+
"""Get asset groups by parent ID."""
|
62
|
+
query = GetAssetGroupsByParentIdQuery(self.http_client, group_id)
|
63
|
+
return query.execute()
|
64
|
+
|
65
|
+
def get_asset_tags(self, organization_ids: List[int], page_number: int = 1,
|
66
|
+
page_size: int = 10, sort_by: str = "createdAt",
|
67
|
+
search_term: Optional[str] = None) -> Dict[str, Any]:
|
68
|
+
"""Get asset tags with filtering."""
|
69
|
+
query = GetAssetTagsQuery(self.http_client, organization_ids, page_number,
|
70
|
+
page_size, sort_by, search_term)
|
71
|
+
return query.execute()
|
72
|
+
|
73
|
+
def get_processors_by_asset_type_id(self, asset_type_id: int) -> List[Dict[str, Any]]:
|
74
|
+
"""Get processors by asset type ID."""
|
75
|
+
query = GetProcessorsByAssetTypeIdQuery(self.http_client, asset_type_id)
|
76
|
+
return query.execute()
|
77
|
+
|
78
|
+
def get_processor_types_by_asset_type(self, asset_type_id: int) -> Dict[str, Any]:
|
79
|
+
"""Get processor types by asset type ID."""
|
80
|
+
query = GetProcessorTypesByAssetTypeQuery(self.http_client, asset_type_id)
|
81
|
+
return query.execute()
|
82
|
+
|
83
|
+
# COMMANDS (Write operations)
|
84
|
+
def isolate(self, endpoint_ids: Union[str, List[str]], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
85
|
+
"""Isolate one or more assets."""
|
86
|
+
# Create AssetFilter from endpoint IDs for backward compatibility
|
87
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
88
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
89
|
+
command = IsolateAssetsCommand(self.http_client, asset_filter)
|
90
|
+
return command.execute()
|
91
|
+
|
92
|
+
def unisolate(self, endpoint_ids: Union[str, List[str]], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
93
|
+
"""Remove isolation from one or more assets."""
|
94
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
95
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
96
|
+
command = UnisolateAssetsCommand(self.http_client, asset_filter)
|
97
|
+
return command.execute()
|
98
|
+
|
99
|
+
def reboot(self, endpoint_ids: Union[str, List[str]], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
100
|
+
"""Reboot one or more assets."""
|
101
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
102
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
103
|
+
command = RebootAssetsCommand(self.http_client, asset_filter)
|
104
|
+
return command.execute()
|
105
|
+
|
106
|
+
def shutdown(self, endpoint_ids: Union[str, List[str]], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
107
|
+
"""Shutdown one or more assets."""
|
108
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
109
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
110
|
+
command = ShutdownAssetsCommand(self.http_client, asset_filter)
|
111
|
+
return command.execute()
|
112
|
+
|
113
|
+
def add_tags(self, endpoint_ids: List[str], tags: List[str], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
114
|
+
"""Add tags to assets."""
|
115
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
116
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
117
|
+
command = AddTagsToAssetsCommand(self.http_client, asset_filter, tags)
|
118
|
+
return command.execute()
|
119
|
+
|
120
|
+
def remove_tags(self, endpoint_ids: List[str], tags: List[str], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
121
|
+
"""Remove tags from assets."""
|
122
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
123
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
124
|
+
command = RemoveTagsFromAssetsCommand(self.http_client, asset_filter, tags)
|
125
|
+
return command.execute()
|
126
|
+
|
127
|
+
def delete_asset_tag_by_id(self, organization_id: int, tag_id: str) -> Dict[str, Any]:
|
128
|
+
"""Delete an asset tag by ID."""
|
129
|
+
command = DeleteAssetTagByIdCommand(self.http_client, organization_id, tag_id)
|
130
|
+
return command.execute()
|
131
|
+
|
132
|
+
def delete_asset_tags_by_organization_id(self, organization_id: int) -> Dict[str, Any]:
|
133
|
+
"""Delete asset tags by organization ID."""
|
134
|
+
command = DeleteAssetTagsByOrganizationIdCommand(self.http_client, organization_id)
|
135
|
+
return command.execute()
|
136
|
+
|
137
|
+
def uninstall(self, endpoint_ids: List[str], purge_data: bool = False, organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
138
|
+
"""Uninstall assets with optional data purging."""
|
139
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
140
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
141
|
+
if purge_data:
|
142
|
+
from ..commands.assets import PurgeAndUninstallAssetsCommand
|
143
|
+
command = PurgeAndUninstallAssetsCommand(self.http_client, asset_filter)
|
144
|
+
else:
|
145
|
+
from ..commands.assets import UninstallAssetsCommand
|
146
|
+
command = UninstallAssetsCommand(self.http_client, asset_filter)
|
147
|
+
return command.execute()
|
148
|
+
|
149
|
+
def retrieve_logs(self, endpoint_ids: List[str], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
150
|
+
"""Retrieve logs from assets."""
|
151
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
152
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
153
|
+
command = LogRetrievalCommand(self.http_client, asset_filter)
|
154
|
+
return command.execute()
|
155
|
+
|
156
|
+
def version_update(self, endpoint_ids: List[str], organization_ids: Optional[List[Union[int, str]]] = None) -> Dict[str, Any]:
|
157
|
+
"""Update version on assets."""
|
158
|
+
from ..commands.assets import create_asset_filter_from_endpoint_ids
|
159
|
+
asset_filter = create_asset_filter_from_endpoint_ids(endpoint_ids, organization_ids)
|
160
|
+
command = VersionUpdateCommand(self.http_client, asset_filter)
|
161
|
+
return command.execute()
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"""
|
2
|
+
Audit Logs API for the Binalyze AIR SDK using CQRS pattern.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import List, Optional, Dict, Any
|
6
|
+
from ..http_client import HTTPClient
|
7
|
+
from ..models.audit import AuditLog, AuditLogsFilter
|
8
|
+
from ..queries.audit import ListAuditLogsQuery, ExportAuditLogsQuery
|
9
|
+
|
10
|
+
|
11
|
+
class AuditAPI:
|
12
|
+
"""Audit logs API aligned with official API specification."""
|
13
|
+
|
14
|
+
def __init__(self, http_client: HTTPClient):
|
15
|
+
self.http_client = http_client
|
16
|
+
|
17
|
+
# QUERIES (Read operations)
|
18
|
+
def list_logs(self, filter_params: Optional[AuditLogsFilter] = None, organization_ids: Optional[int] = None) -> List[AuditLog]:
|
19
|
+
"""List audit logs with filtering - Official API endpoint."""
|
20
|
+
query = ListAuditLogsQuery(self.http_client, filter_params, organization_ids)
|
21
|
+
return query.execute()
|
22
|
+
|
23
|
+
def export_logs(self, filter_params: Optional[AuditLogsFilter] = None, format: str = "json", organization_ids: Optional[int] = None) -> Dict[str, Any]:
|
24
|
+
"""Export audit logs with filtering - Official API endpoint."""
|
25
|
+
query = ExportAuditLogsQuery(self.http_client, filter_params, format, organization_ids)
|
26
|
+
return query.execute()
|
@@ -1,27 +1,29 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
"""
|
4
|
-
|
5
|
-
from
|
6
|
-
|
7
|
-
from ..
|
8
|
-
from ..
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
"""
|
2
|
+
Auth API for the Binalyze AIR SDK.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Dict, Any, Union
|
6
|
+
|
7
|
+
from ..http_client import HTTPClient
|
8
|
+
from ..models.auth import AuthStatus, LoginRequest, LoginResponse
|
9
|
+
from ..queries.auth import CheckAuthStatusQuery
|
10
|
+
from ..commands.auth import LoginCommand
|
11
|
+
|
12
|
+
|
13
|
+
class AuthAPI:
|
14
|
+
"""Auth API with CQRS pattern - separated queries and commands."""
|
15
|
+
|
16
|
+
def __init__(self, http_client: HTTPClient):
|
17
|
+
self.http_client = http_client
|
18
|
+
|
19
|
+
# QUERIES (Read operations)
|
20
|
+
def check_status(self) -> AuthStatus:
|
21
|
+
"""Check current authentication status."""
|
22
|
+
query = CheckAuthStatusQuery(self.http_client)
|
23
|
+
return query.execute()
|
24
|
+
|
25
|
+
# COMMANDS (Write operations)
|
26
|
+
def login(self, request: Union[LoginRequest, Dict[str, Any]]) -> LoginResponse:
|
27
|
+
"""Login user with credentials."""
|
28
|
+
command = LoginCommand(self.http_client, request)
|
29
|
+
return command.execute()
|