diff --git a/.sdk-version b/.sdk-version index 37c93be..c2d2cb0 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.4.0 +v4.5.0 diff --git a/README.md b/README.md index 498b344..5332d50 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,11 @@ Class | Method | HTTP request | Description *AgentApi* | [**get_report_analysis_result_v2_analyses_analysis_id_agent_report_analysis_get**](docs/AgentApi.md#get_report_analysis_result_v2_analyses_analysis_id_agent_report_analysis_get) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result *AgentApi* | [**get_triage_result_v2_analyses_analysis_id_agent_triage_get**](docs/AgentApi.md#get_triage_result_v2_analyses_analysis_id_agent_triage_get) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result *AgentApi* | [**v3_cancel_rename_unnamed_functions**](docs/AgentApi.md#v3_cancel_rename_unnamed_functions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. +*AgentApi* | [**v3_cancel_security_scan_operation**](docs/AgentApi.md#v3_cancel_security_scan_operation) | **POST** /v3/operations/security-scan/{analysis_id}:cancel | Cancel a security-scan operation. *AgentApi* | [**v3_get_rename_unnamed_functions_result**](docs/AgentApi.md#v3_get_rename_unnamed_functions_result) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. *AgentApi* | [**v3_get_rename_unnamed_functions_status**](docs/AgentApi.md#v3_get_rename_unnamed_functions_status) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. +*AgentApi* | [**v3_get_security_scan_operation**](docs/AgentApi.md#v3_get_security_scan_operation) | **GET** /v3/operations/security-scan/{analysis_id} | Get a security-scan operation. +*AgentApi* | [**v3_run_security_scan**](docs/AgentApi.md#v3_run_security_scan) | **POST** /v3/analyses/{analysis_id}/security-scan:run | Run the security-scan agent. *AgentApi* | [**v3_trigger_rename_unnamed_functions**](docs/AgentApi.md#v3_trigger_rename_unnamed_functions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. *AnalysesBulkActionsApi* | [**bulk_add_analysis_tags**](docs/AnalysesBulkActionsApi.md#bulk_add_analysis_tags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags *AnalysesBulkActionsApi* | [**bulk_delete_analyses**](docs/AnalysesBulkActionsApi.md#bulk_delete_analyses) | **PATCH** /v2/analyses/delete | Bulk Delete Analyses @@ -457,6 +460,7 @@ Class | Method | HTTP request | Description - [EventCONTEXTCOMPACTED](docs/EventCONTEXTCOMPACTED.md) - [EventDecompFailed](docs/EventDecompFailed.md) - [EventDecompFinished](docs/EventDecompFinished.md) + - [EventNamesFinished](docs/EventNamesFinished.md) - [EventProse](docs/EventProse.md) - [EventRUNCANCELLED](docs/EventRUNCANCELLED.md) - [EventRUNERROR](docs/EventRUNERROR.md) @@ -481,6 +485,7 @@ Class | Method | HTTP request | Description - [Example](docs/Example.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) + - [ExtractedBinary](docs/ExtractedBinary.md) - [ExtractedURL](docs/ExtractedURL.md) - [FileActivityEntry](docs/FileActivityEntry.md) - [FileFormat](docs/FileFormat.md) @@ -544,6 +549,7 @@ Class | Method | HTTP request | Description - [IndirectCallSite](docs/IndirectCallSite.md) - [IndirectCallSitesOutputBody](docs/IndirectCallSitesOutputBody.md) - [InlineComment](docs/InlineComment.md) + - [InputBody](docs/InputBody.md) - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InviteUserInputBody](docs/InviteUserInputBody.md) - [IssuerAllowedDomain](docs/IssuerAllowedDomain.md) @@ -576,8 +582,11 @@ Class | Method | HTTP request | Description - [MutexEntry](docs/MutexEntry.md) - [NameConfidence](docs/NameConfidence.md) - [NameSourceType](docs/NameSourceType.md) + - [NamesFinishedEvent](docs/NamesFinishedEvent.md) - [NetworkActivity](docs/NetworkActivity.md) - [OIDCCallbackInputBody](docs/OIDCCallbackInputBody.md) + - [OperationSecurityScanMetadataSecurityScanResult](docs/OperationSecurityScanMetadataSecurityScanResult.md) + - [OperationWorkflowProgressResultBody](docs/OperationWorkflowProgressResultBody.md) - [Order](docs/Order.md) - [Organisation](docs/Organisation.md) - [OrganisationGroup](docs/OrganisationGroup.md) @@ -631,6 +640,7 @@ Class | Method | HTTP request | Description - [ReportInfo](docs/ReportInfo.md) - [ReportOptions](docs/ReportOptions.md) - [ResolvedEntity](docs/ResolvedEntity.md) + - [ResultBody](docs/ResultBody.md) - [RevokeBody](docs/RevokeBody.md) - [SSOProvider](docs/SSOProvider.md) - [SSOProvidersOutputBody](docs/SSOProvidersOutputBody.md) @@ -641,6 +651,8 @@ Class | Method | HTTP request | Description - [ScrapeThirdPartyConfig](docs/ScrapeThirdPartyConfig.md) - [SectionModel](docs/SectionModel.md) - [SecurityModel](docs/SecurityModel.md) + - [SecurityScanMetadata](docs/SecurityScanMetadata.md) + - [SecurityScanResult](docs/SecurityScanResult.md) - [SegmentInfo](docs/SegmentInfo.md) - [SendMessageRequest](docs/SendMessageRequest.md) - [ServiceEntry](docs/ServiceEntry.md) @@ -677,6 +689,7 @@ Class | Method | HTTP request | Description - [StartMatchingForFunctionsInputBody](docs/StartMatchingForFunctionsInputBody.md) - [StartMatchingOutputBody](docs/StartMatchingOutputBody.md) - [StartupInfo](docs/StartupInfo.md) + - [Status](docs/Status.md) - [StatusBody](docs/StatusBody.md) - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) @@ -710,6 +723,7 @@ Class | Method | HTTP request | Description - [TriageReportResponse](docs/TriageReportResponse.md) - [TriggerDynamicExecutionInputBody](docs/TriggerDynamicExecutionInputBody.md) - [TriggerRenameUnnamedFunctionsInputBody](docs/TriggerRenameUnnamedFunctionsInputBody.md) + - [TriggerSecurityScanInputBody](docs/TriggerSecurityScanInputBody.md) - [Ttp](docs/Ttp.md) - [TypedefDataType](docs/TypedefDataType.md) - [TypedefDefinition](docs/TypedefDefinition.md) diff --git a/docs/AgentApi.md b/docs/AgentApi.md index b87f602..eeaac38 100644 --- a/docs/AgentApi.md +++ b/docs/AgentApi.md @@ -17,8 +17,11 @@ Method | HTTP request | Description [**get_report_analysis_result_v2_analyses_analysis_id_agent_report_analysis_get**](AgentApi.md#get_report_analysis_result_v2_analyses_analysis_id_agent_report_analysis_get) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result [**get_triage_result_v2_analyses_analysis_id_agent_triage_get**](AgentApi.md#get_triage_result_v2_analyses_analysis_id_agent_triage_get) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result [**v3_cancel_rename_unnamed_functions**](AgentApi.md#v3_cancel_rename_unnamed_functions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. +[**v3_cancel_security_scan_operation**](AgentApi.md#v3_cancel_security_scan_operation) | **POST** /v3/operations/security-scan/{analysis_id}:cancel | Cancel a security-scan operation. [**v3_get_rename_unnamed_functions_result**](AgentApi.md#v3_get_rename_unnamed_functions_result) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. [**v3_get_rename_unnamed_functions_status**](AgentApi.md#v3_get_rename_unnamed_functions_status) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. +[**v3_get_security_scan_operation**](AgentApi.md#v3_get_security_scan_operation) | **GET** /v3/operations/security-scan/{analysis_id} | Get a security-scan operation. +[**v3_run_security_scan**](AgentApi.md#v3_run_security_scan) | **POST** /v3/analyses/{analysis_id}/security-scan:run | Run the security-scan agent. [**v3_trigger_rename_unnamed_functions**](AgentApi.md#v3_trigger_rename_unnamed_functions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. @@ -1103,6 +1106,97 @@ with revengai.ApiClient(configuration) as api_client: +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + +### Return type + +void (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **v3_cancel_security_scan_operation** +> v3_cancel_security_scan_operation(analysis_id) + +Cancel a security-scan operation. + +Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +- `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.reveng.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = revengai.Configuration( + host = "https://api.reveng.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: APIKey +configuration.api_key['APIKey'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['APIKey'] = 'Bearer' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.AgentApi(api_client) + analysis_id = 56 # int | Analysis ID + + try: + # Cancel a security-scan operation. + api_instance.v3_cancel_security_scan_operation(analysis_id) + except Exception as e: + print("Exception when calling AgentApi->v3_cancel_security_scan_operation: %s\n" % e) +``` + + + ### Parameters @@ -1323,6 +1417,197 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **v3_get_security_scan_operation** +> OperationSecurityScanMetadataSecurityScanResult v3_get_security_scan_operation(analysis_id) + +Get a security-scan operation. + +Returns the current state of the security-scan run for this analysis. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult +from revengai.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.reveng.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = revengai.Configuration( + host = "https://api.reveng.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: APIKey +configuration.api_key['APIKey'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['APIKey'] = 'Bearer' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.AgentApi(api_client) + analysis_id = 56 # int | Analysis ID + + try: + # Get a security-scan operation. + api_response = api_instance.v3_get_security_scan_operation(analysis_id) + print("The response of AgentApi->v3_get_security_scan_operation:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AgentApi->v3_get_security_scan_operation: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + +### Return type + +[**OperationSecurityScanMetadataSecurityScanResult**](OperationSecurityScanMetadataSecurityScanResult.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **v3_run_security_scan** +> OperationSecurityScanMetadataSecurityScanResult v3_run_security_scan(analysis_id, trigger_security_scan_input_body) + +Run the security-scan agent. + +Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +- `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult +from revengai.models.trigger_security_scan_input_body import TriggerSecurityScanInputBody +from revengai.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.reveng.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = revengai.Configuration( + host = "https://api.reveng.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: APIKey +configuration.api_key['APIKey'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['APIKey'] = 'Bearer' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.AgentApi(api_client) + analysis_id = 56 # int | Analysis ID + trigger_security_scan_input_body = revengai.TriggerSecurityScanInputBody() # TriggerSecurityScanInputBody | + + try: + # Run the security-scan agent. + api_response = api_instance.v3_run_security_scan(analysis_id, trigger_security_scan_input_body) + print("The response of AgentApi->v3_run_security_scan:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AgentApi->v3_run_security_scan: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + **trigger_security_scan_input_body** | [**TriggerSecurityScanInputBody**](TriggerSecurityScanInputBody.md)| | + +### Return type + +[**OperationSecurityScanMetadataSecurityScanResult**](OperationSecurityScanMetadataSecurityScanResult.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**409** | Conflict | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **v3_trigger_rename_unnamed_functions** > StatusBody v3_trigger_rename_unnamed_functions(analysis_id, trigger_rename_unnamed_functions_input_body) diff --git a/docs/EventNamesFinished.md b/docs/EventNamesFinished.md new file mode 100644 index 0000000..239f7b6 --- /dev/null +++ b/docs/EventNamesFinished.md @@ -0,0 +1,32 @@ +# EventNamesFinished + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**NamesFinishedEvent**](NamesFinishedEvent.md) | | +**event** | **str** | The event name. | +**id** | **int** | The event ID. | [optional] +**retry** | **int** | The retry time in milliseconds. | [optional] + +## Example + +```python +from revengai.models.event_names_finished import EventNamesFinished + +# TODO update the JSON string below +json = "{}" +# create an instance of EventNamesFinished from a JSON string +event_names_finished_instance = EventNamesFinished.from_json(json) +# print the JSON string representation of the object +print(EventNamesFinished.to_json()) + +# convert the object into a dict +event_names_finished_dict = event_names_finished_instance.to_dict() +# create an instance of EventNamesFinished from a dict +event_names_finished_from_dict = EventNamesFinished.from_dict(event_names_finished_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ExtractedBinary.md b/docs/ExtractedBinary.md new file mode 100644 index 0000000..8603cd5 --- /dev/null +++ b/docs/ExtractedBinary.md @@ -0,0 +1,31 @@ +# ExtractedBinary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**filename** | **str** | Original filename inside the upload | +**sha_256_hash** | **str** | Content hash of the recovered binary | +**size** | **int** | File size (in bytes) | + +## Example + +```python +from revengai.models.extracted_binary import ExtractedBinary + +# TODO update the JSON string below +json = "{}" +# create an instance of ExtractedBinary from a JSON string +extracted_binary_instance = ExtractedBinary.from_json(json) +# print the JSON string representation of the object +print(ExtractedBinary.to_json()) + +# convert the object into a dict +extracted_binary_dict = extracted_binary_instance.to_dict() +# create an instance of ExtractedBinary from a dict +extracted_binary_from_dict = ExtractedBinary.from_dict(extracted_binary_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/InputBody.md b/docs/InputBody.md new file mode 100644 index 0000000..e5d6741 --- /dev/null +++ b/docs/InputBody.md @@ -0,0 +1,29 @@ +# InputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**password** | **str** | Password to decrypt an encrypted archive. | [optional] + +## Example + +```python +from revengai.models.input_body import InputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of InputBody from a JSON string +input_body_instance = InputBody.from_json(json) +# print the JSON string representation of the object +print(InputBody.to_json()) + +# convert the object into a dict +input_body_dict = input_body_instance.to_dict() +# create an instance of InputBody from a dict +input_body_from_dict = InputBody.from_dict(input_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NamesFinishedEvent.md b/docs/NamesFinishedEvent.md new file mode 100644 index 0000000..ff52b0e --- /dev/null +++ b/docs/NamesFinishedEvent.md @@ -0,0 +1,32 @@ +# NamesFinishedEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**applied** | **int** | | +**attempt** | **int** | | +**seq** | **int** | | +**type** | **str** | | + +## Example + +```python +from revengai.models.names_finished_event import NamesFinishedEvent + +# TODO update the JSON string below +json = "{}" +# create an instance of NamesFinishedEvent from a JSON string +names_finished_event_instance = NamesFinishedEvent.from_json(json) +# print the JSON string representation of the object +print(NamesFinishedEvent.to_json()) + +# convert the object into a dict +names_finished_event_dict = names_finished_event_instance.to_dict() +# create an instance of NamesFinishedEvent from a dict +names_finished_event_from_dict = NamesFinishedEvent.from_dict(names_finished_event_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OperationSecurityScanMetadataSecurityScanResult.md b/docs/OperationSecurityScanMetadataSecurityScanResult.md new file mode 100644 index 0000000..4dba294 --- /dev/null +++ b/docs/OperationSecurityScanMetadataSecurityScanResult.md @@ -0,0 +1,33 @@ +# OperationSecurityScanMetadataSecurityScanResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**done** | **bool** | Whether the operation has reached a terminal state. | +**error** | [**Status**](Status.md) | Failure detail, populated only when done is true and the operation failed. | [optional] +**metadata** | [**SecurityScanMetadata**](SecurityScanMetadata.md) | In-flight information and details. | [optional] +**name** | **str** | API resource name. | +**response** | [**SecurityScanResult**](SecurityScanResult.md) | Result, set only when done is true and the operation succeeded. | [optional] + +## Example + +```python +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult + +# TODO update the JSON string below +json = "{}" +# create an instance of OperationSecurityScanMetadataSecurityScanResult from a JSON string +operation_security_scan_metadata_security_scan_result_instance = OperationSecurityScanMetadataSecurityScanResult.from_json(json) +# print the JSON string representation of the object +print(OperationSecurityScanMetadataSecurityScanResult.to_json()) + +# convert the object into a dict +operation_security_scan_metadata_security_scan_result_dict = operation_security_scan_metadata_security_scan_result_instance.to_dict() +# create an instance of OperationSecurityScanMetadataSecurityScanResult from a dict +operation_security_scan_metadata_security_scan_result_from_dict = OperationSecurityScanMetadataSecurityScanResult.from_dict(operation_security_scan_metadata_security_scan_result_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OperationWorkflowProgressResultBody.md b/docs/OperationWorkflowProgressResultBody.md new file mode 100644 index 0000000..383c8a9 --- /dev/null +++ b/docs/OperationWorkflowProgressResultBody.md @@ -0,0 +1,33 @@ +# OperationWorkflowProgressResultBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**done** | **bool** | Whether the operation has reached a terminal state. | +**error** | [**Status**](Status.md) | Failure detail, populated only when done is true and the operation failed. | [optional] +**metadata** | [**WorkflowProgress**](WorkflowProgress.md) | In-flight information and details. | [optional] +**name** | **str** | API resource name. | +**response** | [**ResultBody**](ResultBody.md) | Result, set only when done is true and the operation succeeded. | [optional] + +## Example + +```python +from revengai.models.operation_workflow_progress_result_body import OperationWorkflowProgressResultBody + +# TODO update the JSON string below +json = "{}" +# create an instance of OperationWorkflowProgressResultBody from a JSON string +operation_workflow_progress_result_body_instance = OperationWorkflowProgressResultBody.from_json(json) +# print the JSON string representation of the object +print(OperationWorkflowProgressResultBody.to_json()) + +# convert the object into a dict +operation_workflow_progress_result_body_dict = operation_workflow_progress_result_body_instance.to_dict() +# create an instance of OperationWorkflowProgressResultBody from a dict +operation_workflow_progress_result_body_from_dict = OperationWorkflowProgressResultBody.from_dict(operation_workflow_progress_result_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RenameInputBody.md b/docs/RenameInputBody.md index c8005d6..2b18113 100644 --- a/docs/RenameInputBody.md +++ b/docs/RenameInputBody.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **new_mangled_name** | **str** | New mangled function name | [optional] **new_name** | **str** | New function name | -**preserve_ai_decompilation** | **bool** | Keep the cached AI decompilation, summary and inline comments. Set when the new name comes from the model's own prediction (e.g. Transfer Name) so existing AI output is not discarded and regenerated. | [optional] ## Example diff --git a/docs/ResultBody.md b/docs/ResultBody.md new file mode 100644 index 0000000..d8ca502 --- /dev/null +++ b/docs/ResultBody.md @@ -0,0 +1,32 @@ +# ResultBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | [**List[ExtractedBinary]**](ExtractedBinary.md) | Child binaries recovered from the extraction. | +**extraction_depth** | **int** | Number of nested-archive extraction passes taken. | +**filename_to_extraction_failure** | **Dict[str, str]** | Per-file extraction failures, keyed by filename. | +**skipped_files** | **int** | Files skipped because they were not recognised as binaries. | + +## Example + +```python +from revengai.models.result_body import ResultBody + +# TODO update the JSON string below +json = "{}" +# create an instance of ResultBody from a JSON string +result_body_instance = ResultBody.from_json(json) +# print the JSON string representation of the object +print(ResultBody.to_json()) + +# convert the object into a dict +result_body_dict = result_body_instance.to_dict() +# create an instance of ResultBody from a dict +result_body_from_dict = ResultBody.from_dict(result_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SecurityScanMetadata.md b/docs/SecurityScanMetadata.md new file mode 100644 index 0000000..3596ffb --- /dev/null +++ b/docs/SecurityScanMetadata.md @@ -0,0 +1,30 @@ +# SecurityScanMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**log_history** | **List[List[object]]** | Progress messages the run recorded, oldest first. | [optional] +**status** | **str** | Run status. UNINITIALISED means the agent has never been triggered for this analysis. | + +## Example + +```python +from revengai.models.security_scan_metadata import SecurityScanMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of SecurityScanMetadata from a JSON string +security_scan_metadata_instance = SecurityScanMetadata.from_json(json) +# print the JSON string representation of the object +print(SecurityScanMetadata.to_json()) + +# convert the object into a dict +security_scan_metadata_dict = security_scan_metadata_instance.to_dict() +# create an instance of SecurityScanMetadata from a dict +security_scan_metadata_from_dict = SecurityScanMetadata.from_dict(security_scan_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SecurityScanResult.md b/docs/SecurityScanResult.md new file mode 100644 index 0000000..77149fc --- /dev/null +++ b/docs/SecurityScanResult.md @@ -0,0 +1,35 @@ +# SecurityScanResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**analysis_id** | **int** | Analysis the run was performed against | +**cancelled** | **bool** | Whether the run was cancelled before it covered every function | +**decompiled** | **int** | Functions successfully decompiled and scanned | +**failed** | **int** | Functions whose decompilation or scan attempt errored | +**security_scan** | **Dict[str, object]** | Raw semgrep findings, keyed by the scanner's own result shape | [optional] +**source** | **str** | Decompiler that produced the source scanned | +**total** | **int** | Functions the run considered | + +## Example + +```python +from revengai.models.security_scan_result import SecurityScanResult + +# TODO update the JSON string below +json = "{}" +# create an instance of SecurityScanResult from a JSON string +security_scan_result_instance = SecurityScanResult.from_json(json) +# print the JSON string representation of the object +print(SecurityScanResult.to_json()) + +# convert the object into a dict +security_scan_result_dict = security_scan_result_instance.to_dict() +# create an instance of SecurityScanResult from a dict +security_scan_result_from_dict = SecurityScanResult.from_dict(security_scan_result_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Status.md b/docs/Status.md new file mode 100644 index 0000000..240426c --- /dev/null +++ b/docs/Status.md @@ -0,0 +1,32 @@ +# Status + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Machine-readable error code, shared with synchronous API errors. | +**detail** | **str** | Additional context where helpful (quota numbers, validation specifics, etc.). | [optional] +**doc_url** | **str** | Link to documentation explaining this error and resolution steps. | +**message** | **str** | Brief description of the failure. | + +## Example + +```python +from revengai.models.status import Status + +# TODO update the JSON string below +json = "{}" +# create an instance of Status from a JSON string +status_instance = Status.from_json(json) +# print the JSON string representation of the object +print(Status.to_json()) + +# convert the object into a dict +status_dict = status_instance.to_dict() +# create an instance of Status from a dict +status_from_dict = Status.from_dict(status_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TriggerSecurityScanInputBody.md b/docs/TriggerSecurityScanInputBody.md new file mode 100644 index 0000000..08a596c --- /dev/null +++ b/docs/TriggerSecurityScanInputBody.md @@ -0,0 +1,29 @@ +# TriggerSecurityScanInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**max_functions_to_scan** | **int** | Stop after decompiling and scanning this many functions. Omit to process every function in the analysis. | [optional] + +## Example + +```python +from revengai.models.trigger_security_scan_input_body import TriggerSecurityScanInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of TriggerSecurityScanInputBody from a JSON string +trigger_security_scan_input_body_instance = TriggerSecurityScanInputBody.from_json(json) +# print the JSON string representation of the object +print(TriggerSecurityScanInputBody.to_json()) + +# convert the object into a dict +trigger_security_scan_input_body_dict = trigger_security_scan_input_body_instance.to_dict() +# create an instance of TriggerSecurityScanInputBody from a dict +trigger_security_scan_input_body_from_dict = TriggerSecurityScanInputBody.from_dict(trigger_security_scan_input_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/revengai/__init__.py b/revengai/__init__.py index 1ec9c72..1f06742 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v4.4.0" +__version__ = "v4.5.0" # Define package exports __all__ = [ @@ -291,6 +291,7 @@ "EventCONTEXTCOMPACTED", "EventDecompFailed", "EventDecompFinished", + "EventNamesFinished", "EventProse", "EventRUNCANCELLED", "EventRUNERROR", @@ -315,6 +316,7 @@ "Example", "ExportModel", "ExternalResponse", + "ExtractedBinary", "ExtractedURL", "FileActivityEntry", "FileFormat", @@ -378,6 +380,7 @@ "IndirectCallSite", "IndirectCallSitesOutputBody", "InlineComment", + "InputBody", "InsertAnalysisLogRequest", "InviteUserInputBody", "IssuerAllowedDomain", @@ -410,8 +413,11 @@ "MutexEntry", "NameConfidence", "NameSourceType", + "NamesFinishedEvent", "NetworkActivity", "OIDCCallbackInputBody", + "OperationSecurityScanMetadataSecurityScanResult", + "OperationWorkflowProgressResultBody", "Order", "Organisation", "OrganisationGroup", @@ -465,6 +471,7 @@ "ReportInfo", "ReportOptions", "ResolvedEntity", + "ResultBody", "RevokeBody", "SSOProvider", "SSOProvidersOutputBody", @@ -475,6 +482,8 @@ "ScrapeThirdPartyConfig", "SectionModel", "SecurityModel", + "SecurityScanMetadata", + "SecurityScanResult", "SegmentInfo", "SendMessageRequest", "ServiceEntry", @@ -511,6 +520,7 @@ "StartMatchingForFunctionsInputBody", "StartMatchingOutputBody", "StartupInfo", + "Status", "StatusBody", "StatusInput", "StatusOutput", @@ -544,6 +554,7 @@ "TriageReportResponse", "TriggerDynamicExecutionInputBody", "TriggerRenameUnnamedFunctionsInputBody", + "TriggerSecurityScanInputBody", "Ttp", "TypedefDataType", "TypedefDefinition", @@ -868,6 +879,7 @@ from revengai.models.event_contextcompacted import EventCONTEXTCOMPACTED as EventCONTEXTCOMPACTED from revengai.models.event_decomp_failed import EventDecompFailed as EventDecompFailed from revengai.models.event_decomp_finished import EventDecompFinished as EventDecompFinished +from revengai.models.event_names_finished import EventNamesFinished as EventNamesFinished from revengai.models.event_prose import EventProse as EventProse from revengai.models.event_runcancelled import EventRUNCANCELLED as EventRUNCANCELLED from revengai.models.event_runerror import EventRUNERROR as EventRUNERROR @@ -892,6 +904,7 @@ from revengai.models.example import Example as Example from revengai.models.export_model import ExportModel as ExportModel from revengai.models.external_response import ExternalResponse as ExternalResponse +from revengai.models.extracted_binary import ExtractedBinary as ExtractedBinary from revengai.models.extracted_url import ExtractedURL as ExtractedURL from revengai.models.file_activity_entry import FileActivityEntry as FileActivityEntry from revengai.models.file_format import FileFormat as FileFormat @@ -955,6 +968,7 @@ from revengai.models.indirect_call_site import IndirectCallSite as IndirectCallSite from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody as IndirectCallSitesOutputBody from revengai.models.inline_comment import InlineComment as InlineComment +from revengai.models.input_body import InputBody as InputBody from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest as InsertAnalysisLogRequest from revengai.models.invite_user_input_body import InviteUserInputBody as InviteUserInputBody from revengai.models.issuer_allowed_domain import IssuerAllowedDomain as IssuerAllowedDomain @@ -987,8 +1001,11 @@ from revengai.models.mutex_entry import MutexEntry as MutexEntry from revengai.models.name_confidence import NameConfidence as NameConfidence from revengai.models.name_source_type import NameSourceType as NameSourceType +from revengai.models.names_finished_event import NamesFinishedEvent as NamesFinishedEvent from revengai.models.network_activity import NetworkActivity as NetworkActivity from revengai.models.oidc_callback_input_body import OIDCCallbackInputBody as OIDCCallbackInputBody +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult as OperationSecurityScanMetadataSecurityScanResult +from revengai.models.operation_workflow_progress_result_body import OperationWorkflowProgressResultBody as OperationWorkflowProgressResultBody from revengai.models.order import Order as Order from revengai.models.organisation import Organisation as Organisation from revengai.models.organisation_group import OrganisationGroup as OrganisationGroup @@ -1042,6 +1059,7 @@ from revengai.models.report_info import ReportInfo as ReportInfo from revengai.models.report_options import ReportOptions as ReportOptions from revengai.models.resolved_entity import ResolvedEntity as ResolvedEntity +from revengai.models.result_body import ResultBody as ResultBody from revengai.models.revoke_body import RevokeBody as RevokeBody from revengai.models.sso_provider import SSOProvider as SSOProvider from revengai.models.sso_providers_output_body import SSOProvidersOutputBody as SSOProvidersOutputBody @@ -1052,6 +1070,8 @@ from revengai.models.scrape_third_party_config import ScrapeThirdPartyConfig as ScrapeThirdPartyConfig from revengai.models.section_model import SectionModel as SectionModel from revengai.models.security_model import SecurityModel as SecurityModel +from revengai.models.security_scan_metadata import SecurityScanMetadata as SecurityScanMetadata +from revengai.models.security_scan_result import SecurityScanResult as SecurityScanResult from revengai.models.segment_info import SegmentInfo as SegmentInfo from revengai.models.send_message_request import SendMessageRequest as SendMessageRequest from revengai.models.service_entry import ServiceEntry as ServiceEntry @@ -1088,6 +1108,7 @@ from revengai.models.start_matching_for_functions_input_body import StartMatchingForFunctionsInputBody as StartMatchingForFunctionsInputBody from revengai.models.start_matching_output_body import StartMatchingOutputBody as StartMatchingOutputBody from revengai.models.startup_info import StartupInfo as StartupInfo +from revengai.models.status import Status as Status from revengai.models.status_body import StatusBody as StatusBody from revengai.models.status_input import StatusInput as StatusInput from revengai.models.status_output import StatusOutput as StatusOutput @@ -1121,6 +1142,7 @@ from revengai.models.triage_report_response import TriageReportResponse as TriageReportResponse from revengai.models.trigger_dynamic_execution_input_body import TriggerDynamicExecutionInputBody as TriggerDynamicExecutionInputBody from revengai.models.trigger_rename_unnamed_functions_input_body import TriggerRenameUnnamedFunctionsInputBody as TriggerRenameUnnamedFunctionsInputBody +from revengai.models.trigger_security_scan_input_body import TriggerSecurityScanInputBody as TriggerSecurityScanInputBody from revengai.models.ttp import Ttp as Ttp from revengai.models.typedef_data_type import TypedefDataType as TypedefDataType from revengai.models.typedef_definition import TypedefDefinition as TypedefDefinition diff --git a/revengai/api/agent_api.py b/revengai/api/agent_api.py index 7dc1002..37fac09 100644 --- a/revengai/api/agent_api.py +++ b/revengai/api/agent_api.py @@ -22,11 +22,13 @@ from revengai.models.base_response_remediation_agent_response import BaseResponseRemediationAgentResponse from revengai.models.base_response_report_analysis_response import BaseResponseReportAnalysisResponse from revengai.models.base_response_triage_report_response import BaseResponseTriageReportResponse +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult from revengai.models.queued_workflow_task_response import QueuedWorkflowTaskResponse from revengai.models.rename_unnamed_functions_result import RenameUnnamedFunctionsResult from revengai.models.status_body import StatusBody from revengai.models.task_status_response import TaskStatusResponse from revengai.models.trigger_rename_unnamed_functions_input_body import TriggerRenameUnnamedFunctionsInputBody +from revengai.models.trigger_security_scan_input_body import TriggerSecurityScanInputBody from revengai.api_client import ApiClient, RequestSerialized from revengai.api_response import ApiResponse @@ -3473,6 +3475,280 @@ def _v3_cancel_rename_unnamed_functions_serialize( + @validate_call + def v3_cancel_security_scan_operation( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Cancel a security-scan operation. + + Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_cancel_security_scan_operation_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def v3_cancel_security_scan_operation_with_http_info( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Cancel a security-scan operation. + + Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_cancel_security_scan_operation_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def v3_cancel_security_scan_operation_without_preload_content( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Cancel a security-scan operation. + + Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_cancel_security_scan_operation_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_cancel_security_scan_operation_serialize( + self, + analysis_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/operations/security-scan/{analysis_id}:cancel', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def v3_get_rename_unnamed_functions_result( self, @@ -3489,10 +3765,429 @@ def v3_get_rename_unnamed_functions_result( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RenameUnnamedFunctionsResult: - """Get rename-unnamed-functions agent result. + ) -> RenameUnnamedFunctionsResult: + """Get rename-unnamed-functions agent result. + + Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_rename_unnamed_functions_result_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RenameUnnamedFunctionsResult", + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def v3_get_rename_unnamed_functions_result_with_http_info( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RenameUnnamedFunctionsResult]: + """Get rename-unnamed-functions agent result. + + Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_rename_unnamed_functions_result_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RenameUnnamedFunctionsResult", + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def v3_get_rename_unnamed_functions_result_without_preload_content( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get rename-unnamed-functions agent result. + + Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_rename_unnamed_functions_result_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RenameUnnamedFunctionsResult", + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_get_rename_unnamed_functions_result_serialize( + self, + analysis_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/analyses/{analysis_id}/agents/rename-unnamed-functions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def v3_get_rename_unnamed_functions_status( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StatusBody: + """Get rename-unnamed-functions agent status. + + Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_rename_unnamed_functions_status_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StatusBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def v3_get_rename_unnamed_functions_status_with_http_info( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StatusBody]: + """Get rename-unnamed-functions agent status. + + Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_rename_unnamed_functions_status_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StatusBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def v3_get_rename_unnamed_functions_status_without_preload_content( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get rename-unnamed-functions agent status. - Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied :param analysis_id: Analysis ID (required) :type analysis_id: int @@ -3518,7 +4213,7 @@ def v3_get_rename_unnamed_functions_result( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_result_serialize( + _param = self._v3_get_rename_unnamed_functions_status_serialize( analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, @@ -3527,10 +4222,141 @@ def v3_get_rename_unnamed_functions_result( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RenameUnnamedFunctionsResult", + '200': "StatusBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_get_rename_unnamed_functions_status_serialize( + self, + analysis_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def v3_get_security_scan_operation( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OperationSecurityScanMetadataSecurityScanResult: + """Get a security-scan operation. + + Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param analysis_id: Analysis ID (required) + :type analysis_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_get_security_scan_operation_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", - '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3546,7 +4372,7 @@ def v3_get_rename_unnamed_functions_result( @validate_call - def v3_get_rename_unnamed_functions_result_with_http_info( + def v3_get_security_scan_operation_with_http_info( self, analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], _request_timeout: Union[ @@ -3561,10 +4387,10 @@ def v3_get_rename_unnamed_functions_result_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RenameUnnamedFunctionsResult]: - """Get rename-unnamed-functions agent result. + ) -> ApiResponse[OperationSecurityScanMetadataSecurityScanResult]: + """Get a security-scan operation. - Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied :param analysis_id: Analysis ID (required) :type analysis_id: int @@ -3590,7 +4416,7 @@ def v3_get_rename_unnamed_functions_result_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_result_serialize( + _param = self._v3_get_security_scan_operation_serialize( analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, @@ -3599,10 +4425,9 @@ def v3_get_rename_unnamed_functions_result_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RenameUnnamedFunctionsResult", + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", - '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3618,7 +4443,7 @@ def v3_get_rename_unnamed_functions_result_with_http_info( @validate_call - def v3_get_rename_unnamed_functions_result_without_preload_content( + def v3_get_security_scan_operation_without_preload_content( self, analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], _request_timeout: Union[ @@ -3634,9 +4459,9 @@ def v3_get_rename_unnamed_functions_result_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get rename-unnamed-functions agent result. + """Get a security-scan operation. - Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied :param analysis_id: Analysis ID (required) :type analysis_id: int @@ -3662,7 +4487,7 @@ def v3_get_rename_unnamed_functions_result_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_result_serialize( + _param = self._v3_get_security_scan_operation_serialize( analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, @@ -3671,10 +4496,9 @@ def v3_get_rename_unnamed_functions_result_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RenameUnnamedFunctionsResult", + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", - '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3685,7 +4509,7 @@ def v3_get_rename_unnamed_functions_result_without_preload_content( return response_data.response - def _v3_get_rename_unnamed_functions_result_serialize( + def _v3_get_security_scan_operation_serialize( self, analysis_id, _request_auth, @@ -3734,7 +4558,7 @@ def _v3_get_rename_unnamed_functions_result_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v3/analyses/{analysis_id}/agents/rename-unnamed-functions', + resource_path='/v3/operations/security-scan/{analysis_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3751,9 +4575,10 @@ def _v3_get_rename_unnamed_functions_result_serialize( @validate_call - def v3_get_rename_unnamed_functions_status( + def v3_run_security_scan( self, analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + trigger_security_scan_input_body: TriggerSecurityScanInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3766,13 +4591,15 @@ def v3_get_rename_unnamed_functions_status( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> StatusBody: - """Get rename-unnamed-functions agent status. + ) -> OperationSecurityScanMetadataSecurityScanResult: + """Run the security-scan agent. - Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict :param analysis_id: Analysis ID (required) :type analysis_id: int + :param trigger_security_scan_input_body: (required) + :type trigger_security_scan_input_body: TriggerSecurityScanInputBody :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -3795,8 +4622,9 @@ def v3_get_rename_unnamed_functions_status( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_status_serialize( + _param = self._v3_run_security_scan_serialize( analysis_id=analysis_id, + trigger_security_scan_input_body=trigger_security_scan_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3804,9 +4632,10 @@ def v3_get_rename_unnamed_functions_status( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "StatusBody", + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", + '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3822,9 +4651,10 @@ def v3_get_rename_unnamed_functions_status( @validate_call - def v3_get_rename_unnamed_functions_status_with_http_info( + def v3_run_security_scan_with_http_info( self, analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + trigger_security_scan_input_body: TriggerSecurityScanInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3837,13 +4667,15 @@ def v3_get_rename_unnamed_functions_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[StatusBody]: - """Get rename-unnamed-functions agent status. + ) -> ApiResponse[OperationSecurityScanMetadataSecurityScanResult]: + """Run the security-scan agent. - Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict :param analysis_id: Analysis ID (required) :type analysis_id: int + :param trigger_security_scan_input_body: (required) + :type trigger_security_scan_input_body: TriggerSecurityScanInputBody :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -3866,8 +4698,9 @@ def v3_get_rename_unnamed_functions_status_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_status_serialize( + _param = self._v3_run_security_scan_serialize( analysis_id=analysis_id, + trigger_security_scan_input_body=trigger_security_scan_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3875,9 +4708,10 @@ def v3_get_rename_unnamed_functions_status_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "StatusBody", + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", + '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3893,9 +4727,10 @@ def v3_get_rename_unnamed_functions_status_with_http_info( @validate_call - def v3_get_rename_unnamed_functions_status_without_preload_content( + def v3_run_security_scan_without_preload_content( self, analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + trigger_security_scan_input_body: TriggerSecurityScanInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3909,12 +4744,14 @@ def v3_get_rename_unnamed_functions_status_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get rename-unnamed-functions agent status. + """Run the security-scan agent. - Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict :param analysis_id: Analysis ID (required) :type analysis_id: int + :param trigger_security_scan_input_body: (required) + :type trigger_security_scan_input_body: TriggerSecurityScanInputBody :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -3937,8 +4774,9 @@ def v3_get_rename_unnamed_functions_status_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._v3_get_rename_unnamed_functions_status_serialize( + _param = self._v3_run_security_scan_serialize( analysis_id=analysis_id, + trigger_security_scan_input_body=trigger_security_scan_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3946,9 +4784,10 @@ def v3_get_rename_unnamed_functions_status_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "StatusBody", + '200': "OperationSecurityScanMetadataSecurityScanResult", '403': "APIError", '404': "APIError", + '409': "APIError", '422': "APIError", '500': "APIError", } @@ -3959,9 +4798,10 @@ def v3_get_rename_unnamed_functions_status_without_preload_content( return response_data.response - def _v3_get_rename_unnamed_functions_status_serialize( + def _v3_run_security_scan_serialize( self, analysis_id, + trigger_security_scan_input_body, _request_auth, _content_type, _headers, @@ -3989,6 +4829,8 @@ def _v3_get_rename_unnamed_functions_status_serialize( # process the header parameters # process the form parameters # process the body parameter + if trigger_security_scan_input_body is not None: + _body_params = trigger_security_scan_input_body # set the HTTP header `Accept` @@ -3999,6 +4841,19 @@ def _v3_get_rename_unnamed_functions_status_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ @@ -4007,8 +4862,8 @@ def _v3_get_rename_unnamed_functions_status_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status', + method='POST', + resource_path='/v3/analyses/{analysis_id}/security-scan:run', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/revengai/api_client.py b/revengai/api_client.py index 8475356..9261e2d 100644 --- a/revengai/api_client.py +++ b/revengai/api_client.py @@ -90,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/v4.4.0/python' + self.user_agent = 'OpenAPI-Generator/v4.5.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 4f5d044..cf0a4d8 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -541,8 +541,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v4.4.0\n"\ - "SDK Package Version: v4.4.0".\ + "Version of the API: v4.5.0\n"\ + "SDK Package Version: v4.5.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/revengai/models/__init__.py b/revengai/models/__init__.py index dc030c3..2201a88 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -256,6 +256,7 @@ from revengai.models.event_contextcompacted import EventCONTEXTCOMPACTED from revengai.models.event_decomp_failed import EventDecompFailed from revengai.models.event_decomp_finished import EventDecompFinished +from revengai.models.event_names_finished import EventNamesFinished from revengai.models.event_prose import EventProse from revengai.models.event_runcancelled import EventRUNCANCELLED from revengai.models.event_runerror import EventRUNERROR @@ -280,6 +281,7 @@ from revengai.models.example import Example from revengai.models.export_model import ExportModel from revengai.models.external_response import ExternalResponse +from revengai.models.extracted_binary import ExtractedBinary from revengai.models.extracted_url import ExtractedURL from revengai.models.file_activity_entry import FileActivityEntry from revengai.models.file_format import FileFormat @@ -343,6 +345,7 @@ from revengai.models.indirect_call_site import IndirectCallSite from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody from revengai.models.inline_comment import InlineComment +from revengai.models.input_body import InputBody from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest from revengai.models.invite_user_input_body import InviteUserInputBody from revengai.models.issuer_allowed_domain import IssuerAllowedDomain @@ -375,8 +378,11 @@ from revengai.models.mutex_entry import MutexEntry from revengai.models.name_confidence import NameConfidence from revengai.models.name_source_type import NameSourceType +from revengai.models.names_finished_event import NamesFinishedEvent from revengai.models.network_activity import NetworkActivity from revengai.models.oidc_callback_input_body import OIDCCallbackInputBody +from revengai.models.operation_security_scan_metadata_security_scan_result import OperationSecurityScanMetadataSecurityScanResult +from revengai.models.operation_workflow_progress_result_body import OperationWorkflowProgressResultBody from revengai.models.order import Order from revengai.models.organisation import Organisation from revengai.models.organisation_group import OrganisationGroup @@ -430,6 +436,7 @@ from revengai.models.report_info import ReportInfo from revengai.models.report_options import ReportOptions from revengai.models.resolved_entity import ResolvedEntity +from revengai.models.result_body import ResultBody from revengai.models.revoke_body import RevokeBody from revengai.models.sso_provider import SSOProvider from revengai.models.sso_providers_output_body import SSOProvidersOutputBody @@ -440,6 +447,8 @@ from revengai.models.scrape_third_party_config import ScrapeThirdPartyConfig from revengai.models.section_model import SectionModel from revengai.models.security_model import SecurityModel +from revengai.models.security_scan_metadata import SecurityScanMetadata +from revengai.models.security_scan_result import SecurityScanResult from revengai.models.segment_info import SegmentInfo from revengai.models.send_message_request import SendMessageRequest from revengai.models.service_entry import ServiceEntry @@ -476,6 +485,7 @@ from revengai.models.start_matching_for_functions_input_body import StartMatchingForFunctionsInputBody from revengai.models.start_matching_output_body import StartMatchingOutputBody from revengai.models.startup_info import StartupInfo +from revengai.models.status import Status from revengai.models.status_body import StatusBody from revengai.models.status_input import StatusInput from revengai.models.status_output import StatusOutput @@ -509,6 +519,7 @@ from revengai.models.triage_report_response import TriageReportResponse from revengai.models.trigger_dynamic_execution_input_body import TriggerDynamicExecutionInputBody from revengai.models.trigger_rename_unnamed_functions_input_body import TriggerRenameUnnamedFunctionsInputBody +from revengai.models.trigger_security_scan_input_body import TriggerSecurityScanInputBody from revengai.models.ttp import Ttp from revengai.models.typedef_data_type import TypedefDataType from revengai.models.typedef_definition import TypedefDefinition diff --git a/revengai/models/event_names_finished.py b/revengai/models/event_names_finished.py new file mode 100644 index 0000000..ea35195 --- /dev/null +++ b/revengai/models/event_names_finished.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.names_finished_event import NamesFinishedEvent +from typing import Optional, Set +from typing_extensions import Self + +class EventNamesFinished(BaseModel): + """ + EventNamesFinished + """ # noqa: E501 + data: NamesFinishedEvent + event: StrictStr = Field(description="The event name.") + id: Optional[StrictInt] = Field(default=None, description="The event ID.") + retry: Optional[StrictInt] = Field(default=None, description="The retry time in milliseconds.") + __properties: ClassVar[List[str]] = ["data", "event", "id", "retry"] + + @field_validator('event') + def event_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['names_finished', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('names_finished', 'unknown_default_open_api')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventNamesFinished from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventNamesFinished from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": NamesFinishedEvent.from_dict(obj["data"]) if obj.get("data") is not None else None, + "event": obj.get("event"), + "id": obj.get("id"), + "retry": obj.get("retry") + }) + return _obj + + diff --git a/revengai/models/extracted_binary.py b/revengai/models/extracted_binary.py new file mode 100644 index 0000000..22937fc --- /dev/null +++ b/revengai/models/extracted_binary.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ExtractedBinary(BaseModel): + """ + ExtractedBinary + """ # noqa: E501 + filename: StrictStr = Field(description="Original filename inside the upload") + sha_256_hash: StrictStr = Field(description="Content hash of the recovered binary") + size: StrictInt = Field(description="File size (in bytes)") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filename", "sha_256_hash", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExtractedBinary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExtractedBinary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filename": obj.get("filename"), + "sha_256_hash": obj.get("sha_256_hash"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/input_body.py b/revengai/models/input_body.py new file mode 100644 index 0000000..6674726 --- /dev/null +++ b/revengai/models/input_body.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class InputBody(BaseModel): + """ + InputBody + """ # noqa: E501 + password: Optional[StrictStr] = Field(default=None, description="Password to decrypt an encrypted archive.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["password"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InputBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "password": obj.get("password") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/names_finished_event.py b/revengai/models/names_finished_event.py new file mode 100644 index 0000000..6121fa6 --- /dev/null +++ b/revengai/models/names_finished_event.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class NamesFinishedEvent(BaseModel): + """ + NamesFinishedEvent + """ # noqa: E501 + applied: StrictInt + attempt: StrictInt + seq: StrictInt + type: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["applied", "attempt", "seq", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NamesFinishedEvent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NamesFinishedEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "applied": obj.get("applied"), + "attempt": obj.get("attempt"), + "seq": obj.get("seq"), + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/operation_security_scan_metadata_security_scan_result.py b/revengai/models/operation_security_scan_metadata_security_scan_result.py new file mode 100644 index 0000000..c272a0b --- /dev/null +++ b/revengai/models/operation_security_scan_metadata_security_scan_result.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.security_scan_metadata import SecurityScanMetadata +from revengai.models.security_scan_result import SecurityScanResult +from revengai.models.status import Status +from typing import Optional, Set +from typing_extensions import Self + +class OperationSecurityScanMetadataSecurityScanResult(BaseModel): + """ + OperationSecurityScanMetadataSecurityScanResult + """ # noqa: E501 + done: StrictBool = Field(description="Whether the operation has reached a terminal state.") + error: Optional[Status] = Field(default=None, description="Failure detail, populated only when done is true and the operation failed.") + metadata: Optional[SecurityScanMetadata] = Field(default=None, description="In-flight information and details.") + name: StrictStr = Field(description="API resource name.") + response: Optional[SecurityScanResult] = Field(default=None, description="Result, set only when done is true and the operation succeeded.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["done", "error", "metadata", "name", "response"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OperationSecurityScanMetadataSecurityScanResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of response + if self.response: + _dict['response'] = self.response.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OperationSecurityScanMetadataSecurityScanResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "done": obj.get("done"), + "error": Status.from_dict(obj["error"]) if obj.get("error") is not None else None, + "metadata": SecurityScanMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "name": obj.get("name"), + "response": SecurityScanResult.from_dict(obj["response"]) if obj.get("response") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/operation_workflow_progress_result_body.py b/revengai/models/operation_workflow_progress_result_body.py new file mode 100644 index 0000000..45a5370 --- /dev/null +++ b/revengai/models/operation_workflow_progress_result_body.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.result_body import ResultBody +from revengai.models.status import Status +from revengai.models.workflow_progress import WorkflowProgress +from typing import Optional, Set +from typing_extensions import Self + +class OperationWorkflowProgressResultBody(BaseModel): + """ + OperationWorkflowProgressResultBody + """ # noqa: E501 + done: StrictBool = Field(description="Whether the operation has reached a terminal state.") + error: Optional[Status] = Field(default=None, description="Failure detail, populated only when done is true and the operation failed.") + metadata: Optional[WorkflowProgress] = Field(default=None, description="In-flight information and details.") + name: StrictStr = Field(description="API resource name.") + response: Optional[ResultBody] = Field(default=None, description="Result, set only when done is true and the operation succeeded.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["done", "error", "metadata", "name", "response"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OperationWorkflowProgressResultBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of response + if self.response: + _dict['response'] = self.response.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OperationWorkflowProgressResultBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "done": obj.get("done"), + "error": Status.from_dict(obj["error"]) if obj.get("error") is not None else None, + "metadata": WorkflowProgress.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "name": obj.get("name"), + "response": ResultBody.from_dict(obj["response"]) if obj.get("response") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/rename_input_body.py b/revengai/models/rename_input_body.py index 0beff04..b7e2a69 100644 --- a/revengai/models/rename_input_body.py +++ b/revengai/models/rename_input_body.py @@ -16,7 +16,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set @@ -28,9 +28,8 @@ class RenameInputBody(BaseModel): """ # noqa: E501 new_mangled_name: Optional[Annotated[str, Field(strict=True, max_length=2048)]] = Field(default=None, description="New mangled function name") new_name: Annotated[str, Field(min_length=1, strict=True, max_length=2048)] = Field(description="New function name") - preserve_ai_decompilation: Optional[StrictBool] = Field(default=None, description="Keep the cached AI decompilation, summary and inline comments. Set when the new name comes from the model's own prediction (e.g. Transfer Name) so existing AI output is not discarded and regenerated.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["new_mangled_name", "new_name", "preserve_ai_decompilation"] + __properties: ClassVar[List[str]] = ["new_mangled_name", "new_name"] model_config = ConfigDict( populate_by_name=True, @@ -91,8 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "new_mangled_name": obj.get("new_mangled_name"), - "new_name": obj.get("new_name"), - "preserve_ai_decompilation": obj.get("preserve_ai_decompilation") + "new_name": obj.get("new_name") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/revengai/models/result_body.py b/revengai/models/result_body.py new file mode 100644 index 0000000..f7c70a5 --- /dev/null +++ b/revengai/models/result_body.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.extracted_binary import ExtractedBinary +from typing import Optional, Set +from typing_extensions import Self + +class ResultBody(BaseModel): + """ + ResultBody + """ # noqa: E501 + binaries: Optional[List[ExtractedBinary]] = Field(description="Child binaries recovered from the extraction.") + extraction_depth: StrictInt = Field(description="Number of nested-archive extraction passes taken.") + filename_to_extraction_failure: Dict[str, StrictStr] = Field(description="Per-file extraction failures, keyed by filename.") + skipped_files: StrictInt = Field(description="Files skipped because they were not recognised as binaries.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries", "extraction_depth", "filename_to_extraction_failure", "skipped_files"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResultBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in binaries (list) + _items = [] + if self.binaries: + for _item_binaries in self.binaries: + if _item_binaries: + _items.append(_item_binaries.to_dict()) + _dict['binaries'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if binaries (nullable) is None + # and model_fields_set contains the field + if self.binaries is None and "binaries" in self.model_fields_set: + _dict['binaries'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResultBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binaries": [ExtractedBinary.from_dict(_item) for _item in obj["binaries"]] if obj.get("binaries") is not None else None, + "extraction_depth": obj.get("extraction_depth"), + "filename_to_extraction_failure": obj.get("filename_to_extraction_failure"), + "skipped_files": obj.get("skipped_files") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/security_scan_metadata.py b/revengai/models/security_scan_metadata.py new file mode 100644 index 0000000..5b129e1 --- /dev/null +++ b/revengai/models/security_scan_metadata.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class SecurityScanMetadata(BaseModel): + """ + SecurityScanMetadata + """ # noqa: E501 + log_history: Optional[List[Annotated[List[Any], Field(min_length=2, max_length=2)]]] = Field(default=None, description="Progress messages the run recorded, oldest first.") + status: StrictStr = Field(description="Run status. UNINITIALISED means the agent has never been triggered for this analysis.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["log_history", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['UNINITIALISED', 'PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('UNINITIALISED', 'PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'unknown_default_open_api')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SecurityScanMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if log_history (nullable) is None + # and model_fields_set contains the field + if self.log_history is None and "log_history" in self.model_fields_set: + _dict['log_history'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SecurityScanMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "log_history": obj.get("log_history"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/security_scan_result.py b/revengai/models/security_scan_result.py new file mode 100644 index 0000000..fb28dc2 --- /dev/null +++ b/revengai/models/security_scan_result.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SecurityScanResult(BaseModel): + """ + SecurityScanResult + """ # noqa: E501 + analysis_id: StrictInt = Field(description="Analysis the run was performed against") + cancelled: StrictBool = Field(description="Whether the run was cancelled before it covered every function") + decompiled: StrictInt = Field(description="Functions successfully decompiled and scanned") + failed: StrictInt = Field(description="Functions whose decompilation or scan attempt errored") + security_scan: Optional[Dict[str, Any]] = Field(default=None, description="Raw semgrep findings, keyed by the scanner's own result shape") + source: StrictStr = Field(description="Decompiler that produced the source scanned") + total: StrictInt = Field(description="Functions the run considered") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["analysis_id", "cancelled", "decompiled", "failed", "security_scan", "source", "total"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SecurityScanResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SecurityScanResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "analysis_id": obj.get("analysis_id"), + "cancelled": obj.get("cancelled"), + "decompiled": obj.get("decompiled"), + "failed": obj.get("failed"), + "security_scan": obj.get("security_scan"), + "source": obj.get("source"), + "total": obj.get("total") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/status.py b/revengai/models/status.py new file mode 100644 index 0000000..ead5677 --- /dev/null +++ b/revengai/models/status.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Status(BaseModel): + """ + Status + """ # noqa: E501 + code: StrictStr = Field(description="Machine-readable error code, shared with synchronous API errors.") + detail: Optional[StrictStr] = Field(default=None, description="Additional context where helpful (quota numbers, validation specifics, etc.).") + doc_url: StrictStr = Field(description="Link to documentation explaining this error and resolution steps.") + message: StrictStr = Field(description="Brief description of the failure.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "detail", "doc_url", "message"] + + @field_validator('code') + def code_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ACCESS_DENIED', 'AGENT_BUDGET_EXCEEDED', 'AGENT_DEFINITION_NOT_FOUND', 'AGENT_INVALID_STARTING_INPUT', 'AGENT_MEMORY_INVALID_SCOPE', 'AGENT_MEMORY_NOT_FOUND', 'AGENT_MEMORY_VERSION_CONFLICT', 'AGENT_NO_PENDING_QUESTION', 'AGENT_RUN_NOT_FOUND', 'ALREADY_EXISTS', 'ANALYSIS_NOT_READY', 'BAD_REQUEST', 'CLIENT_CLOSED_REQUEST', 'CONFLICT', 'CONVERSATION_NOT_FOUND', 'DOMAIN_ALREADY_CLAIMED', 'DOMAIN_VERIFICATION_PENDING', 'DYNAMIC_EXECUTION_INCOMPLETE', 'EMAIL_NOT_VERIFIED', 'EXTERNAL_USER', 'FORBIDDEN', 'GATEWAY_TIMEOUT', 'GROUP_HAS_MEMBERS', 'INSUFFICIENT_CREDITS', 'INTERNAL_ERROR', 'INTERNAL_ISSUER', 'INVALID_CONVERSATION_ID', 'INVALID_CREDENTIALS', 'INVALID_INVITE_CODE', 'INVALID_RESET_CODE', 'LAST_ORG_OWNER', 'LAST_TEAM_ADMIN', 'LAST_TEAM_MEMBER', 'LINKED_TO_ORG', 'METHOD_NOT_ALLOWED', 'NOT_ACCEPTABLE', 'NOT_FOUND', 'NO_ACTIVE_RUN', 'NO_PENDING_CONFIRMATION', 'OIDC_DISCOVERY_FAILED', 'PASSWORD_RESET_REQUIRED', 'PAYMENT_REQUIRED', 'REPORT_RENDER_FAILED', 'REQUEST_ENTITY_TOO_LARGE', 'RUN_ALREADY_ACTIVE', 'SELF_DELETION_NOT_ALLOWED', 'SERVICE_UNAVAILABLE', 'TOKEN_EXPIRED', 'TOKEN_REUSED', 'TOO_MANY_REQUESTS', 'UNAUTHORIZED', 'UNSUPPORTED_MEDIA_TYPE', 'VALIDATION_FAILED', 'VERIFICATION_EXPIRED', 'VERIFICATION_NOT_FOUND', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('ACCESS_DENIED', 'AGENT_BUDGET_EXCEEDED', 'AGENT_DEFINITION_NOT_FOUND', 'AGENT_INVALID_STARTING_INPUT', 'AGENT_MEMORY_INVALID_SCOPE', 'AGENT_MEMORY_NOT_FOUND', 'AGENT_MEMORY_VERSION_CONFLICT', 'AGENT_NO_PENDING_QUESTION', 'AGENT_RUN_NOT_FOUND', 'ALREADY_EXISTS', 'ANALYSIS_NOT_READY', 'BAD_REQUEST', 'CLIENT_CLOSED_REQUEST', 'CONFLICT', 'CONVERSATION_NOT_FOUND', 'DOMAIN_ALREADY_CLAIMED', 'DOMAIN_VERIFICATION_PENDING', 'DYNAMIC_EXECUTION_INCOMPLETE', 'EMAIL_NOT_VERIFIED', 'EXTERNAL_USER', 'FORBIDDEN', 'GATEWAY_TIMEOUT', 'GROUP_HAS_MEMBERS', 'INSUFFICIENT_CREDITS', 'INTERNAL_ERROR', 'INTERNAL_ISSUER', 'INVALID_CONVERSATION_ID', 'INVALID_CREDENTIALS', 'INVALID_INVITE_CODE', 'INVALID_RESET_CODE', 'LAST_ORG_OWNER', 'LAST_TEAM_ADMIN', 'LAST_TEAM_MEMBER', 'LINKED_TO_ORG', 'METHOD_NOT_ALLOWED', 'NOT_ACCEPTABLE', 'NOT_FOUND', 'NO_ACTIVE_RUN', 'NO_PENDING_CONFIRMATION', 'OIDC_DISCOVERY_FAILED', 'PASSWORD_RESET_REQUIRED', 'PAYMENT_REQUIRED', 'REPORT_RENDER_FAILED', 'REQUEST_ENTITY_TOO_LARGE', 'RUN_ALREADY_ACTIVE', 'SELF_DELETION_NOT_ALLOWED', 'SERVICE_UNAVAILABLE', 'TOKEN_EXPIRED', 'TOKEN_REUSED', 'TOO_MANY_REQUESTS', 'UNAUTHORIZED', 'UNSUPPORTED_MEDIA_TYPE', 'VALIDATION_FAILED', 'VERIFICATION_EXPIRED', 'VERIFICATION_NOT_FOUND', 'unknown_default_open_api')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Status from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Status from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "detail": obj.get("detail"), + "doc_url": obj.get("doc_url"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/stream_ai_decompilation200_response_inner.py b/revengai/models/stream_ai_decompilation200_response_inner.py index 88ab1c0..913d466 100644 --- a/revengai/models/stream_ai_decompilation200_response_inner.py +++ b/revengai/models/stream_ai_decompilation200_response_inner.py @@ -20,6 +20,7 @@ from revengai.models.event_attempt_started import EventAttemptStarted from revengai.models.event_decomp_failed import EventDecompFailed from revengai.models.event_decomp_finished import EventDecompFinished +from revengai.models.event_names_finished import EventNamesFinished from revengai.models.event_prose import EventProse from revengai.models.event_rename_applied import EventRenameApplied from revengai.models.event_source_delta import EventSourceDelta @@ -29,7 +30,7 @@ from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -STREAMAIDECOMPILATION200RESPONSEINNER_ONE_OF_SCHEMAS = ["EventAttemptFailed", "EventAttemptStarted", "EventDecompFailed", "EventDecompFinished", "EventProse", "EventRenameApplied", "EventSourceDelta", "EventSourceReset", "EventWarning"] +STREAMAIDECOMPILATION200RESPONSEINNER_ONE_OF_SCHEMAS = ["EventAttemptFailed", "EventAttemptStarted", "EventDecompFailed", "EventDecompFinished", "EventNamesFinished", "EventProse", "EventRenameApplied", "EventSourceDelta", "EventSourceReset", "EventWarning"] class StreamAiDecompilation200ResponseInner(BaseModel): """ @@ -43,18 +44,20 @@ class StreamAiDecompilation200ResponseInner(BaseModel): oneof_schema_3_validator: Optional[EventDecompFailed] = None # data type: EventDecompFinished oneof_schema_4_validator: Optional[EventDecompFinished] = None + # data type: EventNamesFinished + oneof_schema_5_validator: Optional[EventNamesFinished] = None # data type: EventProse - oneof_schema_5_validator: Optional[EventProse] = None + oneof_schema_6_validator: Optional[EventProse] = None # data type: EventRenameApplied - oneof_schema_6_validator: Optional[EventRenameApplied] = None + oneof_schema_7_validator: Optional[EventRenameApplied] = None # data type: EventSourceDelta - oneof_schema_7_validator: Optional[EventSourceDelta] = None + oneof_schema_8_validator: Optional[EventSourceDelta] = None # data type: EventSourceReset - oneof_schema_8_validator: Optional[EventSourceReset] = None + oneof_schema_9_validator: Optional[EventSourceReset] = None # data type: EventWarning - oneof_schema_9_validator: Optional[EventWarning] = None - actual_instance: Optional[Union[EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning]] = None - one_of_schemas: Set[str] = { "EventAttemptFailed", "EventAttemptStarted", "EventDecompFailed", "EventDecompFinished", "EventProse", "EventRenameApplied", "EventSourceDelta", "EventSourceReset", "EventWarning" } + oneof_schema_10_validator: Optional[EventWarning] = None + actual_instance: Optional[Union[EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning]] = None + one_of_schemas: Set[str] = { "EventAttemptFailed", "EventAttemptStarted", "EventDecompFailed", "EventDecompFinished", "EventNamesFinished", "EventProse", "EventRenameApplied", "EventSourceDelta", "EventSourceReset", "EventWarning" } model_config = ConfigDict( validate_assignment=True, @@ -97,6 +100,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `EventDecompFinished`") else: match += 1 + # validate data type: EventNamesFinished + if not isinstance(v, EventNamesFinished): + error_messages.append(f"Error! Input type `{type(v)}` is not `EventNamesFinished`") + else: + match += 1 # validate data type: EventProse if not isinstance(v, EventProse): error_messages.append(f"Error! Input type `{type(v)}` is not `EventProse`") @@ -124,10 +132,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) else: return v @@ -166,6 +174,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into EventNamesFinished + try: + instance.actual_instance = EventNamesFinished.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into EventProse try: instance.actual_instance = EventProse.from_json(json_str) @@ -199,10 +213,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. Details: " + ", ".join(error_messages)) else: return instance @@ -216,7 +230,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/revengai/models/trigger_security_scan_input_body.py b/revengai/models/trigger_security_scan_input_body.py new file mode 100644 index 0000000..517de41 --- /dev/null +++ b/revengai/models/trigger_security_scan_input_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class TriggerSecurityScanInputBody(BaseModel): + """ + TriggerSecurityScanInputBody + """ # noqa: E501 + max_functions_to_scan: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Stop after decompiling and scanning this many functions. Omit to process every function in the analysis.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["max_functions_to_scan"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TriggerSecurityScanInputBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TriggerSecurityScanInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "max_functions_to_scan": obj.get("max_functions_to_scan") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +