diff --git a/.sdk-version b/.sdk-version index b3e49df..46b105a 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v1.98.1 +v2.0.0 diff --git a/README.md b/README.md index 488db9d..cd86602 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *AnalysesCommentsApi* | [**delete_analysis_comment**](docs/AnalysesCommentsApi.md#delete_analysis_comment) | **DELETE** /v2/analyses/{analysis_id}/comments/{comment_id} | Delete a comment *AnalysesCommentsApi* | [**get_analysis_comments**](docs/AnalysesCommentsApi.md#get_analysis_comments) | **GET** /v2/analyses/{analysis_id}/comments | Get comments for this analysis *AnalysesCommentsApi* | [**update_analysis_comment**](docs/AnalysesCommentsApi.md#update_analysis_comment) | **PATCH** /v2/analyses/{analysis_id}/comments/{comment_id} | Update a comment -*AnalysesCoreApi* | [**batch_symbol_ann**](docs/AnalysesCoreApi.md#batch_symbol_ann) | **POST** /v1/ann/symbol/batch | Batch Symbol ANN using function IDs *AnalysesCoreApi* | [**create_analysis**](docs/AnalysesCoreApi.md#create_analysis) | **POST** /v2/analyses | Create Analysis *AnalysesCoreApi* | [**delete_analysis**](docs/AnalysesCoreApi.md#delete_analysis) | **DELETE** /v2/analyses/{analysis_id} | Delete Analysis *AnalysesCoreApi* | [**find_similar_functions_batch**](docs/AnalysesCoreApi.md#find_similar_functions_batch) | **POST** /v2/analyses/{analysis_id}/similarity/functions | Batch Symbol ANN using Analysis ID @@ -159,6 +158,7 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [ANNFunction](docs/ANNFunction.md) - [Addr](docs/Addr.md) - [AiDecompilationRating](docs/AiDecompilationRating.md) - [AiUnstripRequest](docs/AiUnstripRequest.md) @@ -177,14 +177,12 @@ Class | Method | HTTP request | Description - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) - [AnalysisUpdateTagsResponse](docs/AnalysisUpdateTagsResponse.md) - - [AppApiRestV1AnnSchemaANNFunction](docs/AppApiRestV1AnnSchemaANNFunction.md) - [AppApiRestV2AnalysesEnumsDynamicExecutionStatus](docs/AppApiRestV2AnalysesEnumsDynamicExecutionStatus.md) - [AppApiRestV2AnalysesEnumsOrderBy](docs/AppApiRestV2AnalysesEnumsOrderBy.md) - [AppApiRestV2AnalysesResponsesTagItem](docs/AppApiRestV2AnalysesResponsesTagItem.md) - [AppApiRestV2CollectionsEnumsOrderBy](docs/AppApiRestV2CollectionsEnumsOrderBy.md) - [AppApiRestV2FunctionsResponsesFunction](docs/AppApiRestV2FunctionsResponsesFunction.md) - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) - - [AppApiRestV2SimilaritySchemaANNFunction](docs/AppApiRestV2SimilaritySchemaANNFunction.md) - [AppServicesBinaryAnnSchemaTagItem](docs/AppServicesBinaryAnnSchemaTagItem.md) - [AppServicesDynamicExecutionSchemasDynamicExecutionStatus](docs/AppServicesDynamicExecutionSchemasDynamicExecutionStatus.md) - [Argument](docs/Argument.md) @@ -330,7 +328,6 @@ Class | Method | HTTP request | Description - [FileHashes](docs/FileHashes.md) - [FileMetadata](docs/FileMetadata.md) - [Filters](docs/Filters.md) - - [FunctionBatchAnn](docs/FunctionBatchAnn.md) - [FunctionBlockDestinationResponse](docs/FunctionBlockDestinationResponse.md) - [FunctionBlockResponse](docs/FunctionBlockResponse.md) - [FunctionBlocksResponse](docs/FunctionBlocksResponse.md) diff --git a/docs/AppApiRestV2SimilaritySchemaANNFunction.md b/docs/ANNFunction.md similarity index 58% rename from docs/AppApiRestV2SimilaritySchemaANNFunction.md rename to docs/ANNFunction.md index d2d4e61..87e7cbb 100644 --- a/docs/AppApiRestV2SimilaritySchemaANNFunction.md +++ b/docs/ANNFunction.md @@ -1,4 +1,4 @@ -# AppApiRestV2SimilaritySchemaANNFunction +# ANNFunction ## Properties @@ -16,19 +16,19 @@ Name | Type | Description | Notes ## Example ```python -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction +from revengai.models.ann_function import ANNFunction # TODO update the JSON string below json = "{}" -# create an instance of AppApiRestV2SimilaritySchemaANNFunction from a JSON string -app_api_rest_v2_similarity_schema_ann_function_instance = AppApiRestV2SimilaritySchemaANNFunction.from_json(json) +# create an instance of ANNFunction from a JSON string +ann_function_instance = ANNFunction.from_json(json) # print the JSON string representation of the object -print(AppApiRestV2SimilaritySchemaANNFunction.to_json()) +print(ANNFunction.to_json()) # convert the object into a dict -app_api_rest_v2_similarity_schema_ann_function_dict = app_api_rest_v2_similarity_schema_ann_function_instance.to_dict() -# create an instance of AppApiRestV2SimilaritySchemaANNFunction from a dict -app_api_rest_v2_similarity_schema_ann_function_from_dict = AppApiRestV2SimilaritySchemaANNFunction.from_dict(app_api_rest_v2_similarity_schema_ann_function_dict) +ann_function_dict = ann_function_instance.to_dict() +# create an instance of ANNFunction from a dict +ann_function_from_dict = ANNFunction.from_dict(ann_function_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 499a01c..3e5f4ed 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -4,7 +4,6 @@ All URIs are relative to *https://api.reveng.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**batch_symbol_ann**](AnalysesCoreApi.md#batch_symbol_ann) | **POST** /v1/ann/symbol/batch | Batch Symbol ANN using function IDs [**create_analysis**](AnalysesCoreApi.md#create_analysis) | **POST** /v2/analyses | Create Analysis [**delete_analysis**](AnalysesCoreApi.md#delete_analysis) | **DELETE** /v2/analyses/{analysis_id} | Delete Analysis [**find_similar_functions_batch**](AnalysesCoreApi.md#find_similar_functions_batch) | **POST** /v2/analyses/{analysis_id}/similarity/functions | Batch Symbol ANN using Analysis ID @@ -22,87 +21,6 @@ Method | HTTP request | Description [**upload_file**](AnalysesCoreApi.md#upload_file) | **POST** /v2/upload | Upload File -# **batch_symbol_ann** -> FunctionBatchAnn batch_symbol_ann(app_api_rest_v1_ann_schema_ann_function) - -Batch Symbol ANN using function IDs - -Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database - -### Example - -* Api Key Authentication (APIKey): - -```python -import revengai -from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction -from revengai.models.function_batch_ann import FunctionBatchAnn -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.AnalysesCoreApi(api_client) - app_api_rest_v1_ann_schema_ann_function = revengai.AppApiRestV1AnnSchemaANNFunction() # AppApiRestV1AnnSchemaANNFunction | - - try: - # Batch Symbol ANN using function IDs - api_response = api_instance.batch_symbol_ann(app_api_rest_v1_ann_schema_ann_function) - print("The response of AnalysesCoreApi->batch_symbol_ann:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AnalysesCoreApi->batch_symbol_ann: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **app_api_rest_v1_ann_schema_ann_function** | [**AppApiRestV1AnnSchemaANNFunction**](AppApiRestV1AnnSchemaANNFunction.md)| | - -### Return type - -[**FunctionBatchAnn**](FunctionBatchAnn.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) - # **create_analysis** > BaseResponseAnalysisCreateResponse create_analysis(analysis_create_request) @@ -269,7 +187,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) # **find_similar_functions_batch** -> BaseResponseNearestNeighborAnalysis find_similar_functions_batch(analysis_id, app_api_rest_v2_similarity_schema_ann_function) +> BaseResponseNearestNeighborAnalysis find_similar_functions_batch(analysis_id, ann_function) Batch Symbol ANN using Analysis ID @@ -281,7 +199,7 @@ Takes a analysis ID and returns the nearest functions within the database that m ```python import revengai -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction +from revengai.models.ann_function import ANNFunction from revengai.models.base_response_nearest_neighbor_analysis import BaseResponseNearestNeighborAnalysis from revengai.rest import ApiException from pprint import pprint @@ -308,11 +226,11 @@ with revengai.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = revengai.AnalysesCoreApi(api_client) analysis_id = 56 # int | - app_api_rest_v2_similarity_schema_ann_function = revengai.AppApiRestV2SimilaritySchemaANNFunction() # AppApiRestV2SimilaritySchemaANNFunction | + ann_function = revengai.ANNFunction() # ANNFunction | try: # Batch Symbol ANN using Analysis ID - api_response = api_instance.find_similar_functions_batch(analysis_id, app_api_rest_v2_similarity_schema_ann_function) + api_response = api_instance.find_similar_functions_batch(analysis_id, ann_function) print("The response of AnalysesCoreApi->find_similar_functions_batch:\n") pprint(api_response) except Exception as e: @@ -327,7 +245,7 @@ with revengai.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **analysis_id** | **int**| | - **app_api_rest_v2_similarity_schema_ann_function** | [**AppApiRestV2SimilaritySchemaANNFunction**](AppApiRestV2SimilaritySchemaANNFunction.md)| | + **ann_function** | [**ANNFunction**](ANNFunction.md)| | ### Return type diff --git a/docs/AppApiRestV1AnnSchemaANNFunction.md b/docs/AppApiRestV1AnnSchemaANNFunction.md deleted file mode 100644 index 230f341..0000000 --- a/docs/AppApiRestV1AnnSchemaANNFunction.md +++ /dev/null @@ -1,37 +0,0 @@ -# AppApiRestV1AnnSchemaANNFunction - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**result_per_function** | **int** | | [optional] -**distance** | **float** | | [optional] -**function_id_list** | **List[Optional[int]]** | List of function ids to compare | -**speculative_function_ids** | **List[object]** | | [optional] -**collection** | **List[Optional[str]]** | Perform a search on functions within a list of collections | [optional] [default to []] -**collection_search_list** | **List[Optional[int]]** | Perform a search on functions within a list of collections | [optional] [default to []] -**debug_mode** | **bool** | | [optional] -**debug_types** | **List[str]** | If limiting results to functions with debug names, which type of debug names to include? | [optional] [default to [SYSTEM]] -**binaries_search_list** | **List[Optional[int]]** | Perform a search on functions within a list of analyses | [optional] [default to []] - -## Example - -```python -from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction - -# TODO update the JSON string below -json = "{}" -# create an instance of AppApiRestV1AnnSchemaANNFunction from a JSON string -app_api_rest_v1_ann_schema_ann_function_instance = AppApiRestV1AnnSchemaANNFunction.from_json(json) -# print the JSON string representation of the object -print(AppApiRestV1AnnSchemaANNFunction.to_json()) - -# convert the object into a dict -app_api_rest_v1_ann_schema_ann_function_dict = app_api_rest_v1_ann_schema_ann_function_instance.to_dict() -# create an instance of AppApiRestV1AnnSchemaANNFunction from a dict -app_api_rest_v1_ann_schema_ann_function_from_dict = AppApiRestV1AnnSchemaANNFunction.from_dict(app_api_rest_v1_ann_schema_ann_function_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/AppApiRestV2FunctionsResponsesFunction.md b/docs/AppApiRestV2FunctionsResponsesFunction.md index f0c954a..0cf6d70 100644 --- a/docs/AppApiRestV2FunctionsResponsesFunction.md +++ b/docs/AppApiRestV2FunctionsResponsesFunction.md @@ -7,7 +7,7 @@ Function schema used in function strings response. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **function_id** | **int** | | -**function_vaddr** | **int** | | +**function_vaddr** | **int** | Function virtual address | ## Example diff --git a/docs/AppApiRestV2FunctionsTypesFunction.md b/docs/AppApiRestV2FunctionsTypesFunction.md index 8a37547..c2afbb0 100644 --- a/docs/AppApiRestV2FunctionsTypesFunction.md +++ b/docs/AppApiRestV2FunctionsTypesFunction.md @@ -6,7 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **function_id** | **int** | Function id | -**function_name** | **str** | Function name | +**function_name** | **str** | Demangled name of the function | +**function_mangled_name** | **str** | Mangled name of the function | **function_vaddr** | **int** | Function virtual address | **function_size** | **int** | Function size | **debug** | **bool** | Whether the function is debug | diff --git a/docs/FunctionBatchAnn.md b/docs/FunctionBatchAnn.md deleted file mode 100644 index 3be2868..0000000 --- a/docs/FunctionBatchAnn.md +++ /dev/null @@ -1,31 +0,0 @@ -# FunctionBatchAnn - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**success** | **object** | | [optional] -**settings** | **object** | | -**function_matches** | **object** | | - -## Example - -```python -from revengai.models.function_batch_ann import FunctionBatchAnn - -# TODO update the JSON string below -json = "{}" -# create an instance of FunctionBatchAnn from a JSON string -function_batch_ann_instance = FunctionBatchAnn.from_json(json) -# print the JSON string representation of the object -print(FunctionBatchAnn.to_json()) - -# convert the object into a dict -function_batch_ann_dict = function_batch_ann_instance.to_dict() -# create an instance of FunctionBatchAnn from a dict -function_batch_ann_from_dict = FunctionBatchAnn.from_dict(function_batch_ann_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/FunctionMatchingRequest.md b/docs/FunctionMatchingRequest.md index 792f177..c4fa97f 100644 --- a/docs/FunctionMatchingRequest.md +++ b/docs/FunctionMatchingRequest.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **function_ids** | **List[int]** | ID's of functions to find matches for, must be at least one function ID | **min_similarity** | **float** | Minimum similarity expected for a match as a percentage, default is 90 | [optional] [default to 90.0] **filters** | [**FunctionMatchingFilters**](FunctionMatchingFilters.md) | | [optional] -**results_per_function** | **int** | Maximum number of matches to return per function, default is 1, max is 10 | [optional] [default to 1] +**results_per_function** | **int** | Maximum number of matches to return per function, default is 1, max is 50 | [optional] [default to 1] **page** | **int** | Page number for paginated results, default is 1 (first page) | [optional] [default to 1] **page_size** | **int** | Number of functions to return per page, default is 0 (all functions), max is 1000 | [optional] [default to 0] diff --git a/revengai/__init__.py b/revengai/__init__.py index 6b6c1e0..e76853c 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v1.98.1" +__version__ = "v2.0.0" # Define package exports __all__ = [ @@ -45,6 +45,7 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "ANNFunction", "Addr", "AiDecompilationRating", "AiUnstripRequest", @@ -63,14 +64,12 @@ "AnalysisUpdateRequest", "AnalysisUpdateTagsRequest", "AnalysisUpdateTagsResponse", - "AppApiRestV1AnnSchemaANNFunction", "AppApiRestV2AnalysesEnumsDynamicExecutionStatus", "AppApiRestV2AnalysesEnumsOrderBy", "AppApiRestV2AnalysesResponsesTagItem", "AppApiRestV2CollectionsEnumsOrderBy", "AppApiRestV2FunctionsResponsesFunction", "AppApiRestV2FunctionsTypesFunction", - "AppApiRestV2SimilaritySchemaANNFunction", "AppServicesBinaryAnnSchemaTagItem", "AppServicesDynamicExecutionSchemasDynamicExecutionStatus", "Argument", @@ -216,7 +215,6 @@ "FileHashes", "FileMetadata", "Filters", - "FunctionBatchAnn", "FunctionBlockDestinationResponse", "FunctionBlockResponse", "FunctionBlocksResponse", @@ -385,6 +383,7 @@ from revengai.exceptions import ApiException as ApiException # import models into sdk package +from revengai.models.ann_function import ANNFunction as ANNFunction from revengai.models.addr import Addr as Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating as AiDecompilationRating from revengai.models.ai_unstrip_request import AiUnstripRequest as AiUnstripRequest @@ -403,14 +402,12 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest as AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest as AnalysisUpdateTagsRequest from revengai.models.analysis_update_tags_response import AnalysisUpdateTagsResponse as AnalysisUpdateTagsResponse -from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction as AppApiRestV1AnnSchemaANNFunction from revengai.models.app_api_rest_v2_analyses_enums_dynamic_execution_status import AppApiRestV2AnalysesEnumsDynamicExecutionStatus as AppApiRestV2AnalysesEnumsDynamicExecutionStatus from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy as AppApiRestV2AnalysesEnumsOrderBy from revengai.models.app_api_rest_v2_analyses_responses_tag_item import AppApiRestV2AnalysesResponsesTagItem as AppApiRestV2AnalysesResponsesTagItem from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy as AppApiRestV2CollectionsEnumsOrderBy from revengai.models.app_api_rest_v2_functions_responses_function import AppApiRestV2FunctionsResponsesFunction as AppApiRestV2FunctionsResponsesFunction from revengai.models.app_api_rest_v2_functions_types_function import AppApiRestV2FunctionsTypesFunction as AppApiRestV2FunctionsTypesFunction -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction as AppApiRestV2SimilaritySchemaANNFunction 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 @@ -556,7 +553,6 @@ from revengai.models.file_hashes import FileHashes as FileHashes from revengai.models.file_metadata import FileMetadata as FileMetadata from revengai.models.filters import Filters as Filters -from revengai.models.function_batch_ann import FunctionBatchAnn as FunctionBatchAnn from revengai.models.function_block_destination_response import FunctionBlockDestinationResponse as FunctionBlockDestinationResponse from revengai.models.function_block_response import FunctionBlockResponse as FunctionBlockResponse from revengai.models.function_blocks_response import FunctionBlocksResponse as FunctionBlocksResponse diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 1be3842..89b0df0 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -18,12 +18,11 @@ from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr from typing import Any, List, Optional, Tuple, Union from typing_extensions import Annotated +from revengai.models.ann_function import ANNFunction from revengai.models.analysis_create_request import AnalysisCreateRequest from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest -from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction from revengai.models.base_response_analysis_create_response import BaseResponseAnalysisCreateResponse from revengai.models.base_response_analysis_detail_response import BaseResponseAnalysisDetailResponse from revengai.models.base_response_analysis_function_mapping import BaseResponseAnalysisFunctionMapping @@ -40,7 +39,6 @@ from revengai.models.base_response_upload_response import BaseResponseUploadResponse from revengai.models.binary_ann_form import BinaryAnnForm from revengai.models.dynamic_execution_status_input import DynamicExecutionStatusInput -from revengai.models.function_batch_ann import FunctionBatchAnn from revengai.models.model_name import ModelName from revengai.models.order import Order from revengai.models.re_analysis_form import ReAnalysisForm @@ -66,283 +64,6 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - @validate_call - def batch_symbol_ann( - self, - app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, - _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, - ) -> FunctionBatchAnn: - """Batch Symbol ANN using function IDs - - Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database - - :param app_api_rest_v1_ann_schema_ann_function: (required) - :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction - :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._batch_symbol_ann_serialize( - app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "FunctionBatchAnn", - '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 batch_symbol_ann_with_http_info( - self, - app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, - _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[FunctionBatchAnn]: - """Batch Symbol ANN using function IDs - - Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database - - :param app_api_rest_v1_ann_schema_ann_function: (required) - :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction - :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._batch_symbol_ann_serialize( - app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "FunctionBatchAnn", - '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 batch_symbol_ann_without_preload_content( - self, - app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, - _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: - """Batch Symbol ANN using function IDs - - Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database - - :param app_api_rest_v1_ann_schema_ann_function: (required) - :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction - :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._batch_symbol_ann_serialize( - app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "FunctionBatchAnn", - '422': "BaseResponse", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _batch_symbol_ann_serialize( - self, - app_api_rest_v1_ann_schema_ann_function, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if app_api_rest_v1_ann_schema_ann_function is not None: - _body_params = app_api_rest_v1_ann_schema_ann_function - - - # 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='/v1/ann/symbol/batch', - 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 create_analysis( self, @@ -900,7 +621,7 @@ def _delete_analysis_serialize( def find_similar_functions_batch( self, analysis_id: StrictInt, - app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, + ann_function: ANNFunction, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -920,8 +641,8 @@ def find_similar_functions_batch( :param analysis_id: (required) :type analysis_id: int - :param app_api_rest_v2_similarity_schema_ann_function: (required) - :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction + :param ann_function: (required) + :type ann_function: ANNFunction :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 @@ -946,7 +667,7 @@ def find_similar_functions_batch( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, + ann_function=ann_function, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -972,7 +693,7 @@ def find_similar_functions_batch( def find_similar_functions_batch_with_http_info( self, analysis_id: StrictInt, - app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, + ann_function: ANNFunction, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -992,8 +713,8 @@ def find_similar_functions_batch_with_http_info( :param analysis_id: (required) :type analysis_id: int - :param app_api_rest_v2_similarity_schema_ann_function: (required) - :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction + :param ann_function: (required) + :type ann_function: ANNFunction :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 @@ -1018,7 +739,7 @@ def find_similar_functions_batch_with_http_info( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, + ann_function=ann_function, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1044,7 +765,7 @@ def find_similar_functions_batch_with_http_info( def find_similar_functions_batch_without_preload_content( self, analysis_id: StrictInt, - app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, + ann_function: ANNFunction, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1064,8 +785,8 @@ def find_similar_functions_batch_without_preload_content( :param analysis_id: (required) :type analysis_id: int - :param app_api_rest_v2_similarity_schema_ann_function: (required) - :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction + :param ann_function: (required) + :type ann_function: ANNFunction :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 @@ -1090,7 +811,7 @@ def find_similar_functions_batch_without_preload_content( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, + ann_function=ann_function, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1111,7 +832,7 @@ def find_similar_functions_batch_without_preload_content( def _find_similar_functions_batch_serialize( self, analysis_id, - app_api_rest_v2_similarity_schema_ann_function, + ann_function, _request_auth, _content_type, _headers, @@ -1139,8 +860,8 @@ def _find_similar_functions_batch_serialize( # process the header parameters # process the form parameters # process the body parameter - if app_api_rest_v2_similarity_schema_ann_function is not None: - _body_params = app_api_rest_v2_similarity_schema_ann_function + if ann_function is not None: + _body_params = ann_function # set the HTTP header `Accept` diff --git a/revengai/api_client.py b/revengai/api_client.py index 4756db8..8917cdb 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.98.1/python' + self.user_agent = 'OpenAPI-Generator/v2.0.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 328342f..e67bd64 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.98.1\n"\ - "SDK Package Version: v1.98.1".\ + "Version of the API: v2.0.0\n"\ + "SDK Package Version: v2.0.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 dea9068..7f8c8e0 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -12,6 +12,7 @@ """ # noqa: E501 # import models into model package +from revengai.models.ann_function import ANNFunction from revengai.models.addr import Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating from revengai.models.ai_unstrip_request import AiUnstripRequest @@ -30,14 +31,12 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest from revengai.models.analysis_update_tags_response import AnalysisUpdateTagsResponse -from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction from revengai.models.app_api_rest_v2_analyses_enums_dynamic_execution_status import AppApiRestV2AnalysesEnumsDynamicExecutionStatus from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy from revengai.models.app_api_rest_v2_analyses_responses_tag_item import AppApiRestV2AnalysesResponsesTagItem from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy from revengai.models.app_api_rest_v2_functions_responses_function import AppApiRestV2FunctionsResponsesFunction from revengai.models.app_api_rest_v2_functions_types_function import AppApiRestV2FunctionsTypesFunction -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction 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 @@ -183,7 +182,6 @@ from revengai.models.file_hashes import FileHashes from revengai.models.file_metadata import FileMetadata from revengai.models.filters import Filters -from revengai.models.function_batch_ann import FunctionBatchAnn from revengai.models.function_block_destination_response import FunctionBlockDestinationResponse from revengai.models.function_block_response import FunctionBlockResponse from revengai.models.function_blocks_response import FunctionBlocksResponse diff --git a/revengai/models/app_api_rest_v2_similarity_schema_ann_function.py b/revengai/models/ann_function.py similarity index 94% rename from revengai/models/app_api_rest_v2_similarity_schema_ann_function.py rename to revengai/models/ann_function.py index e78c4e7..e7efb84 100644 --- a/revengai/models/app_api_rest_v2_similarity_schema_ann_function.py +++ b/revengai/models/ann_function.py @@ -22,9 +22,9 @@ from typing import Optional, Set from typing_extensions import Self -class AppApiRestV2SimilaritySchemaANNFunction(BaseModel): +class ANNFunction(BaseModel): """ - AppApiRestV2SimilaritySchemaANNFunction + ANNFunction """ # noqa: E501 limit: Optional[StrictInt] = Field(default=5, description="The amount of neighbours per function ID") distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="The distance between two neighbours") @@ -54,7 +54,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AppApiRestV2SimilaritySchemaANNFunction from a JSON string""" + """Create an instance of ANNFunction from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -96,7 +96,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AppApiRestV2SimilaritySchemaANNFunction from a dict""" + """Create an instance of ANNFunction from a dict""" if obj is None: return None diff --git a/revengai/models/app_api_rest_v1_ann_schema_ann_function.py b/revengai/models/app_api_rest_v1_ann_schema_ann_function.py deleted file mode 100644 index 4777cb0..0000000 --- a/revengai/models/app_api_rest_v1_ann_schema_ann_function.py +++ /dev/null @@ -1,134 +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, StrictFloat, StrictInt, StrictStr, field_validator -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 AppApiRestV1AnnSchemaANNFunction(BaseModel): - """ - AppApiRestV1AnnSchemaANNFunction - """ # noqa: E501 - result_per_function: Optional[Annotated[int, Field(le=20, strict=True)]] = None - distance: Optional[Union[StrictFloat, StrictInt]] = None - function_id_list: List[Optional[StrictInt]] = Field(description="List of function ids to compare") - speculative_function_ids: Optional[List[Any]] = None - collection: Optional[List[Optional[StrictStr]]] = Field(default=None, description="Perform a search on functions within a list of collections") - collection_search_list: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of collections") - debug_mode: Optional[StrictBool] = None - debug_types: Optional[List[StrictStr]] = Field(default=None, description="If limiting results to functions with debug names, which type of debug names to include?") - binaries_search_list: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of analyses") - __properties: ClassVar[List[str]] = ["result_per_function", "distance", "function_id_list", "speculative_function_ids", "collection", "collection_search_list", "debug_mode", "debug_types", "binaries_search_list"] - - @field_validator('debug_types') - def debug_types_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - for i in value: - if i not in set(['USER', 'SYSTEM', 'EXTERNAL']): - raise ValueError("each list item must be one of ('USER', 'SYSTEM', 'EXTERNAL')") - return value - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AppApiRestV1AnnSchemaANNFunction 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, - ) - # set to None if result_per_function (nullable) is None - # and model_fields_set contains the field - if self.result_per_function is None and "result_per_function" in self.model_fields_set: - _dict['result_per_function'] = None - - # set to None if distance (nullable) is None - # and model_fields_set contains the field - if self.distance is None and "distance" in self.model_fields_set: - _dict['distance'] = None - - # set to None if speculative_function_ids (nullable) is None - # and model_fields_set contains the field - if self.speculative_function_ids is None and "speculative_function_ids" in self.model_fields_set: - _dict['speculative_function_ids'] = None - - # set to None if debug_mode (nullable) is None - # and model_fields_set contains the field - if self.debug_mode is None and "debug_mode" in self.model_fields_set: - _dict['debug_mode'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AppApiRestV1AnnSchemaANNFunction from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "result_per_function": obj.get("result_per_function"), - "distance": obj.get("distance"), - "function_id_list": obj.get("function_id_list"), - "speculative_function_ids": obj.get("speculative_function_ids"), - "collection": obj.get("collection"), - "collection_search_list": obj.get("collection_search_list"), - "debug_mode": obj.get("debug_mode"), - "debug_types": obj.get("debug_types"), - "binaries_search_list": obj.get("binaries_search_list") - }) - return _obj - - diff --git a/revengai/models/app_api_rest_v2_functions_responses_function.py b/revengai/models/app_api_rest_v2_functions_responses_function.py index 6b85d98..c504480 100644 --- a/revengai/models/app_api_rest_v2_functions_responses_function.py +++ b/revengai/models/app_api_rest_v2_functions_responses_function.py @@ -16,7 +16,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self @@ -26,7 +26,7 @@ class AppApiRestV2FunctionsResponsesFunction(BaseModel): Function schema used in function strings response. """ # noqa: E501 function_id: StrictInt - function_vaddr: StrictInt + function_vaddr: StrictInt = Field(description="Function virtual address") __properties: ClassVar[List[str]] = ["function_id", "function_vaddr"] model_config = ConfigDict( diff --git a/revengai/models/app_api_rest_v2_functions_types_function.py b/revengai/models/app_api_rest_v2_functions_types_function.py index dd4a4cc..efa2171 100644 --- a/revengai/models/app_api_rest_v2_functions_types_function.py +++ b/revengai/models/app_api_rest_v2_functions_types_function.py @@ -26,13 +26,14 @@ class AppApiRestV2FunctionsTypesFunction(BaseModel): AppApiRestV2FunctionsTypesFunction """ # noqa: E501 function_id: StrictInt = Field(description="Function id") - function_name: StrictStr = Field(description="Function name") + function_name: StrictStr = Field(description="Demangled name of the function") + function_mangled_name: StrictStr = Field(description="Mangled name of the function") function_vaddr: StrictInt = Field(description="Function virtual address") function_size: StrictInt = Field(description="Function size") debug: StrictBool = Field(description="Whether the function is debug") embedding_3d: Optional[List[Union[StrictFloat, StrictInt]]] embedding_1d: Optional[List[Union[StrictFloat, StrictInt]]] - __properties: ClassVar[List[str]] = ["function_id", "function_name", "function_vaddr", "function_size", "debug", "embedding_3d", "embedding_1d"] + __properties: ClassVar[List[str]] = ["function_id", "function_name", "function_mangled_name", "function_vaddr", "function_size", "debug", "embedding_3d", "embedding_1d"] model_config = ConfigDict( populate_by_name=True, @@ -97,6 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "function_id": obj.get("function_id"), "function_name": obj.get("function_name"), + "function_mangled_name": obj.get("function_mangled_name"), "function_vaddr": obj.get("function_vaddr"), "function_size": obj.get("function_size"), "debug": obj.get("debug"), diff --git a/revengai/models/function_batch_ann.py b/revengai/models/function_batch_ann.py deleted file mode 100644 index 532488c..0000000 --- a/revengai/models/function_batch_ann.py +++ /dev/null @@ -1,105 +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 -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class FunctionBatchAnn(BaseModel): - """ - FunctionBatchAnn - """ # noqa: E501 - success: Optional[Any] = None - settings: Optional[Any] - function_matches: Optional[Any] - __properties: ClassVar[List[str]] = ["success", "settings", "function_matches"] - - 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 FunctionBatchAnn 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, - ) - # set to None if success (nullable) is None - # and model_fields_set contains the field - if self.success is None and "success" in self.model_fields_set: - _dict['success'] = None - - # set to None if settings (nullable) is None - # and model_fields_set contains the field - if self.settings is None and "settings" in self.model_fields_set: - _dict['settings'] = None - - # set to None if function_matches (nullable) is None - # and model_fields_set contains the field - if self.function_matches is None and "function_matches" in self.model_fields_set: - _dict['function_matches'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of FunctionBatchAnn from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "success": obj.get("success"), - "settings": obj.get("settings"), - "function_matches": obj.get("function_matches") - }) - return _obj - - diff --git a/revengai/models/function_matching_request.py b/revengai/models/function_matching_request.py index f572f3c..dc59908 100644 --- a/revengai/models/function_matching_request.py +++ b/revengai/models/function_matching_request.py @@ -31,7 +31,7 @@ class FunctionMatchingRequest(BaseModel): function_ids: List[StrictInt] = Field(description="ID's of functions to find matches for, must be at least one function ID") min_similarity: Optional[Union[Annotated[float, Field(le=100.0, strict=True, ge=0.0)], Annotated[int, Field(le=100, strict=True, ge=0)]]] = Field(default=90.0, description="Minimum similarity expected for a match as a percentage, default is 90") filters: Optional[FunctionMatchingFilters] = None - results_per_function: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=1, description="Maximum number of matches to return per function, default is 1, max is 10") + results_per_function: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = Field(default=1, description="Maximum number of matches to return per function, default is 1, max is 50") page: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=1, description="Page number for paginated results, default is 1 (first page)") page_size: Optional[Annotated[int, Field(le=1000, strict=True, ge=0)]] = Field(default=0, description="Number of functions to return per page, default is 0 (all functions), max is 1000") __properties: ClassVar[List[str]] = ["model_id", "function_ids", "min_similarity", "filters", "results_per_function", "page", "page_size"] diff --git a/test/test_analyses_core_api.py b/test/test_analyses_core_api.py index 8ded745..8da5b60 100644 --- a/test/test_analyses_core_api.py +++ b/test/test_analyses_core_api.py @@ -25,13 +25,6 @@ def setUp(self) -> None: def tearDown(self) -> None: pass - def test_batch_symbol_ann(self) -> None: - """Test case for batch_symbol_ann - - Batch Symbol ANN using function IDs - """ - pass - def test_create_analysis(self) -> None: """Test case for create_analysis diff --git a/test/test_analysis_functions.py b/test/test_analysis_functions.py index 963b596..d0df75c 100644 --- a/test/test_analysis_functions.py +++ b/test/test_analysis_functions.py @@ -38,6 +38,7 @@ def make_instance(self, include_optional) -> AnalysisFunctions: revengai.models.function.Function( function_id = 56, function_name = '', + function_mangled_name = '', function_vaddr = 56, function_size = 56, debug = True, @@ -55,6 +56,7 @@ def make_instance(self, include_optional) -> AnalysisFunctions: revengai.models.function.Function( function_id = 56, function_name = '', + function_mangled_name = '', function_vaddr = 56, function_size = 56, debug = True, diff --git a/test/test_app_api_rest_v2_similarity_schema_ann_function.py b/test/test_ann_function.py similarity index 60% rename from test/test_app_api_rest_v2_similarity_schema_ann_function.py rename to test/test_ann_function.py index 2929d67..41a9b65 100644 --- a/test/test_app_api_rest_v2_similarity_schema_ann_function.py +++ b/test/test_ann_function.py @@ -13,10 +13,10 @@ import unittest -from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction +from revengai.models.ann_function import ANNFunction -class TestAppApiRestV2SimilaritySchemaANNFunction(unittest.TestCase): - """AppApiRestV2SimilaritySchemaANNFunction unit test stubs""" +class TestANNFunction(unittest.TestCase): + """ANNFunction unit test stubs""" def setUp(self): pass @@ -24,16 +24,16 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AppApiRestV2SimilaritySchemaANNFunction: - """Test AppApiRestV2SimilaritySchemaANNFunction + def make_instance(self, include_optional) -> ANNFunction: + """Test ANNFunction 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 `AppApiRestV2SimilaritySchemaANNFunction` + # uncomment below to create an instance of `ANNFunction` """ - model = AppApiRestV2SimilaritySchemaANNFunction() + model = ANNFunction() if include_optional: - return AppApiRestV2SimilaritySchemaANNFunction( + return ANNFunction( limit = 56, distance = 1.337, analysis_search_ids = [ @@ -51,12 +51,12 @@ def make_instance(self, include_optional) -> AppApiRestV2SimilaritySchemaANNFunc debug_only = True ) else: - return AppApiRestV2SimilaritySchemaANNFunction( + return ANNFunction( ) """ - def testAppApiRestV2SimilaritySchemaANNFunction(self): - """Test AppApiRestV2SimilaritySchemaANNFunction""" + def testANNFunction(self): + """Test ANNFunction""" # inst_req_only = self.make_instance(include_optional=False) # inst_req_and_optional = self.make_instance(include_optional=True) diff --git a/test/test_app_api_rest_v1_ann_schema_ann_function.py b/test/test_app_api_rest_v1_ann_schema_ann_function.py deleted file mode 100644 index 3acf958..0000000 --- a/test/test_app_api_rest_v1_ann_schema_ann_function.py +++ /dev/null @@ -1,73 +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.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction - -class TestAppApiRestV1AnnSchemaANNFunction(unittest.TestCase): - """AppApiRestV1AnnSchemaANNFunction unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AppApiRestV1AnnSchemaANNFunction: - """Test AppApiRestV1AnnSchemaANNFunction - 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 `AppApiRestV1AnnSchemaANNFunction` - """ - model = AppApiRestV1AnnSchemaANNFunction() - if include_optional: - return AppApiRestV1AnnSchemaANNFunction( - result_per_function = 56, - distance = 1.337, - function_id_list = [ - 56 - ], - speculative_function_ids = [ - null - ], - collection = [ - '' - ], - collection_search_list = [ - 56 - ], - debug_mode = True, - debug_types = [ - 'USER' - ], - binaries_search_list = [ - 56 - ] - ) - else: - return AppApiRestV1AnnSchemaANNFunction( - function_id_list = [ - 56 - ], - ) - """ - - def testAppApiRestV1AnnSchemaANNFunction(self): - """Test AppApiRestV1AnnSchemaANNFunction""" - # 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_app_api_rest_v2_functions_types_function.py b/test/test_app_api_rest_v2_functions_types_function.py index 70559c6..a3322e4 100644 --- a/test/test_app_api_rest_v2_functions_types_function.py +++ b/test/test_app_api_rest_v2_functions_types_function.py @@ -36,6 +36,7 @@ def make_instance(self, include_optional) -> AppApiRestV2FunctionsTypesFunction: return AppApiRestV2FunctionsTypesFunction( function_id = 56, function_name = '', + function_mangled_name = '', function_vaddr = 56, function_size = 56, debug = True, @@ -50,6 +51,7 @@ def make_instance(self, include_optional) -> AppApiRestV2FunctionsTypesFunction: return AppApiRestV2FunctionsTypesFunction( function_id = 56, function_name = '', + function_mangled_name = '', function_vaddr = 56, function_size = 56, debug = True, diff --git a/test/test_base_response_analysis_functions.py b/test/test_base_response_analysis_functions.py index 9b00e1a..59cd0d0 100644 --- a/test/test_base_response_analysis_functions.py +++ b/test/test_base_response_analysis_functions.py @@ -40,6 +40,7 @@ def make_instance(self, include_optional) -> BaseResponseAnalysisFunctions: revengai.models.function.Function( function_id = 56, function_name = '', + function_mangled_name = '', function_vaddr = 56, function_size = 56, debug = True, diff --git a/test/test_function_batch_ann.py b/test/test_function_batch_ann.py deleted file mode 100644 index 515c5d3..0000000 --- a/test/test_function_batch_ann.py +++ /dev/null @@ -1,54 +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.function_batch_ann import FunctionBatchAnn - -class TestFunctionBatchAnn(unittest.TestCase): - """FunctionBatchAnn unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> FunctionBatchAnn: - """Test FunctionBatchAnn - 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 `FunctionBatchAnn` - """ - model = FunctionBatchAnn() - if include_optional: - return FunctionBatchAnn( - success = None, - settings = None, - function_matches = None - ) - else: - return FunctionBatchAnn( - settings = None, - function_matches = None, - ) - """ - - def testFunctionBatchAnn(self): - """Test FunctionBatchAnn""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main()