diff --git a/.sdk-version b/.sdk-version index 494f957..1b4d851 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v1.81.2 +v1.84.0 diff --git a/README.md b/README.md index 9207fb6..866a5fe 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,6 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**get_function_details**](docs/FunctionsCoreApi.md#get_function_details) | **GET** /v2/functions/{function_id} | Get function details *FunctionsCoreApi* | [**get_function_strings**](docs/FunctionsCoreApi.md#get_function_strings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function *FunctionsCoreApi* | [**get_similar_functions**](docs/FunctionsCoreApi.md#get_similar_functions) | **GET** /v2/functions/{function_id}/similar-functions | Get list of similar functions -*FunctionsCoreApi* | [**unstrip**](docs/FunctionsCoreApi.md#unstrip) | **POST** /v2/analyses/{analysis_id}/functions/unstrip | Performs matching and auto-unstrip for an analysis and its functions *FunctionsDataTypesApi* | [**generate_function_data_types_for_analysis**](docs/FunctionsDataTypesApi.md#generate_function_data_types_for_analysis) | **POST** /v2/analyses/{analysis_id}/functions/data_types | Generate Function Data Types *FunctionsDataTypesApi* | [**generate_function_data_types_for_functions**](docs/FunctionsDataTypesApi.md#generate_function_data_types_for_functions) | **POST** /v2/functions/data_types | Generate Function Data Types for an arbitrary list of functions *FunctionsDataTypesApi* | [**get_function_data_types**](docs/FunctionsDataTypesApi.md#get_function_data_types) | **GET** /v2/analyses/{analysis_id}/functions/{function_id}/data_types | Get Function Data Types @@ -188,7 +187,6 @@ Class | Method | HTTP request | Description - [AppServicesBinaryAnnSchemaTagItem](docs/AppServicesBinaryAnnSchemaTagItem.md) - [AppServicesDynamicExecutionSchemasDynamicExecutionStatus](docs/AppServicesDynamicExecutionSchemasDynamicExecutionStatus.md) - [Argument](docs/Argument.md) - - [AutoUnstripByGroupResponse](docs/AutoUnstripByGroupResponse.md) - [AutoUnstripRequest](docs/AutoUnstripRequest.md) - [AutoUnstripResponse](docs/AutoUnstripResponse.md) - [BaseResponse](docs/BaseResponse.md) @@ -388,7 +386,6 @@ Class | Method | HTTP request | Description - [LoginRequest](docs/LoginRequest.md) - [LoginResponse](docs/LoginResponse.md) - [Logs](docs/Logs.md) - - [MatchedFunctionGroup](docs/MatchedFunctionGroup.md) - [MatchedFunctionSuggestion](docs/MatchedFunctionSuggestion.md) - [MetaModel](docs/MetaModel.md) - [ModelName](docs/ModelName.md) @@ -457,7 +454,6 @@ Class | Method | HTTP request | Description - [ThreatScoreFunctionBody](docs/ThreatScoreFunctionBody.md) - [TimestampModel](docs/TimestampModel.md) - [TypeDefinition](docs/TypeDefinition.md) - - [UnstripRequest](docs/UnstripRequest.md) - [UpdateFunctionDataTypes](docs/UpdateFunctionDataTypes.md) - [UploadFileType](docs/UploadFileType.md) - [UploadResponse](docs/UploadResponse.md) diff --git a/docs/AiDecompilationRating.md b/docs/AiDecompilationRating.md index 1578b5c..128413c 100644 --- a/docs/AiDecompilationRating.md +++ b/docs/AiDecompilationRating.md @@ -7,6 +7,8 @@ * `NEGATIVE` (value: `'NEGATIVE'`) +* `NEUTRAL` (value: `'NEUTRAL'`) + [[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 106db6c..3cdea58 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -771,7 +771,7 @@ 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) # **list_analyses** -> BaseResponseRecent list_analyses(search_term=search_term, workspace=workspace, status=status, model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, limit=limit, offset=offset, order_by=order_by, order=order, authorization=authorization) +> BaseResponseRecent list_analyses(search_term=search_term, workspace=workspace, status=status, model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, order=order, authorization=authorization) Gets the most recent analyses @@ -820,6 +820,7 @@ with revengai.ApiClient(configuration) as api_client: model_name = [revengai.ModelName()] # List[ModelName] | Show analysis belonging to the model (optional) dynamic_execution_status = revengai.DynamicExecutionStatusInput() # DynamicExecutionStatusInput | Show analysis that have a dynamic execution with the given status (optional) usernames = [] # List[Optional[str]] | Show analysis belonging to the user (optional) (default to []) + sha256_hash = 'sha256_hash_example' # str | (optional) limit = 20 # int | (optional) (default to 20) offset = 0 # int | (optional) (default to 0) order_by = revengai.AppApiRestV2AnalysesEnumsOrderBy() # AppApiRestV2AnalysesEnumsOrderBy | (optional) @@ -828,7 +829,7 @@ with revengai.ApiClient(configuration) as api_client: try: # Gets the most recent analyses - api_response = api_instance.list_analyses(search_term=search_term, workspace=workspace, status=status, model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, limit=limit, offset=offset, order_by=order_by, order=order, authorization=authorization) + api_response = api_instance.list_analyses(search_term=search_term, workspace=workspace, status=status, model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, order=order, authorization=authorization) print("The response of AnalysesCoreApi->list_analyses:\n") pprint(api_response) except Exception as e: @@ -848,6 +849,7 @@ Name | Type | Description | Notes **model_name** | [**List[ModelName]**](ModelName.md)| Show analysis belonging to the model | [optional] **dynamic_execution_status** | [**DynamicExecutionStatusInput**](.md)| Show analysis that have a dynamic execution with the given status | [optional] **usernames** | [**List[Optional[str]]**](str.md)| Show analysis belonging to the user | [optional] [default to []] + **sha256_hash** | **str**| | [optional] **limit** | **int**| | [optional] [default to 20] **offset** | **int**| | [optional] [default to 0] **order_by** | [**AppApiRestV2AnalysesEnumsOrderBy**](.md)| | [optional] diff --git a/docs/AnalysisRecord.md b/docs/AnalysisRecord.md index 8ee9ddd..aa71cd8 100644 --- a/docs/AnalysisRecord.md +++ b/docs/AnalysisRecord.md @@ -9,15 +9,18 @@ Name | Type | Description | Notes **analysis_scope** | **str** | Scope of the analysis | **binary_id** | **int** | ID to identify the binary analyse | **model_id** | **int** | ID to identify the model used for analysis | +**model_name** | **str** | Name of the model used for analysis | **status** | **str** | The current status of analysis | **creation** | **datetime** | The current status of analysis | **is_owner** | **bool** | Whether the current user is the owner of a binary | **binary_name** | **str** | The name of the file uploaded | **sha_256_hash** | **str** | The hash of the binary | +**function_boundaries_hash** | **str** | The hash of the function boundaries | **binary_size** | **int** | The size of the binary | **username** | **str** | The username of the analysis owner | **dynamic_execution_status** | [**AppApiRestV2AnalysesEnumsDynamicExecutionStatus**](AppApiRestV2AnalysesEnumsDynamicExecutionStatus.md) | | [optional] **dynamic_execution_task_id** | **int** | | [optional] +**base_address** | **int** | The base address of the binary | ## Example diff --git a/docs/AutoUnstripByGroupResponse.md b/docs/AutoUnstripByGroupResponse.md deleted file mode 100644 index ceefb9b..0000000 --- a/docs/AutoUnstripByGroupResponse.md +++ /dev/null @@ -1,33 +0,0 @@ -# AutoUnstripByGroupResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**progress** | **int** | Progress of the auto-unstrip operation, represented as a percentage | [optional] [default to 0] -**status** | **str** | | [optional] -**total_time** | **int** | | [optional] -**matches_map** | **Dict[str, List[MatchedFunctionGroup]]** | | [optional] -**applied** | **bool** | | [optional] - -## Example - -```python -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of AutoUnstripByGroupResponse from a JSON string -auto_unstrip_by_group_response_instance = AutoUnstripByGroupResponse.from_json(json) -# print the JSON string representation of the object -print(AutoUnstripByGroupResponse.to_json()) - -# convert the object into a dict -auto_unstrip_by_group_response_dict = auto_unstrip_by_group_response_instance.to_dict() -# create an instance of AutoUnstripByGroupResponse from a dict -auto_unstrip_by_group_response_from_dict = AutoUnstripByGroupResponse.from_dict(auto_unstrip_by_group_response_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/FunctionsAIDecompilationApi.md b/docs/FunctionsAIDecompilationApi.md index 1b24886..ac002ab 100644 --- a/docs/FunctionsAIDecompilationApi.md +++ b/docs/FunctionsAIDecompilationApi.md @@ -769,7 +769,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successful Response | - | +**201** | Successful Response | - | **422** | Invalid request parameters | - | [[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/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index adbfe4f..da269a9 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -15,7 +15,6 @@ Method | HTTP request | Description [**get_function_details**](FunctionsCoreApi.md#get_function_details) | **GET** /v2/functions/{function_id} | Get function details [**get_function_strings**](FunctionsCoreApi.md#get_function_strings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function [**get_similar_functions**](FunctionsCoreApi.md#get_similar_functions) | **GET** /v2/functions/{function_id}/similar-functions | Get list of similar functions -[**unstrip**](FunctionsCoreApi.md#unstrip) | **POST** /v2/analyses/{analysis_id}/functions/unstrip | Performs matching and auto-unstrip for an analysis and its functions # **ai_unstrip** @@ -946,88 +945,3 @@ 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) -# **unstrip** -> AutoUnstripByGroupResponse unstrip(analysis_id, unstrip_request, authorization=authorization) - -Performs matching and auto-unstrip for an analysis and its functions - -Takes in the analysis ID, uses the functions ID's from it and settings to find the nearest function groups for each function that's within the system - -### Example - -* Api Key Authentication (APIKey): - -```python -import revengai -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse -from revengai.models.unstrip_request import UnstripRequest -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.FunctionsCoreApi(api_client) - analysis_id = 56 # int | - unstrip_request = revengai.UnstripRequest() # UnstripRequest | - authorization = 'authorization_example' # str | API Key bearer token (optional) - - try: - # Performs matching and auto-unstrip for an analysis and its functions - api_response = api_instance.unstrip(analysis_id, unstrip_request, authorization=authorization) - print("The response of FunctionsCoreApi->unstrip:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FunctionsCoreApi->unstrip: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **analysis_id** | **int**| | - **unstrip_request** | [**UnstripRequest**](UnstripRequest.md)| | - **authorization** | **str**| API Key bearer token | [optional] - -### Return type - -[**AutoUnstripByGroupResponse**](AutoUnstripByGroupResponse.md) - -### Authorization - -[APIKey](../README.md#APIKey) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Invalid request parameters | - | - -[[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/docs/GetAiDecompilationRatingResponse.md b/docs/GetAiDecompilationRatingResponse.md index 29f84f0..649dbb9 100644 --- a/docs/GetAiDecompilationRatingResponse.md +++ b/docs/GetAiDecompilationRatingResponse.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **rating** | [**AiDecompilationRating**](AiDecompilationRating.md) | The rating the user has given to the AI decompilation response | +**reason** | **str** | | ## Example diff --git a/docs/MatchedFunctionGroup.md b/docs/MatchedFunctionGroup.md deleted file mode 100644 index 7659291..0000000 --- a/docs/MatchedFunctionGroup.md +++ /dev/null @@ -1,30 +0,0 @@ -# MatchedFunctionGroup - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**function_group_name** | **str** | Name of the function group that contains the matched functions | -**similarity** | **float** | Similarity score of the match | - -## Example - -```python -from revengai.models.matched_function_group import MatchedFunctionGroup - -# TODO update the JSON string below -json = "{}" -# create an instance of MatchedFunctionGroup from a JSON string -matched_function_group_instance = MatchedFunctionGroup.from_json(json) -# print the JSON string representation of the object -print(MatchedFunctionGroup.to_json()) - -# convert the object into a dict -matched_function_group_dict = matched_function_group_instance.to_dict() -# create an instance of MatchedFunctionGroup from a dict -matched_function_group_from_dict = MatchedFunctionGroup.from_dict(matched_function_group_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/MatchedFunctionSuggestion.md b/docs/MatchedFunctionSuggestion.md index 087cf92..a0a2888 100644 --- a/docs/MatchedFunctionSuggestion.md +++ b/docs/MatchedFunctionSuggestion.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **function_id** | **int** | Unique identifier of the matched function | -**function_vaddr** | **int** | | +**function_vaddr** | **int** | Virtual address of the matched function | **suggested_name** | **str** | Name of the function group that contains the matched functions | ## Example diff --git a/docs/UnstripRequest.md b/docs/UnstripRequest.md deleted file mode 100644 index 93eaf1d..0000000 --- a/docs/UnstripRequest.md +++ /dev/null @@ -1,31 +0,0 @@ -# UnstripRequest - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**min_similarity** | **float** | Minimum similarity expected for a match, default is 0.9 | [optional] [default to 0.9] -**limit** | **int** | Maximum number of matches to return, default is 1, maximum is 10 | [optional] [default to 1] -**apply** | **bool** | Whether to apply the matched function names to the target binary, default is False | [optional] [default to False] - -## Example - -```python -from revengai.models.unstrip_request import UnstripRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of UnstripRequest from a JSON string -unstrip_request_instance = UnstripRequest.from_json(json) -# print the JSON string representation of the object -print(UnstripRequest.to_json()) - -# convert the object into a dict -unstrip_request_dict = unstrip_request_instance.to_dict() -# create an instance of UnstripRequest from a dict -unstrip_request_from_dict = UnstripRequest.from_dict(unstrip_request_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/UpsertAiDecomplationRatingRequest.md b/docs/UpsertAiDecomplationRatingRequest.md index b0ca16b..bf816dd 100644 --- a/docs/UpsertAiDecomplationRatingRequest.md +++ b/docs/UpsertAiDecomplationRatingRequest.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **rating** | [**AiDecompilationRating**](AiDecompilationRating.md) | The rating for the AI decompilation response | +**reason** | **str** | | ## Example diff --git a/revengai/__init__.py b/revengai/__init__.py index e447009..6b49fdb 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v1.81.2" +__version__ = "v1.84.0" # Define package exports __all__ = [ @@ -74,7 +74,6 @@ "AppServicesBinaryAnnSchemaTagItem", "AppServicesDynamicExecutionSchemasDynamicExecutionStatus", "Argument", - "AutoUnstripByGroupResponse", "AutoUnstripRequest", "AutoUnstripResponse", "BaseResponse", @@ -274,7 +273,6 @@ "LoginRequest", "LoginResponse", "Logs", - "MatchedFunctionGroup", "MatchedFunctionSuggestion", "MetaModel", "ModelName", @@ -343,7 +341,6 @@ "ThreatScoreFunctionBody", "TimestampModel", "TypeDefinition", - "UnstripRequest", "UpdateFunctionDataTypes", "UploadFileType", "UploadResponse", @@ -417,7 +414,6 @@ from revengai.models.app_services_binary_ann_schema_tag_item import AppServicesBinaryAnnSchemaTagItem as AppServicesBinaryAnnSchemaTagItem from revengai.models.app_services_dynamic_execution_schemas_dynamic_execution_status import AppServicesDynamicExecutionSchemasDynamicExecutionStatus as AppServicesDynamicExecutionSchemasDynamicExecutionStatus from revengai.models.argument import Argument as Argument -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse as AutoUnstripByGroupResponse from revengai.models.auto_unstrip_request import AutoUnstripRequest as AutoUnstripRequest from revengai.models.auto_unstrip_response import AutoUnstripResponse as AutoUnstripResponse from revengai.models.base_response import BaseResponse as BaseResponse @@ -617,7 +613,6 @@ from revengai.models.login_request import LoginRequest as LoginRequest from revengai.models.login_response import LoginResponse as LoginResponse from revengai.models.logs import Logs as Logs -from revengai.models.matched_function_group import MatchedFunctionGroup as MatchedFunctionGroup from revengai.models.matched_function_suggestion import MatchedFunctionSuggestion as MatchedFunctionSuggestion from revengai.models.meta_model import MetaModel as MetaModel from revengai.models.model_name import ModelName as ModelName @@ -686,7 +681,6 @@ from revengai.models.threat_score_function_body import ThreatScoreFunctionBody as ThreatScoreFunctionBody from revengai.models.timestamp_model import TimestampModel as TimestampModel from revengai.models.type_definition import TypeDefinition as TypeDefinition -from revengai.models.unstrip_request import UnstripRequest as UnstripRequest from revengai.models.update_function_data_types import UpdateFunctionDataTypes as UpdateFunctionDataTypes from revengai.models.upload_file_type import UploadFileType as UploadFileType from revengai.models.upload_response import UploadResponse as UploadResponse diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index ca95655..2de7a97 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -2665,6 +2665,7 @@ def list_analyses( model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, dynamic_execution_status: Annotated[Optional[DynamicExecutionStatusInput], Field(description="Show analysis that have a dynamic execution with the given status")] = None, usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, offset: Optional[StrictInt] = None, order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, @@ -2699,6 +2700,8 @@ def list_analyses( :type dynamic_execution_status: DynamicExecutionStatusInput :param usernames: Show analysis belonging to the user :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str :param limit: :type limit: int :param offset: @@ -2738,6 +2741,7 @@ def list_analyses( model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, + sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, @@ -2773,6 +2777,7 @@ def list_analyses_with_http_info( model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, dynamic_execution_status: Annotated[Optional[DynamicExecutionStatusInput], Field(description="Show analysis that have a dynamic execution with the given status")] = None, usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, offset: Optional[StrictInt] = None, order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, @@ -2807,6 +2812,8 @@ def list_analyses_with_http_info( :type dynamic_execution_status: DynamicExecutionStatusInput :param usernames: Show analysis belonging to the user :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str :param limit: :type limit: int :param offset: @@ -2846,6 +2853,7 @@ def list_analyses_with_http_info( model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, + sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, @@ -2881,6 +2889,7 @@ def list_analyses_without_preload_content( model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, dynamic_execution_status: Annotated[Optional[DynamicExecutionStatusInput], Field(description="Show analysis that have a dynamic execution with the given status")] = None, usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, offset: Optional[StrictInt] = None, order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, @@ -2915,6 +2924,8 @@ def list_analyses_without_preload_content( :type dynamic_execution_status: DynamicExecutionStatusInput :param usernames: Show analysis belonging to the user :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str :param limit: :type limit: int :param offset: @@ -2954,6 +2965,7 @@ def list_analyses_without_preload_content( model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, + sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, @@ -2984,6 +2996,7 @@ def _list_analyses_serialize( model_name, dynamic_execution_status, usernames, + sha256_hash, limit, offset, order_by, @@ -3039,6 +3052,10 @@ def _list_analyses_serialize( _query_params.append(('usernames', usernames)) + if sha256_hash is not None: + + _query_params.append(('sha256_hash', sha256_hash)) + if limit is not None: _query_params.append(('limit', limit)) diff --git a/revengai/api/functions_ai_decompilation_api.py b/revengai/api/functions_ai_decompilation_api.py index a1f7754..8fdfd22 100644 --- a/revengai/api/functions_ai_decompilation_api.py +++ b/revengai/api/functions_ai_decompilation_api.py @@ -2484,7 +2484,7 @@ def upsert_ai_decompilation_rating( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponse", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -2559,7 +2559,7 @@ def upsert_ai_decompilation_rating_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponse", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -2634,7 +2634,7 @@ def upsert_ai_decompilation_rating_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponse", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( diff --git a/revengai/api/functions_core_api.py b/revengai/api/functions_core_api.py index 7b90187..170b9b3 100644 --- a/revengai/api/functions_core_api.py +++ b/revengai/api/functions_core_api.py @@ -19,7 +19,6 @@ from typing import List, Optional, Union from typing_extensions import Annotated from revengai.models.ai_unstrip_request import AiUnstripRequest -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse from revengai.models.auto_unstrip_request import AutoUnstripRequest from revengai.models.auto_unstrip_response import AutoUnstripResponse from revengai.models.base_response_analysis_strings_response import BaseResponseAnalysisStringsResponse @@ -29,7 +28,6 @@ from revengai.models.base_response_function_strings_response import BaseResponseFunctionStringsResponse from revengai.models.base_response_functions_detail_response import BaseResponseFunctionsDetailResponse from revengai.models.base_response_list_similar_functions_response import BaseResponseListSimilarFunctionsResponse -from revengai.models.unstrip_request import UnstripRequest from revengai.api_client import ApiClient, RequestSerialized from revengai.api_response import ApiResponse @@ -3390,310 +3388,3 @@ def _get_similar_functions_serialize( ) - - - @validate_call - def unstrip( - self, - analysis_id: StrictInt, - unstrip_request: UnstripRequest, - authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, - _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, - ) -> AutoUnstripByGroupResponse: - """Performs matching and auto-unstrip for an analysis and its functions - - Takes in the analysis ID, uses the functions ID's from it and settings to find the nearest function groups for each function that's within the system - - :param analysis_id: (required) - :type analysis_id: int - :param unstrip_request: (required) - :type unstrip_request: UnstripRequest - :param authorization: API Key bearer token - :type authorization: str - :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._unstrip_serialize( - analysis_id=analysis_id, - unstrip_request=unstrip_request, - authorization=authorization, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "AutoUnstripByGroupResponse", - '422': "BaseResponse", - } - 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 unstrip_with_http_info( - self, - analysis_id: StrictInt, - unstrip_request: UnstripRequest, - authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, - _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[AutoUnstripByGroupResponse]: - """Performs matching and auto-unstrip for an analysis and its functions - - Takes in the analysis ID, uses the functions ID's from it and settings to find the nearest function groups for each function that's within the system - - :param analysis_id: (required) - :type analysis_id: int - :param unstrip_request: (required) - :type unstrip_request: UnstripRequest - :param authorization: API Key bearer token - :type authorization: str - :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._unstrip_serialize( - analysis_id=analysis_id, - unstrip_request=unstrip_request, - authorization=authorization, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "AutoUnstripByGroupResponse", - '422': "BaseResponse", - } - 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 unstrip_without_preload_content( - self, - analysis_id: StrictInt, - unstrip_request: UnstripRequest, - authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, - _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: - """Performs matching and auto-unstrip for an analysis and its functions - - Takes in the analysis ID, uses the functions ID's from it and settings to find the nearest function groups for each function that's within the system - - :param analysis_id: (required) - :type analysis_id: int - :param unstrip_request: (required) - :type unstrip_request: UnstripRequest - :param authorization: API Key bearer token - :type authorization: str - :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._unstrip_serialize( - analysis_id=analysis_id, - unstrip_request=unstrip_request, - authorization=authorization, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "AutoUnstripByGroupResponse", - '422': "BaseResponse", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _unstrip_serialize( - self, - analysis_id, - unstrip_request, - authorization, - _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 - if authorization is not None: - _header_params['authorization'] = authorization - # process the form parameters - # process the body parameter - if unstrip_request is not None: - _body_params = unstrip_request - - - # 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='/v2/analyses/{analysis_id}/functions/unstrip', - 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 65a52bf..2835e33 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/v1.81.2/python' + self.user_agent = 'OpenAPI-Generator/v1.84.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 2dba4df..f3278fd 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -529,8 +529,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v1.81.2\n"\ - "SDK Package Version: v1.81.2".\ + "Version of the API: v1.84.0\n"\ + "SDK Package Version: v1.84.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 c489150..7a58dda 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -40,7 +40,6 @@ from revengai.models.app_services_binary_ann_schema_tag_item import AppServicesBinaryAnnSchemaTagItem from revengai.models.app_services_dynamic_execution_schemas_dynamic_execution_status import AppServicesDynamicExecutionSchemasDynamicExecutionStatus from revengai.models.argument import Argument -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse from revengai.models.auto_unstrip_request import AutoUnstripRequest from revengai.models.auto_unstrip_response import AutoUnstripResponse from revengai.models.base_response import BaseResponse @@ -240,7 +239,6 @@ from revengai.models.login_request import LoginRequest from revengai.models.login_response import LoginResponse from revengai.models.logs import Logs -from revengai.models.matched_function_group import MatchedFunctionGroup from revengai.models.matched_function_suggestion import MatchedFunctionSuggestion from revengai.models.meta_model import MetaModel from revengai.models.model_name import ModelName @@ -309,7 +307,6 @@ from revengai.models.threat_score_function_body import ThreatScoreFunctionBody from revengai.models.timestamp_model import TimestampModel from revengai.models.type_definition import TypeDefinition -from revengai.models.unstrip_request import UnstripRequest from revengai.models.update_function_data_types import UpdateFunctionDataTypes from revengai.models.upload_file_type import UploadFileType from revengai.models.upload_response import UploadResponse diff --git a/revengai/models/ai_decompilation_rating.py b/revengai/models/ai_decompilation_rating.py index 8ccb8bf..2a49c40 100644 --- a/revengai/models/ai_decompilation_rating.py +++ b/revengai/models/ai_decompilation_rating.py @@ -27,6 +27,7 @@ class AiDecompilationRating(str, Enum): """ POSITIVE = 'POSITIVE' NEGATIVE = 'NEGATIVE' + NEUTRAL = 'NEUTRAL' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/revengai/models/analysis_record.py b/revengai/models/analysis_record.py index d342908..f44d11c 100644 --- a/revengai/models/analysis_record.py +++ b/revengai/models/analysis_record.py @@ -31,16 +31,19 @@ class AnalysisRecord(BaseModel): analysis_scope: StrictStr = Field(description="Scope of the analysis") binary_id: StrictInt = Field(description="ID to identify the binary analyse") model_id: StrictInt = Field(description="ID to identify the model used for analysis") + model_name: StrictStr = Field(description="Name of the model used for analysis") status: StrictStr = Field(description="The current status of analysis") creation: datetime = Field(description="The current status of analysis") is_owner: StrictBool = Field(description="Whether the current user is the owner of a binary") binary_name: StrictStr = Field(description="The name of the file uploaded") sha_256_hash: StrictStr = Field(description="The hash of the binary") + function_boundaries_hash: StrictStr = Field(description="The hash of the function boundaries") binary_size: StrictInt = Field(description="The size of the binary") username: StrictStr = Field(description="The username of the analysis owner") dynamic_execution_status: Optional[AppApiRestV2AnalysesEnumsDynamicExecutionStatus] = None dynamic_execution_task_id: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["analysis_id", "analysis_scope", "binary_id", "model_id", "status", "creation", "is_owner", "binary_name", "sha_256_hash", "binary_size", "username", "dynamic_execution_status", "dynamic_execution_task_id"] + base_address: StrictInt = Field(description="The base address of the binary") + __properties: ClassVar[List[str]] = ["analysis_id", "analysis_scope", "binary_id", "model_id", "model_name", "status", "creation", "is_owner", "binary_name", "sha_256_hash", "function_boundaries_hash", "binary_size", "username", "dynamic_execution_status", "dynamic_execution_task_id", "base_address"] model_config = ConfigDict( populate_by_name=True, @@ -107,15 +110,18 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "analysis_scope": obj.get("analysis_scope"), "binary_id": obj.get("binary_id"), "model_id": obj.get("model_id"), + "model_name": obj.get("model_name"), "status": obj.get("status"), "creation": obj.get("creation"), "is_owner": obj.get("is_owner"), "binary_name": obj.get("binary_name"), "sha_256_hash": obj.get("sha_256_hash"), + "function_boundaries_hash": obj.get("function_boundaries_hash"), "binary_size": obj.get("binary_size"), "username": obj.get("username"), "dynamic_execution_status": obj.get("dynamic_execution_status"), - "dynamic_execution_task_id": obj.get("dynamic_execution_task_id") + "dynamic_execution_task_id": obj.get("dynamic_execution_task_id"), + "base_address": obj.get("base_address") }) return _obj diff --git a/revengai/models/auto_unstrip_by_group_response.py b/revengai/models/auto_unstrip_by_group_response.py deleted file mode 100644 index 0566a2b..0000000 --- a/revengai/models/auto_unstrip_by_group_response.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - 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 revengai.models.matched_function_group import MatchedFunctionGroup -from typing import Optional, Set -from typing_extensions import Self - -class AutoUnstripByGroupResponse(BaseModel): - """ - AutoUnstripByGroupResponse - """ # noqa: E501 - progress: Optional[StrictInt] = Field(default=0, description="Progress of the auto-unstrip operation, represented as a percentage") - status: Optional[StrictStr] = None - total_time: Optional[StrictInt] = None - matches_map: Optional[Dict[str, List[MatchedFunctionGroup]]] = None - applied: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["progress", "status", "total_time", "matches_map", "applied"] - - 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 AutoUnstripByGroupResponse 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 each value in matches_map (dict of array) - _field_dict_of_array = {} - if self.matches_map: - for _key_matches_map in self.matches_map: - if self.matches_map[_key_matches_map] is not None: - _field_dict_of_array[_key_matches_map] = [ - _item.to_dict() for _item in self.matches_map[_key_matches_map] - ] - _dict['matches_map'] = _field_dict_of_array - # set to None if status (nullable) is None - # and model_fields_set contains the field - if self.status is None and "status" in self.model_fields_set: - _dict['status'] = None - - # set to None if total_time (nullable) is None - # and model_fields_set contains the field - if self.total_time is None and "total_time" in self.model_fields_set: - _dict['total_time'] = None - - # set to None if matches_map (nullable) is None - # and model_fields_set contains the field - if self.matches_map is None and "matches_map" in self.model_fields_set: - _dict['matches_map'] = None - - # set to None if applied (nullable) is None - # and model_fields_set contains the field - if self.applied is None and "applied" in self.model_fields_set: - _dict['applied'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AutoUnstripByGroupResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "progress": obj.get("progress") if obj.get("progress") is not None else 0, - "status": obj.get("status"), - "total_time": obj.get("total_time"), - "matches_map": dict( - (_k, - [MatchedFunctionGroup.from_dict(_item) for _item in _v] - if _v is not None - else None - ) - for _k, _v in obj.get("matches_map", {}).items() - ), - "applied": obj.get("applied") - }) - return _obj - - diff --git a/revengai/models/get_ai_decompilation_rating_response.py b/revengai/models/get_ai_decompilation_rating_response.py index fb639ad..fab0cdb 100644 --- a/revengai/models/get_ai_decompilation_rating_response.py +++ b/revengai/models/get_ai_decompilation_rating_response.py @@ -16,8 +16,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from revengai.models.ai_decompilation_rating import AiDecompilationRating from typing import Optional, Set from typing_extensions import Self @@ -27,7 +27,8 @@ class GetAiDecompilationRatingResponse(BaseModel): GetAiDecompilationRatingResponse """ # noqa: E501 rating: AiDecompilationRating = Field(description="The rating the user has given to the AI decompilation response") - __properties: ClassVar[List[str]] = ["rating"] + reason: Optional[StrictStr] + __properties: ClassVar[List[str]] = ["rating", "reason"] model_config = ConfigDict( populate_by_name=True, @@ -68,6 +69,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # 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 + return _dict @classmethod @@ -80,7 +86,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "rating": obj.get("rating") + "rating": obj.get("rating"), + "reason": obj.get("reason") }) return _obj diff --git a/revengai/models/matched_function_group.py b/revengai/models/matched_function_group.py deleted file mode 100644 index 41caa50..0000000 --- a/revengai/models/matched_function_group.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - 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, StrictFloat, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Union -from typing import Optional, Set -from typing_extensions import Self - -class MatchedFunctionGroup(BaseModel): - """ - MatchedFunctionGroup - """ # noqa: E501 - function_group_name: StrictStr = Field(description="Name of the function group that contains the matched functions") - similarity: Union[StrictFloat, StrictInt] = Field(description="Similarity score of the match") - __properties: ClassVar[List[str]] = ["function_group_name", "similarity"] - - 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 MatchedFunctionGroup 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, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of MatchedFunctionGroup from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "function_group_name": obj.get("function_group_name"), - "similarity": obj.get("similarity") - }) - return _obj - - diff --git a/revengai/models/matched_function_suggestion.py b/revengai/models/matched_function_suggestion.py index ed727e9..9eb6f1a 100644 --- a/revengai/models/matched_function_suggestion.py +++ b/revengai/models/matched_function_suggestion.py @@ -17,7 +17,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self @@ -26,7 +26,7 @@ class MatchedFunctionSuggestion(BaseModel): MatchedFunctionSuggestion """ # noqa: E501 function_id: StrictInt = Field(description="Unique identifier of the matched function") - function_vaddr: Optional[StrictInt] + function_vaddr: StrictInt = Field(description="Virtual address of the matched function") suggested_name: StrictStr = Field(description="Name of the function group that contains the matched functions") __properties: ClassVar[List[str]] = ["function_id", "function_vaddr", "suggested_name"] @@ -69,11 +69,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if function_vaddr (nullable) is None - # and model_fields_set contains the field - if self.function_vaddr is None and "function_vaddr" in self.model_fields_set: - _dict['function_vaddr'] = None - return _dict @classmethod diff --git a/revengai/models/unstrip_request.py b/revengai/models/unstrip_request.py deleted file mode 100644 index 3cf1b38..0000000 --- a/revengai/models/unstrip_request.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - 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 -from typing import Any, ClassVar, Dict, List, Optional, Union -from typing_extensions import Annotated -from typing import Optional, Set -from typing_extensions import Self - -class UnstripRequest(BaseModel): - """ - UnstripRequest - """ # noqa: E501 - min_similarity: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.9, description="Minimum similarity expected for a match, default is 0.9") - limit: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=1, description="Maximum number of matches to return, default is 1, maximum is 10") - apply: Optional[StrictBool] = Field(default=False, description="Whether to apply the matched function names to the target binary, default is False") - __properties: ClassVar[List[str]] = ["min_similarity", "limit", "apply"] - - 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 UnstripRequest 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, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UnstripRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "min_similarity": obj.get("min_similarity") if obj.get("min_similarity") is not None else 0.9, - "limit": obj.get("limit") if obj.get("limit") is not None else 1, - "apply": obj.get("apply") if obj.get("apply") is not None else False - }) - return _obj - - diff --git a/revengai/models/upsert_ai_decomplation_rating_request.py b/revengai/models/upsert_ai_decomplation_rating_request.py index 29b3f69..e89781d 100644 --- a/revengai/models/upsert_ai_decomplation_rating_request.py +++ b/revengai/models/upsert_ai_decomplation_rating_request.py @@ -16,8 +16,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from revengai.models.ai_decompilation_rating import AiDecompilationRating from typing import Optional, Set from typing_extensions import Self @@ -27,7 +27,8 @@ class UpsertAiDecomplationRatingRequest(BaseModel): UpsertAiDecomplationRatingRequest """ # noqa: E501 rating: AiDecompilationRating = Field(description="The rating for the AI decompilation response") - __properties: ClassVar[List[str]] = ["rating"] + reason: Optional[StrictStr] + __properties: ClassVar[List[str]] = ["rating", "reason"] model_config = ConfigDict( populate_by_name=True, @@ -68,6 +69,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # 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 + return _dict @classmethod @@ -80,7 +86,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "rating": obj.get("rating") + "rating": obj.get("rating"), + "reason": obj.get("reason") }) return _obj diff --git a/test/test_analysis_record.py b/test/test_analysis_record.py index 446b386..8f62516 100644 --- a/test/test_analysis_record.py +++ b/test/test_analysis_record.py @@ -38,15 +38,18 @@ def make_instance(self, include_optional) -> AnalysisRecord: analysis_scope = '', binary_id = 56, model_id = 56, + model_name = '', status = '', creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), is_owner = True, binary_name = '', sha_256_hash = '', + function_boundaries_hash = '', binary_size = 56, username = '', dynamic_execution_status = 'PENDING', - dynamic_execution_task_id = 56 + dynamic_execution_task_id = 56, + base_address = 56 ) else: return AnalysisRecord( @@ -54,13 +57,16 @@ def make_instance(self, include_optional) -> AnalysisRecord: analysis_scope = '', binary_id = 56, model_id = 56, + model_name = '', status = '', creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), is_owner = True, binary_name = '', sha_256_hash = '', + function_boundaries_hash = '', binary_size = 56, username = '', + base_address = 56, ) """ diff --git a/test/test_auto_unstrip_by_group_response.py b/test/test_auto_unstrip_by_group_response.py deleted file mode 100644 index 139e56d..0000000 --- a/test/test_auto_unstrip_by_group_response.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from revengai.models.auto_unstrip_by_group_response import AutoUnstripByGroupResponse - -class TestAutoUnstripByGroupResponse(unittest.TestCase): - """AutoUnstripByGroupResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AutoUnstripByGroupResponse: - """Test AutoUnstripByGroupResponse - include_optional is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AutoUnstripByGroupResponse` - """ - model = AutoUnstripByGroupResponse() - if include_optional: - return AutoUnstripByGroupResponse( - progress = 56, - status = '', - total_time = 56, - matches_map = { - 'key' : [ - revengai.models.matched_function_group.MatchedFunctionGroup( - function_group_name = '', - similarity = 1.337, ) - ] - }, - applied = True - ) - else: - return AutoUnstripByGroupResponse( - ) - """ - - def testAutoUnstripByGroupResponse(self): - """Test AutoUnstripByGroupResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_base_response_get_ai_decompilation_rating_response.py b/test/test_base_response_get_ai_decompilation_rating_response.py index aa9cfe2..95a5a00 100644 --- a/test/test_base_response_get_ai_decompilation_rating_response.py +++ b/test/test_base_response_get_ai_decompilation_rating_response.py @@ -36,7 +36,8 @@ def make_instance(self, include_optional) -> BaseResponseGetAiDecompilationRatin return BaseResponseGetAiDecompilationRatingResponse( status = True, data = revengai.models.get_ai_decompilation_rating_response.GetAiDecompilationRatingResponse( - rating = 'POSITIVE', ), + rating = 'POSITIVE', + reason = '', ), message = '', errors = [ revengai.models.error_model.ErrorModel( diff --git a/test/test_base_response_recent.py b/test/test_base_response_recent.py index d9b437d..b7fc946 100644 --- a/test/test_base_response_recent.py +++ b/test/test_base_response_recent.py @@ -42,15 +42,18 @@ def make_instance(self, include_optional) -> BaseResponseRecent: analysis_scope = '', binary_id = 56, model_id = 56, + model_name = '', status = '', creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), is_owner = True, binary_name = '', sha_256_hash = '', + function_boundaries_hash = '', binary_size = 56, username = '', dynamic_execution_status = 'PENDING', - dynamic_execution_task_id = 56, ) + dynamic_execution_task_id = 56, + base_address = 56, ) ], ), message = '', errors = [ diff --git a/test/test_functions_core_api.py b/test/test_functions_core_api.py index a0b53db..9ea01bc 100644 --- a/test/test_functions_core_api.py +++ b/test/test_functions_core_api.py @@ -102,13 +102,6 @@ def test_get_similar_functions(self) -> None: """ pass - def test_unstrip(self) -> None: - """Test case for unstrip - - Performs matching and auto-unstrip for an analysis and its functions - """ - pass - if __name__ == '__main__': unittest.main() diff --git a/test/test_get_ai_decompilation_rating_response.py b/test/test_get_ai_decompilation_rating_response.py index 34f330a..d363559 100644 --- a/test/test_get_ai_decompilation_rating_response.py +++ b/test/test_get_ai_decompilation_rating_response.py @@ -34,11 +34,13 @@ def make_instance(self, include_optional) -> GetAiDecompilationRatingResponse: model = GetAiDecompilationRatingResponse() if include_optional: return GetAiDecompilationRatingResponse( - rating = 'POSITIVE' + rating = 'POSITIVE', + reason = '' ) else: return GetAiDecompilationRatingResponse( rating = 'POSITIVE', + reason = '', ) """ diff --git a/test/test_matched_function_group.py b/test/test_matched_function_group.py deleted file mode 100644 index 7763c21..0000000 --- a/test/test_matched_function_group.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from revengai.models.matched_function_group import MatchedFunctionGroup - -class TestMatchedFunctionGroup(unittest.TestCase): - """MatchedFunctionGroup unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MatchedFunctionGroup: - """Test MatchedFunctionGroup - include_optional is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `MatchedFunctionGroup` - """ - model = MatchedFunctionGroup() - if include_optional: - return MatchedFunctionGroup( - function_group_name = '', - similarity = 1.337 - ) - else: - return MatchedFunctionGroup( - function_group_name = '', - similarity = 1.337, - ) - """ - - def testMatchedFunctionGroup(self): - """Test MatchedFunctionGroup""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_recent.py b/test/test_recent.py index 938d18d..5aef1a4 100644 --- a/test/test_recent.py +++ b/test/test_recent.py @@ -40,15 +40,18 @@ def make_instance(self, include_optional) -> Recent: analysis_scope = '', binary_id = 56, model_id = 56, + model_name = '', status = '', creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), is_owner = True, binary_name = '', sha_256_hash = '', + function_boundaries_hash = '', binary_size = 56, username = '', dynamic_execution_status = 'PENDING', - dynamic_execution_task_id = 56, ) + dynamic_execution_task_id = 56, + base_address = 56, ) ] ) else: @@ -59,15 +62,18 @@ def make_instance(self, include_optional) -> Recent: analysis_scope = '', binary_id = 56, model_id = 56, + model_name = '', status = '', creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), is_owner = True, binary_name = '', sha_256_hash = '', + function_boundaries_hash = '', binary_size = 56, username = '', dynamic_execution_status = 'PENDING', - dynamic_execution_task_id = 56, ) + dynamic_execution_task_id = 56, + base_address = 56, ) ], ) """ diff --git a/test/test_unstrip_request.py b/test/test_unstrip_request.py deleted file mode 100644 index 78bb33b..0000000 --- a/test/test_unstrip_request.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding: utf-8 - -""" - RevEng.AI API - - RevEng.AI is Similarity Search Engine for executable binaries - - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from revengai.models.unstrip_request import UnstripRequest - -class TestUnstripRequest(unittest.TestCase): - """UnstripRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> UnstripRequest: - """Test UnstripRequest - include_optional is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `UnstripRequest` - """ - model = UnstripRequest() - if include_optional: - return UnstripRequest( - min_similarity = 0.0, - limit = 1.0, - apply = True - ) - else: - return UnstripRequest( - ) - """ - - def testUnstripRequest(self): - """Test UnstripRequest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_upsert_ai_decomplation_rating_request.py b/test/test_upsert_ai_decomplation_rating_request.py index 2776b76..446db04 100644 --- a/test/test_upsert_ai_decomplation_rating_request.py +++ b/test/test_upsert_ai_decomplation_rating_request.py @@ -34,11 +34,13 @@ def make_instance(self, include_optional) -> UpsertAiDecomplationRatingRequest: model = UpsertAiDecomplationRatingRequest() if include_optional: return UpsertAiDecomplationRatingRequest( - rating = 'POSITIVE' + rating = 'POSITIVE', + reason = '' ) else: return UpsertAiDecomplationRatingRequest( rating = 'POSITIVE', + reason = '', ) """