From 627004147aa54e1be4bf885d324a9f2fc30f6751 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 May 2026 07:33:46 +0000 Subject: [PATCH] Update SDK to version v3.86.3 - Generated from OpenAPI spec version v3.86.3 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 6 + docs/AddUserStringInputBody.md | 30 + docs/AddUserStringToFunctionInputBody.md | 30 + docs/AnalysesCoreApi.md | 4 +- docs/AnalysisReport.md | 1 + docs/ELFRelocation.md | 1 + docs/ELFSymbol.md | 1 + docs/ExtractedFileEntry.md | 38 ++ docs/ProcessExtractedFiles.md | 30 + docs/StringsApi.md | 188 +++++ revengai/__init__.py | 12 +- revengai/api/__init__.py | 1 + revengai/api/analyses_core_api.py | 18 +- revengai/api/strings_api.py | 641 ++++++++++++++++++ revengai/api_client.py | 2 +- revengai/configuration.py | 4 +- revengai/models/__init__.py | 4 + revengai/models/add_user_string_input_body.py | 102 +++ .../add_user_string_to_function_input_body.py | 102 +++ revengai/models/analysis_report.py | 17 +- revengai/models/elf_relocation.py | 8 +- revengai/models/elf_symbol.py | 10 +- revengai/models/extracted_file_entry.py | 152 +++++ revengai/models/process_extracted_files.py | 114 ++++ 25 files changed, 1494 insertions(+), 24 deletions(-) create mode 100644 docs/AddUserStringInputBody.md create mode 100644 docs/AddUserStringToFunctionInputBody.md create mode 100644 docs/ExtractedFileEntry.md create mode 100644 docs/ProcessExtractedFiles.md create mode 100644 docs/StringsApi.md create mode 100644 revengai/api/strings_api.py create mode 100644 revengai/models/add_user_string_input_body.py create mode 100644 revengai/models/add_user_string_to_function_input_body.py create mode 100644 revengai/models/extracted_file_entry.py create mode 100644 revengai/models/process_extracted_files.py diff --git a/.sdk-version b/.sdk-version index 71f00aa..8f4fe4d 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.85.1 +v3.86.3 diff --git a/README.md b/README.md index ec84931..84e4893 100644 --- a/README.md +++ b/README.md @@ -170,11 +170,15 @@ Class | Method | HTTP request | Description *SearchApi* | [**search_collections**](docs/SearchApi.md#search_collections) | **GET** /v2/search/collections | Collections search *SearchApi* | [**search_functions**](docs/SearchApi.md#search_functions) | **GET** /v2/search/functions | Functions search *SearchApi* | [**search_tags**](docs/SearchApi.md#search_tags) | **GET** /v2/search/tags | Tags search +*StringsApi* | [**add_user_string_to_analysis**](docs/StringsApi.md#add_user_string_to_analysis) | **POST** /v3/analyses/{analysis_id}/user-provided-strings | Add a user-provided string to an analysis. +*StringsApi* | [**add_user_string_to_function**](docs/StringsApi.md#add_user_string_to_function) | **POST** /v3/functions/{function_id}/user-provided-strings | Add a user-provided string to a function. ## Documentation For Models - [APIError](docs/APIError.md) + - [AddUserStringInputBody](docs/AddUserStringInputBody.md) + - [AddUserStringToFunctionInputBody](docs/AddUserStringToFunctionInputBody.md) - [AdditionalDetailsStatusResponse](docs/AdditionalDetailsStatusResponse.md) - [Addr](docs/Addr.md) - [AiDecompilationRating](docs/AiDecompilationRating.md) @@ -380,6 +384,7 @@ Class | Method | HTTP request | Description - [EventWarning](docs/EventWarning.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) + - [ExtractedFileEntry](docs/ExtractedFileEntry.md) - [ExtractedURL](docs/ExtractedURL.md) - [FileActivityEntry](docs/FileActivityEntry.md) - [FileFormat](docs/FileFormat.md) @@ -465,6 +470,7 @@ Class | Method | HTTP request | Description - [PatchCommentBody](docs/PatchCommentBody.md) - [Platform](docs/Platform.md) - [ProcessActivityEntry](docs/ProcessActivityEntry.md) + - [ProcessExtractedFiles](docs/ProcessExtractedFiles.md) - [ProcessMemdumps](docs/ProcessMemdumps.md) - [ProcessNode](docs/ProcessNode.md) - [ProcessTree](docs/ProcessTree.md) diff --git a/docs/AddUserStringInputBody.md b/docs/AddUserStringInputBody.md new file mode 100644 index 0000000..37b8f25 --- /dev/null +++ b/docs/AddUserStringInputBody.md @@ -0,0 +1,30 @@ +# AddUserStringInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | **str** | String literal | +**virtual_address** | **int** | Virtual address at which this string is defined. | + +## Example + +```python +from revengai.models.add_user_string_input_body import AddUserStringInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of AddUserStringInputBody from a JSON string +add_user_string_input_body_instance = AddUserStringInputBody.from_json(json) +# print the JSON string representation of the object +print(AddUserStringInputBody.to_json()) + +# convert the object into a dict +add_user_string_input_body_dict = add_user_string_input_body_instance.to_dict() +# create an instance of AddUserStringInputBody from a dict +add_user_string_input_body_from_dict = AddUserStringInputBody.from_dict(add_user_string_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/AddUserStringToFunctionInputBody.md b/docs/AddUserStringToFunctionInputBody.md new file mode 100644 index 0000000..013c50e --- /dev/null +++ b/docs/AddUserStringToFunctionInputBody.md @@ -0,0 +1,30 @@ +# AddUserStringToFunctionInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | **str** | String literal | +**virtual_address** | **int** | Virtual address at which this string is defined. | + +## Example + +```python +from revengai.models.add_user_string_to_function_input_body import AddUserStringToFunctionInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of AddUserStringToFunctionInputBody from a JSON string +add_user_string_to_function_input_body_instance = AddUserStringToFunctionInputBody.from_json(json) +# print the JSON string representation of the object +print(AddUserStringToFunctionInputBody.to_json()) + +# convert the object into a dict +add_user_string_to_function_input_body_dict = add_user_string_to_function_input_body_instance.to_dict() +# create an instance of AddUserStringToFunctionInputBody from a dict +add_user_string_to_function_input_body_from_dict = AddUserStringToFunctionInputBody.from_dict(add_user_string_to_function_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/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 643c054..9c6529d 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -1407,7 +1407,7 @@ with revengai.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = revengai.AnalysesCoreApi(api_client) upload_file_type = revengai.UploadFileType() # UploadFileType | - file = 'file_example' # str | + file = None # bytearray | packed_password = 'packed_password_example' # str | (optional) force_overwrite = False # bool | (optional) (default to False) @@ -1428,7 +1428,7 @@ with revengai.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **upload_file_type** | [**UploadFileType**](UploadFileType.md)| | - **file** | **str**| | + **file** | **bytearray**| | **packed_password** | **str**| | [optional] **force_overwrite** | **bool**| | [optional] [default to False] diff --git a/docs/AnalysisReport.md b/docs/AnalysisReport.md index 813749d..4e1db6d 100644 --- a/docs/AnalysisReport.md +++ b/docs/AnalysisReport.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**extracted_files** | [**List[ProcessExtractedFiles]**](ProcessExtractedFiles.md) | | [optional] **file_activity** | [**List[FileActivityEntry]**](FileActivityEntry.md) | | [optional] **info** | [**ReportInfo**](ReportInfo.md) | | **memdumps** | [**List[ProcessMemdumps]**](ProcessMemdumps.md) | | [optional] diff --git a/docs/ELFRelocation.md b/docs/ELFRelocation.md index eb57829..9dcc26d 100644 --- a/docs/ELFRelocation.md +++ b/docs/ELFRelocation.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **symbol_name** | **str** | | **is_dynamic** | **bool** | | **is_pltgot** | **bool** | | +**is_unicode_symbol_name** | **bool** | | [optional] [default to True] ## Example diff --git a/docs/ELFSymbol.md b/docs/ELFSymbol.md index 8fb9168..20ace48 100644 --- a/docs/ELFSymbol.md +++ b/docs/ELFSymbol.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **binding** | **str** | | **visibility** | **str** | | **section_index** | **int** | | +**is_unicode_name** | **bool** | | [optional] [default to True] ## Example diff --git a/docs/ExtractedFileEntry.md b/docs/ExtractedFileEntry.md new file mode 100644 index 0000000..9684c40 --- /dev/null +++ b/docs/ExtractedFileEntry.md @@ -0,0 +1,38 @@ +# ExtractedFileEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_hash** | **str** | | [optional] +**file_size** | **int** | | +**file_type** | **str** | | [optional] +**filename** | **str** | | +**is_pe** | **bool** | | [optional] +**mime_type** | **str** | | [optional] +**reason** | **str** | | [optional] +**seq_num** | **int** | | +**sha256** | **str** | | [optional] +**zip_filename** | **str** | | + +## Example + +```python +from revengai.models.extracted_file_entry import ExtractedFileEntry + +# TODO update the JSON string below +json = "{}" +# create an instance of ExtractedFileEntry from a JSON string +extracted_file_entry_instance = ExtractedFileEntry.from_json(json) +# print the JSON string representation of the object +print(ExtractedFileEntry.to_json()) + +# convert the object into a dict +extracted_file_entry_dict = extracted_file_entry_instance.to_dict() +# create an instance of ExtractedFileEntry from a dict +extracted_file_entry_from_dict = ExtractedFileEntry.from_dict(extracted_file_entry_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/ProcessExtractedFiles.md b/docs/ProcessExtractedFiles.md new file mode 100644 index 0000000..ab93e28 --- /dev/null +++ b/docs/ProcessExtractedFiles.md @@ -0,0 +1,30 @@ +# ProcessExtractedFiles + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**files** | [**List[ExtractedFileEntry]**](ExtractedFileEntry.md) | | [optional] +**process_seqid** | **int** | | + +## Example + +```python +from revengai.models.process_extracted_files import ProcessExtractedFiles + +# TODO update the JSON string below +json = "{}" +# create an instance of ProcessExtractedFiles from a JSON string +process_extracted_files_instance = ProcessExtractedFiles.from_json(json) +# print the JSON string representation of the object +print(ProcessExtractedFiles.to_json()) + +# convert the object into a dict +process_extracted_files_dict = process_extracted_files_instance.to_dict() +# create an instance of ProcessExtractedFiles from a dict +process_extracted_files_from_dict = ProcessExtractedFiles.from_dict(process_extracted_files_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/StringsApi.md b/docs/StringsApi.md new file mode 100644 index 0000000..2bb6d79 --- /dev/null +++ b/docs/StringsApi.md @@ -0,0 +1,188 @@ +# revengai.StringsApi + +All URIs are relative to *https://api.reveng.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_user_string_to_analysis**](StringsApi.md#add_user_string_to_analysis) | **POST** /v3/analyses/{analysis_id}/user-provided-strings | Add a user-provided string to an analysis. +[**add_user_string_to_function**](StringsApi.md#add_user_string_to_function) | **POST** /v3/functions/{function_id}/user-provided-strings | Add a user-provided string to a function. + + +# **add_user_string_to_analysis** +> Dict[str, object] add_user_string_to_analysis(analysis_id, add_user_string_input_body) + +Add a user-provided string to an analysis. + +Attaches a user-provided string to an analysis at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during analysis. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.add_user_string_input_body import AddUserStringInputBody +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' + +# 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.StringsApi(api_client) + analysis_id = 56 # int | Analysis ID + add_user_string_input_body = revengai.AddUserStringInputBody() # AddUserStringInputBody | + + try: + # Add a user-provided string to an analysis. + api_response = api_instance.add_user_string_to_analysis(analysis_id, add_user_string_input_body) + print("The response of StringsApi->add_user_string_to_analysis:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StringsApi->add_user_string_to_analysis: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + **add_user_string_input_body** | [**AddUserStringInputBody**](AddUserStringInputBody.md)| | + +### Return type + +**Dict[str, object]** + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**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) + +# **add_user_string_to_function** +> Dict[str, object] add_user_string_to_function(function_id, add_user_string_to_function_input_body) + +Add a user-provided string to a function. + +Attaches a user-provided string to a function at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during analysis. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.add_user_string_to_function_input_body import AddUserStringToFunctionInputBody +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' + +# 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.StringsApi(api_client) + function_id = 56 # int | Function ID + add_user_string_to_function_input_body = revengai.AddUserStringToFunctionInputBody() # AddUserStringToFunctionInputBody | + + try: + # Add a user-provided string to a function. + api_response = api_instance.add_user_string_to_function(function_id, add_user_string_to_function_input_body) + print("The response of StringsApi->add_user_string_to_function:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StringsApi->add_user_string_to_function: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **function_id** | **int**| Function ID | + **add_user_string_to_function_input_body** | [**AddUserStringToFunctionInputBody**](AddUserStringToFunctionInputBody.md)| | + +### Return type + +**Dict[str, object]** + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**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) + diff --git a/revengai/__init__.py b/revengai/__init__.py index 7744ebe..be4378c 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.85.1" +__version__ = "v3.86.3" # Define package exports __all__ = [ @@ -37,6 +37,7 @@ "ModelsApi", "ReportsApi", "SearchApi", + "StringsApi", "ApiResponse", "ApiClient", "Configuration", @@ -47,6 +48,8 @@ "ApiAttributeError", "ApiException", "APIError", + "AddUserStringInputBody", + "AddUserStringToFunctionInputBody", "AdditionalDetailsStatusResponse", "Addr", "AiDecompilationRating", @@ -252,6 +255,7 @@ "EventWarning", "ExportModel", "ExternalResponse", + "ExtractedFileEntry", "ExtractedURL", "FileActivityEntry", "FileFormat", @@ -337,6 +341,7 @@ "PatchCommentBody", "Platform", "ProcessActivityEntry", + "ProcessExtractedFiles", "ProcessMemdumps", "ProcessNode", "ProcessTree", @@ -459,6 +464,7 @@ from revengai.api.models_api import ModelsApi as ModelsApi from revengai.api.reports_api import ReportsApi as ReportsApi from revengai.api.search_api import SearchApi as SearchApi +from revengai.api.strings_api import StringsApi as StringsApi # import ApiClient from revengai.api_response import ApiResponse as ApiResponse @@ -473,6 +479,8 @@ # import models into sdk package from revengai.models.api_error import APIError as APIError +from revengai.models.add_user_string_input_body import AddUserStringInputBody as AddUserStringInputBody +from revengai.models.add_user_string_to_function_input_body import AddUserStringToFunctionInputBody as AddUserStringToFunctionInputBody from revengai.models.additional_details_status_response import AdditionalDetailsStatusResponse as AdditionalDetailsStatusResponse from revengai.models.addr import Addr as Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating as AiDecompilationRating @@ -678,6 +686,7 @@ from revengai.models.event_warning import EventWarning as EventWarning from revengai.models.export_model import ExportModel as ExportModel from revengai.models.external_response import ExternalResponse as ExternalResponse +from revengai.models.extracted_file_entry import ExtractedFileEntry as ExtractedFileEntry 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 @@ -763,6 +772,7 @@ from revengai.models.patch_comment_body import PatchCommentBody as PatchCommentBody from revengai.models.platform import Platform as Platform from revengai.models.process_activity_entry import ProcessActivityEntry as ProcessActivityEntry +from revengai.models.process_extracted_files import ProcessExtractedFiles as ProcessExtractedFiles from revengai.models.process_memdumps import ProcessMemdumps as ProcessMemdumps from revengai.models.process_node import ProcessNode as ProcessNode from revengai.models.process_tree import ProcessTree as ProcessTree diff --git a/revengai/api/__init__.py b/revengai/api/__init__.py index 2367c64..4678585 100644 --- a/revengai/api/__init__.py +++ b/revengai/api/__init__.py @@ -21,4 +21,5 @@ from revengai.api.models_api import ModelsApi from revengai.api.reports_api import ReportsApi from revengai.api.search_api import SearchApi +from revengai.api.strings_api import StringsApi diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index bafcea6..33bcc78 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -15,8 +15,8 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictInt, StrictStr -from typing import Any, List, Optional +from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr +from typing import Any, List, Optional, Tuple, Union from typing_extensions import Annotated from revengai.models.analysis_create_request import AnalysisCreateRequest from revengai.models.analysis_update_request import AnalysisUpdateRequest @@ -4707,7 +4707,7 @@ def _update_analysis_tags_serialize( def upload_file( self, upload_file_type: UploadFileType, - file: StrictStr, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], packed_password: Optional[StrictStr] = None, force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ @@ -4729,7 +4729,7 @@ def upload_file( :param upload_file_type: (required) :type upload_file_type: UploadFileType :param file: (required) - :type file: str + :type file: bytearray :param packed_password: :type packed_password: str :param force_overwrite: @@ -4786,7 +4786,7 @@ def upload_file( def upload_file_with_http_info( self, upload_file_type: UploadFileType, - file: StrictStr, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], packed_password: Optional[StrictStr] = None, force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ @@ -4808,7 +4808,7 @@ def upload_file_with_http_info( :param upload_file_type: (required) :type upload_file_type: UploadFileType :param file: (required) - :type file: str + :type file: bytearray :param packed_password: :type packed_password: str :param force_overwrite: @@ -4865,7 +4865,7 @@ def upload_file_with_http_info( def upload_file_without_preload_content( self, upload_file_type: UploadFileType, - file: StrictStr, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], packed_password: Optional[StrictStr] = None, force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ @@ -4887,7 +4887,7 @@ def upload_file_without_preload_content( :param upload_file_type: (required) :type upload_file_type: UploadFileType :param file: (required) - :type file: str + :type file: bytearray :param packed_password: :type packed_password: str :param force_overwrite: @@ -4973,7 +4973,7 @@ def _upload_file_serialize( if upload_file_type is not None: _form_params.append(('upload_file_type', upload_file_type)) if file is not None: - _form_params.append(('file', file)) + _files['file'] = file if force_overwrite is not None: _form_params.append(('force_overwrite', force_overwrite)) # process the body parameter diff --git a/revengai/api/strings_api.py b/revengai/api/strings_api.py new file mode 100644 index 0000000..49254f9 --- /dev/null +++ b/revengai/api/strings_api.py @@ -0,0 +1,641 @@ +# 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 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field +from typing import Any, Dict +from typing_extensions import Annotated +from revengai.models.add_user_string_input_body import AddUserStringInputBody +from revengai.models.add_user_string_to_function_input_body import AddUserStringToFunctionInputBody + +from revengai.api_client import ApiClient, RequestSerialized +from revengai.api_response import ApiResponse +from revengai.rest import RESTResponseType + + +class StringsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def add_user_string_to_analysis( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + add_user_string_input_body: AddUserStringInputBody, + _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, + ) -> Dict[str, object]: + """Add a user-provided string to an analysis. + + Attaches a user-provided string to an analysis at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during 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 add_user_string_input_body: (required) + :type add_user_string_input_body: AddUserStringInputBody + :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._add_user_string_to_analysis_serialize( + analysis_id=analysis_id, + add_user_string_input_body=add_user_string_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 add_user_string_to_analysis_with_http_info( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + add_user_string_input_body: AddUserStringInputBody, + _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[Dict[str, object]]: + """Add a user-provided string to an analysis. + + Attaches a user-provided string to an analysis at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during 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 add_user_string_input_body: (required) + :type add_user_string_input_body: AddUserStringInputBody + :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._add_user_string_to_analysis_serialize( + analysis_id=analysis_id, + add_user_string_input_body=add_user_string_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 add_user_string_to_analysis_without_preload_content( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + add_user_string_input_body: AddUserStringInputBody, + _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: + """Add a user-provided string to an analysis. + + Attaches a user-provided string to an analysis at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during 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 add_user_string_input_body: (required) + :type add_user_string_input_body: AddUserStringInputBody + :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._add_user_string_to_analysis_serialize( + analysis_id=analysis_id, + add_user_string_input_body=add_user_string_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 _add_user_string_to_analysis_serialize( + self, + analysis_id, + add_user_string_input_body, + _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 + if add_user_string_input_body is not None: + _body_params = add_user_string_input_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # 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] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/analyses/{analysis_id}/user-provided-strings', + 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 add_user_string_to_function( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + add_user_string_to_function_input_body: AddUserStringToFunctionInputBody, + _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, + ) -> Dict[str, object]: + """Add a user-provided string to a function. + + Attaches a user-provided string to a function at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param function_id: Function ID (required) + :type function_id: int + :param add_user_string_to_function_input_body: (required) + :type add_user_string_to_function_input_body: AddUserStringToFunctionInputBody + :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._add_user_string_to_function_serialize( + function_id=function_id, + add_user_string_to_function_input_body=add_user_string_to_function_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 add_user_string_to_function_with_http_info( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + add_user_string_to_function_input_body: AddUserStringToFunctionInputBody, + _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[Dict[str, object]]: + """Add a user-provided string to a function. + + Attaches a user-provided string to a function at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param function_id: Function ID (required) + :type function_id: int + :param add_user_string_to_function_input_body: (required) + :type add_user_string_to_function_input_body: AddUserStringToFunctionInputBody + :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._add_user_string_to_function_serialize( + function_id=function_id, + add_user_string_to_function_input_body=add_user_string_to_function_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 add_user_string_to_function_without_preload_content( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + add_user_string_to_function_input_body: AddUserStringToFunctionInputBody, + _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: + """Add a user-provided string to a function. + + Attaches a user-provided string to a function at the given virtual address. The string is stored with source `USER` and complements strings discovered automatically during analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param function_id: Function ID (required) + :type function_id: int + :param add_user_string_to_function_input_body: (required) + :type add_user_string_to_function_input_body: AddUserStringToFunctionInputBody + :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._add_user_string_to_function_serialize( + function_id=function_id, + add_user_string_to_function_input_body=add_user_string_to_function_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "Dict[str, object]", + '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 _add_user_string_to_function_serialize( + self, + function_id, + add_user_string_to_function_input_body, + _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 function_id is not None: + _path_params['function_id'] = function_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if add_user_string_to_function_input_body is not None: + _body_params = add_user_string_to_function_input_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # 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] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/functions/{function_id}/user-provided-strings', + 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 + ) + + diff --git a/revengai/api_client.py b/revengai/api_client.py index 315519f..1f356be 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/v3.85.1/python' + self.user_agent = 'OpenAPI-Generator/v3.86.3/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 739aa3f..e654645 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -533,8 +533,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v3.85.1\n"\ - "SDK Package Version: v3.85.1".\ + "Version of the API: v3.86.3\n"\ + "SDK Package Version: v3.86.3".\ 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 12c34e3..67828c0 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -13,6 +13,8 @@ # import models into model package from revengai.models.api_error import APIError +from revengai.models.add_user_string_input_body import AddUserStringInputBody +from revengai.models.add_user_string_to_function_input_body import AddUserStringToFunctionInputBody from revengai.models.additional_details_status_response import AdditionalDetailsStatusResponse from revengai.models.addr import Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating @@ -218,6 +220,7 @@ from revengai.models.event_warning import EventWarning from revengai.models.export_model import ExportModel from revengai.models.external_response import ExternalResponse +from revengai.models.extracted_file_entry import ExtractedFileEntry from revengai.models.extracted_url import ExtractedURL from revengai.models.file_activity_entry import FileActivityEntry from revengai.models.file_format import FileFormat @@ -303,6 +306,7 @@ from revengai.models.patch_comment_body import PatchCommentBody from revengai.models.platform import Platform from revengai.models.process_activity_entry import ProcessActivityEntry +from revengai.models.process_extracted_files import ProcessExtractedFiles from revengai.models.process_memdumps import ProcessMemdumps from revengai.models.process_node import ProcessNode from revengai.models.process_tree import ProcessTree diff --git a/revengai/models/add_user_string_input_body.py b/revengai/models/add_user_string_input_body.py new file mode 100644 index 0000000..7206911 --- /dev/null +++ b/revengai/models/add_user_string_input_body.py @@ -0,0 +1,102 @@ +# 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 +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class AddUserStringInputBody(BaseModel): + """ + AddUserStringInputBody + """ # noqa: E501 + string: Annotated[str, Field(min_length=1, strict=True)] = Field(description="String literal") + virtual_address: Annotated[int, Field(strict=True, ge=0)] = Field(description="Virtual address at which this string is defined.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["string", "virtual_address"] + + 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 AddUserStringInputBody 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 AddUserStringInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "string": obj.get("string"), + "virtual_address": obj.get("virtual_address") + }) + # 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/add_user_string_to_function_input_body.py b/revengai/models/add_user_string_to_function_input_body.py new file mode 100644 index 0000000..dde8b9d --- /dev/null +++ b/revengai/models/add_user_string_to_function_input_body.py @@ -0,0 +1,102 @@ +# 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 +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class AddUserStringToFunctionInputBody(BaseModel): + """ + AddUserStringToFunctionInputBody + """ # noqa: E501 + string: Annotated[str, Field(min_length=1, strict=True)] = Field(description="String literal") + virtual_address: Annotated[int, Field(strict=True, ge=0)] = Field(description="Virtual address at which this string is defined.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["string", "virtual_address"] + + 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 AddUserStringToFunctionInputBody 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 AddUserStringToFunctionInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "string": obj.get("string"), + "virtual_address": obj.get("virtual_address") + }) + # 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/analysis_report.py b/revengai/models/analysis_report.py index 86f3996..b3a2587 100644 --- a/revengai/models/analysis_report.py +++ b/revengai/models/analysis_report.py @@ -23,6 +23,7 @@ from revengai.models.mutex_entry import MutexEntry from revengai.models.network_activity import NetworkActivity from revengai.models.process_activity_entry import ProcessActivityEntry +from revengai.models.process_extracted_files import ProcessExtractedFiles from revengai.models.process_memdumps import ProcessMemdumps from revengai.models.process_tree import ProcessTree from revengai.models.registry_operation import RegistryOperation @@ -38,6 +39,7 @@ class AnalysisReport(BaseModel): """ AnalysisReport """ # noqa: E501 + extracted_files: Optional[List[ProcessExtractedFiles]] = None file_activity: Optional[List[FileActivityEntry]] = None info: ReportInfo memdumps: Optional[List[ProcessMemdumps]] = None @@ -53,7 +55,7 @@ class AnalysisReport(BaseModel): threat_score: StrictInt ttps: Optional[List[Ttp]] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["file_activity", "info", "memdumps", "module_load_addresses", "mutexes", "network_activity", "process_activity", "process_tree", "registry_operations", "scheduled_tasks", "services", "startup", "threat_score", "ttps"] + __properties: ClassVar[List[str]] = ["extracted_files", "file_activity", "info", "memdumps", "module_load_addresses", "mutexes", "network_activity", "process_activity", "process_tree", "registry_operations", "scheduled_tasks", "services", "startup", "threat_score", "ttps"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +98,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in extracted_files (list) + _items = [] + if self.extracted_files: + for _item_extracted_files in self.extracted_files: + if _item_extracted_files: + _items.append(_item_extracted_files.to_dict()) + _dict['extracted_files'] = _items # override the default output from pydantic by calling `to_dict()` of each item in file_activity (list) _items = [] if self.file_activity: @@ -176,6 +185,11 @@ def to_dict(self) -> Dict[str, Any]: for _key, _value in self.additional_properties.items(): _dict[_key] = _value + # set to None if extracted_files (nullable) is None + # and model_fields_set contains the field + if self.extracted_files is None and "extracted_files" in self.model_fields_set: + _dict['extracted_files'] = None + # set to None if file_activity (nullable) is None # and model_fields_set contains the field if self.file_activity is None and "file_activity" in self.model_fields_set: @@ -233,6 +247,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "extracted_files": [ProcessExtractedFiles.from_dict(_item) for _item in obj["extracted_files"]] if obj.get("extracted_files") is not None else None, "file_activity": [FileActivityEntry.from_dict(_item) for _item in obj["file_activity"]] if obj.get("file_activity") is not None else None, "info": ReportInfo.from_dict(obj["info"]) if obj.get("info") is not None else None, "memdumps": [ProcessMemdumps.from_dict(_item) for _item in obj["memdumps"]] if obj.get("memdumps") is not None else None, diff --git a/revengai/models/elf_relocation.py b/revengai/models/elf_relocation.py index a9eefc3..1156b91 100644 --- a/revengai/models/elf_relocation.py +++ b/revengai/models/elf_relocation.py @@ -17,7 +17,7 @@ import json from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self @@ -32,7 +32,8 @@ class ELFRelocation(BaseModel): symbol_name: StrictStr is_dynamic: StrictBool is_pltgot: StrictBool - __properties: ClassVar[List[str]] = ["address", "type", "size", "addend", "symbol_name", "is_dynamic", "is_pltgot"] + is_unicode_symbol_name: Optional[StrictBool] = True + __properties: ClassVar[List[str]] = ["address", "type", "size", "addend", "symbol_name", "is_dynamic", "is_pltgot", "is_unicode_symbol_name"] model_config = ConfigDict( populate_by_name=True, @@ -91,7 +92,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "addend": obj.get("addend"), "symbol_name": obj.get("symbol_name"), "is_dynamic": obj.get("is_dynamic"), - "is_pltgot": obj.get("is_pltgot") + "is_pltgot": obj.get("is_pltgot"), + "is_unicode_symbol_name": obj.get("is_unicode_symbol_name") if obj.get("is_unicode_symbol_name") is not None else True }) return _obj diff --git a/revengai/models/elf_symbol.py b/revengai/models/elf_symbol.py index 4d0afdb..077dae3 100644 --- a/revengai/models/elf_symbol.py +++ b/revengai/models/elf_symbol.py @@ -16,8 +16,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self @@ -32,7 +32,8 @@ class ELFSymbol(BaseModel): binding: StrictStr visibility: StrictStr section_index: StrictInt - __properties: ClassVar[List[str]] = ["name", "value", "size", "type", "binding", "visibility", "section_index"] + is_unicode_name: Optional[StrictBool] = True + __properties: ClassVar[List[str]] = ["name", "value", "size", "type", "binding", "visibility", "section_index", "is_unicode_name"] model_config = ConfigDict( populate_by_name=True, @@ -91,7 +92,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "binding": obj.get("binding"), "visibility": obj.get("visibility"), - "section_index": obj.get("section_index") + "section_index": obj.get("section_index"), + "is_unicode_name": obj.get("is_unicode_name") if obj.get("is_unicode_name") is not None else True }) return _obj diff --git a/revengai/models/extracted_file_entry.py b/revengai/models/extracted_file_entry.py new file mode 100644 index 0000000..f4fbf4c --- /dev/null +++ b/revengai/models/extracted_file_entry.py @@ -0,0 +1,152 @@ +# 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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ExtractedFileEntry(BaseModel): + """ + ExtractedFileEntry + """ # noqa: E501 + file_hash: Optional[StrictStr] = None + file_size: StrictInt + file_type: Optional[StrictStr] = None + filename: Optional[StrictStr] + is_pe: Optional[StrictBool] = None + mime_type: Optional[StrictStr] = None + reason: Optional[StrictStr] = None + seq_num: StrictInt + sha256: Optional[StrictStr] = None + zip_filename: Optional[StrictStr] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["file_hash", "file_size", "file_type", "filename", "is_pe", "mime_type", "reason", "seq_num", "sha256", "zip_filename"] + + 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 ExtractedFileEntry 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 file_hash (nullable) is None + # and model_fields_set contains the field + if self.file_hash is None and "file_hash" in self.model_fields_set: + _dict['file_hash'] = None + + # set to None if file_type (nullable) is None + # and model_fields_set contains the field + if self.file_type is None and "file_type" in self.model_fields_set: + _dict['file_type'] = None + + # set to None if filename (nullable) is None + # and model_fields_set contains the field + if self.filename is None and "filename" in self.model_fields_set: + _dict['filename'] = None + + # set to None if mime_type (nullable) is None + # and model_fields_set contains the field + if self.mime_type is None and "mime_type" in self.model_fields_set: + _dict['mime_type'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if sha256 (nullable) is None + # and model_fields_set contains the field + if self.sha256 is None and "sha256" in self.model_fields_set: + _dict['sha256'] = None + + # set to None if zip_filename (nullable) is None + # and model_fields_set contains the field + if self.zip_filename is None and "zip_filename" in self.model_fields_set: + _dict['zip_filename'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExtractedFileEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file_hash": obj.get("file_hash"), + "file_size": obj.get("file_size"), + "file_type": obj.get("file_type"), + "filename": obj.get("filename"), + "is_pe": obj.get("is_pe"), + "mime_type": obj.get("mime_type"), + "reason": obj.get("reason"), + "seq_num": obj.get("seq_num"), + "sha256": obj.get("sha256"), + "zip_filename": obj.get("zip_filename") + }) + # 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/process_extracted_files.py b/revengai/models/process_extracted_files.py new file mode 100644 index 0000000..aaaf84f --- /dev/null +++ b/revengai/models/process_extracted_files.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, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.extracted_file_entry import ExtractedFileEntry +from typing import Optional, Set +from typing_extensions import Self + +class ProcessExtractedFiles(BaseModel): + """ + ProcessExtractedFiles + """ # noqa: E501 + files: Optional[List[ExtractedFileEntry]] = None + process_seqid: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["files", "process_seqid"] + + 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 ProcessExtractedFiles 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 files (list) + _items = [] + if self.files: + for _item_files in self.files: + if _item_files: + _items.append(_item_files.to_dict()) + _dict['files'] = _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 files (nullable) is None + # and model_fields_set contains the field + if self.files is None and "files" in self.model_fields_set: + _dict['files'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProcessExtractedFiles from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "files": [ExtractedFileEntry.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None, + "process_seqid": obj.get("process_seqid") + }) + # 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 + +