diff --git a/.sdk-version b/.sdk-version index b0c3c5c..cee6f27 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v2.11.0 +v2.11.7 diff --git a/README.md b/README.md index b267022..55c4697 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**update_collection**](docs/CollectionsApi.md#update_collection) | **PATCH** /v2/collections/{collection_id} | Updates a collection *CollectionsApi* | [**update_collection_binaries**](docs/CollectionsApi.md#update_collection_binaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries *CollectionsApi* | [**update_collection_tags**](docs/CollectionsApi.md#update_collection_tags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags +*ConfidenceApi* | [**get_analysis_tag_score**](docs/ConfidenceApi.md#get_analysis_tag_score) | **POST** /v2/confidence/analysis/{analysis_id}/tag_score | Calculate Tag Confidence Score for an Analysis *ExternalSourcesApi* | [**create_external_task_mb**](docs/ExternalSourcesApi.md#create_external_task_mb) | **POST** /v2/analysis/{analysis_id}/external/mb | Pulls data from VirusTotal *ExternalSourcesApi* | [**create_external_task_vt**](docs/ExternalSourcesApi.md#create_external_task_vt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal *ExternalSourcesApi* | [**get_mb_data**](docs/ExternalSourcesApi.md#get_mb_data) | **GET** /v2/analysis/{analysis_id}/external/mb | Get MalwareBazaar data @@ -232,6 +233,7 @@ Class | Method | HTTP request | Description - [BaseResponseListDieMatch](docs/BaseResponseListDieMatch.md) - [BaseResponseListFunctionNameHistory](docs/BaseResponseListFunctionNameHistory.md) - [BaseResponseListSBOM](docs/BaseResponseListSBOM.md) + - [BaseResponseListTagOriginBoxPlotConfidence](docs/BaseResponseListTagOriginBoxPlotConfidence.md) - [BaseResponseListUserActivityResponse](docs/BaseResponseListUserActivityResponse.md) - [BaseResponseLoginResponse](docs/BaseResponseLoginResponse.md) - [BaseResponseLogs](docs/BaseResponseLogs.md) @@ -264,6 +266,7 @@ Class | Method | HTTP request | Description - [BinaryTaskStatus](docs/BinaryTaskStatus.md) - [Block](docs/Block.md) - [BlockCommentsGenerationForFunctionResponse](docs/BlockCommentsGenerationForFunctionResponse.md) + - [BoxPlotConfidence](docs/BoxPlotConfidence.md) - [CalleeFunctionInfo](docs/CalleeFunctionInfo.md) - [CalleesCallerFunctionsResponse](docs/CalleesCallerFunctionsResponse.md) - [CallerFunctionInfo](docs/CallerFunctionInfo.md) @@ -379,6 +382,7 @@ Class | Method | HTTP request | Description - [NetworkOverviewMetadata](docs/NetworkOverviewMetadata.md) - [NetworkOverviewResponse](docs/NetworkOverviewResponse.md) - [Order](docs/Order.md) + - [Origin](docs/Origin.md) - [PDBDebugModel](docs/PDBDebugModel.md) - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) @@ -422,9 +426,12 @@ Class | Method | HTTP request | Description - [TTPSElement](docs/TTPSElement.md) - [TTPSOccurance](docs/TTPSOccurance.md) - [Tag](docs/Tag.md) + - [TagConfidenceBody](docs/TagConfidenceBody.md) + - [TagOriginBoxPlotConfidence](docs/TagOriginBoxPlotConfidence.md) - [TagResponse](docs/TagResponse.md) - [TagSearchResponse](docs/TagSearchResponse.md) - [TagSearchResult](docs/TagSearchResult.md) + - [Tags](docs/Tags.md) - [TaskResponse](docs/TaskResponse.md) - [TaskStatus](docs/TaskStatus.md) - [TimestampModel](docs/TimestampModel.md) diff --git a/docs/BaseResponseListTagOriginBoxPlotConfidence.md b/docs/BaseResponseListTagOriginBoxPlotConfidence.md new file mode 100644 index 0000000..933ec97 --- /dev/null +++ b/docs/BaseResponseListTagOriginBoxPlotConfidence.md @@ -0,0 +1,33 @@ +# BaseResponseListTagOriginBoxPlotConfidence + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **bool** | Response status on whether the request succeeded | [optional] [default to True] +**data** | [**List[TagOriginBoxPlotConfidence]**](TagOriginBoxPlotConfidence.md) | | [optional] +**message** | **str** | | [optional] +**errors** | [**List[ErrorModel]**](ErrorModel.md) | | [optional] +**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] + +## Example + +```python +from revengai.models.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence + +# TODO update the JSON string below +json = "{}" +# create an instance of BaseResponseListTagOriginBoxPlotConfidence from a JSON string +base_response_list_tag_origin_box_plot_confidence_instance = BaseResponseListTagOriginBoxPlotConfidence.from_json(json) +# print the JSON string representation of the object +print(BaseResponseListTagOriginBoxPlotConfidence.to_json()) + +# convert the object into a dict +base_response_list_tag_origin_box_plot_confidence_dict = base_response_list_tag_origin_box_plot_confidence_instance.to_dict() +# create an instance of BaseResponseListTagOriginBoxPlotConfidence from a dict +base_response_list_tag_origin_box_plot_confidence_from_dict = BaseResponseListTagOriginBoxPlotConfidence.from_dict(base_response_list_tag_origin_box_plot_confidence_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/BoxPlotConfidence.md b/docs/BoxPlotConfidence.md new file mode 100644 index 0000000..46d0933 --- /dev/null +++ b/docs/BoxPlotConfidence.md @@ -0,0 +1,36 @@ +# BoxPlotConfidence + +Format for confidence - returned in the box plot format + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**min** | **float** | | +**max** | **float** | | +**average** | **float** | | +**upper_quartile** | **float** | | +**lower_quartile** | **float** | | +**positive_count** | **int** | | +**negative_count** | **int** | | + +## Example + +```python +from revengai.models.box_plot_confidence import BoxPlotConfidence + +# TODO update the JSON string below +json = "{}" +# create an instance of BoxPlotConfidence from a JSON string +box_plot_confidence_instance = BoxPlotConfidence.from_json(json) +# print the JSON string representation of the object +print(BoxPlotConfidence.to_json()) + +# convert the object into a dict +box_plot_confidence_dict = box_plot_confidence_instance.to_dict() +# create an instance of BoxPlotConfidence from a dict +box_plot_confidence_from_dict = BoxPlotConfidence.from_dict(box_plot_confidence_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/ConfidenceApi.md b/docs/ConfidenceApi.md new file mode 100644 index 0000000..a4a53e4 --- /dev/null +++ b/docs/ConfidenceApi.md @@ -0,0 +1,92 @@ +# revengai.ConfidenceApi + +All URIs are relative to *https://api.reveng.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_analysis_tag_score**](ConfidenceApi.md#get_analysis_tag_score) | **POST** /v2/confidence/analysis/{analysis_id}/tag_score | Calculate Tag Confidence Score for an Analysis + + +# **get_analysis_tag_score** +> BaseResponseListTagOriginBoxPlotConfidence get_analysis_tag_score(analysis_id, tag_confidence_body) + +Calculate Tag Confidence Score for an Analysis + +Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence +from revengai.models.tag_confidence_body import TagConfidenceBody +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.ConfidenceApi(api_client) + analysis_id = 56 # int | The analysis to calculate the tag scores for + tag_confidence_body = revengai.TagConfidenceBody() # TagConfidenceBody | + + try: + # Calculate Tag Confidence Score for an Analysis + api_response = api_instance.get_analysis_tag_score(analysis_id, tag_confidence_body) + print("The response of ConfidenceApi->get_analysis_tag_score:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ConfidenceApi->get_analysis_tag_score: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| The analysis to calculate the tag scores for | + **tag_confidence_body** | [**TagConfidenceBody**](TagConfidenceBody.md)| | + +### Return type + +[**BaseResponseListTagOriginBoxPlotConfidence**](BaseResponseListTagOriginBoxPlotConfidence.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/Origin.md b/docs/Origin.md new file mode 100644 index 0000000..e067563 --- /dev/null +++ b/docs/Origin.md @@ -0,0 +1,24 @@ +# Origin + + +## Enum + +* `REV_ENG_MINUS_MALWARE` (value: `'RevEng-Malware'`) + +* `REV_ENG_MINUS_LIBRARY` (value: `'RevEng-Library'`) + +* `REV_ENG_MINUS_BENIGN` (value: `'RevEng-Benign'`) + +* `REVENG` (value: `'RevEng'`) + +* `REV_ENG_MINUS_HEURISTIC` (value: `'RevEng-Heuristic'`) + +* `REV_ENG_MINUS_UNKNOWN` (value: `'RevEng-Unknown'`) + +* `VIRUSTOTAL` (value: `'VirusTotal'`) + +* `MALWAREBAZAAR` (value: `'MalwareBazaar'`) + +[[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/TagConfidenceBody.md b/docs/TagConfidenceBody.md new file mode 100644 index 0000000..ee5d2fe --- /dev/null +++ b/docs/TagConfidenceBody.md @@ -0,0 +1,29 @@ +# TagConfidenceBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tags** | [**List[Tags]**](Tags.md) | | + +## Example + +```python +from revengai.models.tag_confidence_body import TagConfidenceBody + +# TODO update the JSON string below +json = "{}" +# create an instance of TagConfidenceBody from a JSON string +tag_confidence_body_instance = TagConfidenceBody.from_json(json) +# print the JSON string representation of the object +print(TagConfidenceBody.to_json()) + +# convert the object into a dict +tag_confidence_body_dict = tag_confidence_body_instance.to_dict() +# create an instance of TagConfidenceBody from a dict +tag_confidence_body_from_dict = TagConfidenceBody.from_dict(tag_confidence_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TagOriginBoxPlotConfidence.md b/docs/TagOriginBoxPlotConfidence.md new file mode 100644 index 0000000..3fb5dcb --- /dev/null +++ b/docs/TagOriginBoxPlotConfidence.md @@ -0,0 +1,30 @@ +# TagOriginBoxPlotConfidence + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tag** | [**Tags**](Tags.md) | | +**box_plot** | [**BoxPlotConfidence**](BoxPlotConfidence.md) | | + +## Example + +```python +from revengai.models.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence + +# TODO update the JSON string below +json = "{}" +# create an instance of TagOriginBoxPlotConfidence from a JSON string +tag_origin_box_plot_confidence_instance = TagOriginBoxPlotConfidence.from_json(json) +# print the JSON string representation of the object +print(TagOriginBoxPlotConfidence.to_json()) + +# convert the object into a dict +tag_origin_box_plot_confidence_dict = tag_origin_box_plot_confidence_instance.to_dict() +# create an instance of TagOriginBoxPlotConfidence from a dict +tag_origin_box_plot_confidence_from_dict = TagOriginBoxPlotConfidence.from_dict(tag_origin_box_plot_confidence_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/Tags.md b/docs/Tags.md new file mode 100644 index 0000000..5cd630b --- /dev/null +++ b/docs/Tags.md @@ -0,0 +1,30 @@ +# Tags + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tag** | **str** | The tag name | +**origin** | [**Origin**](Origin.md) | The origin of the tag | + +## Example + +```python +from revengai.models.tags import Tags + +# TODO update the JSON string below +json = "{}" +# create an instance of Tags from a JSON string +tags_instance = Tags.from_json(json) +# print the JSON string representation of the object +print(Tags.to_json()) + +# convert the object into a dict +tags_dict = tags_instance.to_dict() +# create an instance of Tags from a dict +tags_from_dict = Tags.from_dict(tags_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/revengai/__init__.py b/revengai/__init__.py index f122a7a..47d6541 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v2.11.0" +__version__ = "v2.11.7" # Define package exports __all__ = [ @@ -25,6 +25,7 @@ "AuthenticationUsersApi", "BinariesApi", "CollectionsApi", + "ConfidenceApi", "ExternalSourcesApi", "FirmwareApi", "FunctionsAIDecompilationApi", @@ -124,6 +125,7 @@ "BaseResponseListDieMatch", "BaseResponseListFunctionNameHistory", "BaseResponseListSBOM", + "BaseResponseListTagOriginBoxPlotConfidence", "BaseResponseListUserActivityResponse", "BaseResponseLoginResponse", "BaseResponseLogs", @@ -156,6 +158,7 @@ "BinaryTaskStatus", "Block", "BlockCommentsGenerationForFunctionResponse", + "BoxPlotConfidence", "CalleeFunctionInfo", "CalleesCallerFunctionsResponse", "CallerFunctionInfo", @@ -271,6 +274,7 @@ "NetworkOverviewMetadata", "NetworkOverviewResponse", "Order", + "Origin", "PDBDebugModel", "PEModel", "PaginationModel", @@ -314,9 +318,12 @@ "TTPSElement", "TTPSOccurance", "Tag", + "TagConfidenceBody", + "TagOriginBoxPlotConfidence", "TagResponse", "TagSearchResponse", "TagSearchResult", + "Tags", "TaskResponse", "TaskStatus", "TimestampModel", @@ -341,6 +348,7 @@ from revengai.api.authentication_users_api import AuthenticationUsersApi as AuthenticationUsersApi from revengai.api.binaries_api import BinariesApi as BinariesApi from revengai.api.collections_api import CollectionsApi as CollectionsApi +from revengai.api.confidence_api import ConfidenceApi as ConfidenceApi from revengai.api.external_sources_api import ExternalSourcesApi as ExternalSourcesApi from revengai.api.firmware_api import FirmwareApi as FirmwareApi from revengai.api.functions_ai_decompilation_api import FunctionsAIDecompilationApi as FunctionsAIDecompilationApi @@ -444,6 +452,7 @@ from revengai.models.base_response_list_die_match import BaseResponseListDieMatch as BaseResponseListDieMatch from revengai.models.base_response_list_function_name_history import BaseResponseListFunctionNameHistory as BaseResponseListFunctionNameHistory from revengai.models.base_response_list_sbom import BaseResponseListSBOM as BaseResponseListSBOM +from revengai.models.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence as BaseResponseListTagOriginBoxPlotConfidence from revengai.models.base_response_list_user_activity_response import BaseResponseListUserActivityResponse as BaseResponseListUserActivityResponse from revengai.models.base_response_login_response import BaseResponseLoginResponse as BaseResponseLoginResponse from revengai.models.base_response_logs import BaseResponseLogs as BaseResponseLogs @@ -476,6 +485,7 @@ from revengai.models.binary_task_status import BinaryTaskStatus as BinaryTaskStatus from revengai.models.block import Block as Block from revengai.models.block_comments_generation_for_function_response import BlockCommentsGenerationForFunctionResponse as BlockCommentsGenerationForFunctionResponse +from revengai.models.box_plot_confidence import BoxPlotConfidence as BoxPlotConfidence from revengai.models.callee_function_info import CalleeFunctionInfo as CalleeFunctionInfo from revengai.models.callees_caller_functions_response import CalleesCallerFunctionsResponse as CalleesCallerFunctionsResponse from revengai.models.caller_function_info import CallerFunctionInfo as CallerFunctionInfo @@ -591,6 +601,7 @@ from revengai.models.network_overview_metadata import NetworkOverviewMetadata as NetworkOverviewMetadata from revengai.models.network_overview_response import NetworkOverviewResponse as NetworkOverviewResponse from revengai.models.order import Order as Order +from revengai.models.origin import Origin as Origin from revengai.models.pdb_debug_model import PDBDebugModel as PDBDebugModel from revengai.models.pe_model import PEModel as PEModel from revengai.models.pagination_model import PaginationModel as PaginationModel @@ -634,9 +645,12 @@ from revengai.models.ttps_element import TTPSElement as TTPSElement from revengai.models.ttps_occurance import TTPSOccurance as TTPSOccurance from revengai.models.tag import Tag as Tag +from revengai.models.tag_confidence_body import TagConfidenceBody as TagConfidenceBody +from revengai.models.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence as TagOriginBoxPlotConfidence from revengai.models.tag_response import TagResponse as TagResponse from revengai.models.tag_search_response import TagSearchResponse as TagSearchResponse from revengai.models.tag_search_result import TagSearchResult as TagSearchResult +from revengai.models.tags import Tags as Tags from revengai.models.task_response import TaskResponse as TaskResponse from revengai.models.task_status import TaskStatus as TaskStatus from revengai.models.timestamp_model import TimestampModel as TimestampModel diff --git a/revengai/api/__init__.py b/revengai/api/__init__.py index 8d6f02d..e4e7c87 100644 --- a/revengai/api/__init__.py +++ b/revengai/api/__init__.py @@ -9,6 +9,7 @@ from revengai.api.authentication_users_api import AuthenticationUsersApi from revengai.api.binaries_api import BinariesApi from revengai.api.collections_api import CollectionsApi +from revengai.api.confidence_api import ConfidenceApi from revengai.api.external_sources_api import ExternalSourcesApi from revengai.api.firmware_api import FirmwareApi from revengai.api.functions_ai_decompilation_api import FunctionsAIDecompilationApi diff --git a/revengai/api/confidence_api.py b/revengai/api/confidence_api.py new file mode 100644 index 0000000..c08f2d4 --- /dev/null +++ b/revengai/api/confidence_api.py @@ -0,0 +1,330 @@ +# 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 warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt +from typing_extensions import Annotated +from revengai.models.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence +from revengai.models.tag_confidence_body import TagConfidenceBody + +from revengai.api_client import ApiClient, RequestSerialized +from revengai.api_response import ApiResponse +from revengai.rest import RESTResponseType + + +class ConfidenceApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_analysis_tag_score( + self, + analysis_id: Annotated[StrictInt, Field(description="The analysis to calculate the tag scores for")], + tag_confidence_body: TagConfidenceBody, + _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, + ) -> BaseResponseListTagOriginBoxPlotConfidence: + """Calculate Tag Confidence Score for an Analysis + + Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + + :param analysis_id: The analysis to calculate the tag scores for (required) + :type analysis_id: int + :param tag_confidence_body: (required) + :type tag_confidence_body: TagConfidenceBody + :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._get_analysis_tag_score_serialize( + analysis_id=analysis_id, + tag_confidence_body=tag_confidence_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseListTagOriginBoxPlotConfidence", + '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 get_analysis_tag_score_with_http_info( + self, + analysis_id: Annotated[StrictInt, Field(description="The analysis to calculate the tag scores for")], + tag_confidence_body: TagConfidenceBody, + _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[BaseResponseListTagOriginBoxPlotConfidence]: + """Calculate Tag Confidence Score for an Analysis + + Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + + :param analysis_id: The analysis to calculate the tag scores for (required) + :type analysis_id: int + :param tag_confidence_body: (required) + :type tag_confidence_body: TagConfidenceBody + :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._get_analysis_tag_score_serialize( + analysis_id=analysis_id, + tag_confidence_body=tag_confidence_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseListTagOriginBoxPlotConfidence", + '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 get_analysis_tag_score_without_preload_content( + self, + analysis_id: Annotated[StrictInt, Field(description="The analysis to calculate the tag scores for")], + tag_confidence_body: TagConfidenceBody, + _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: + """Calculate Tag Confidence Score for an Analysis + + Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + + :param analysis_id: The analysis to calculate the tag scores for (required) + :type analysis_id: int + :param tag_confidence_body: (required) + :type tag_confidence_body: TagConfidenceBody + :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._get_analysis_tag_score_serialize( + analysis_id=analysis_id, + tag_confidence_body=tag_confidence_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseListTagOriginBoxPlotConfidence", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_analysis_tag_score_serialize( + self, + analysis_id, + tag_confidence_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if tag_confidence_body is not None: + _body_params = tag_confidence_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/confidence/analysis/{analysis_id}/tag_score', + 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 2028b1f..5b3a063 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/v2.11.0/python' + self.user_agent = 'OpenAPI-Generator/v2.11.7/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 3a0f012..456892c 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: v2.11.0\n"\ - "SDK Package Version: v2.11.0".\ + "Version of the API: v2.11.7\n"\ + "SDK Package Version: v2.11.7".\ 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 5887412..0cf6497 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -92,6 +92,7 @@ from revengai.models.base_response_list_die_match import BaseResponseListDieMatch from revengai.models.base_response_list_function_name_history import BaseResponseListFunctionNameHistory from revengai.models.base_response_list_sbom import BaseResponseListSBOM +from revengai.models.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence from revengai.models.base_response_list_user_activity_response import BaseResponseListUserActivityResponse from revengai.models.base_response_login_response import BaseResponseLoginResponse from revengai.models.base_response_logs import BaseResponseLogs @@ -124,6 +125,7 @@ from revengai.models.binary_task_status import BinaryTaskStatus from revengai.models.block import Block from revengai.models.block_comments_generation_for_function_response import BlockCommentsGenerationForFunctionResponse +from revengai.models.box_plot_confidence import BoxPlotConfidence from revengai.models.callee_function_info import CalleeFunctionInfo from revengai.models.callees_caller_functions_response import CalleesCallerFunctionsResponse from revengai.models.caller_function_info import CallerFunctionInfo @@ -239,6 +241,7 @@ from revengai.models.network_overview_metadata import NetworkOverviewMetadata from revengai.models.network_overview_response import NetworkOverviewResponse from revengai.models.order import Order +from revengai.models.origin import Origin from revengai.models.pdb_debug_model import PDBDebugModel from revengai.models.pe_model import PEModel from revengai.models.pagination_model import PaginationModel @@ -282,9 +285,12 @@ from revengai.models.ttps_element import TTPSElement from revengai.models.ttps_occurance import TTPSOccurance from revengai.models.tag import Tag +from revengai.models.tag_confidence_body import TagConfidenceBody +from revengai.models.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence from revengai.models.tag_response import TagResponse from revengai.models.tag_search_response import TagSearchResponse from revengai.models.tag_search_result import TagSearchResult +from revengai.models.tags import Tags from revengai.models.task_response import TaskResponse from revengai.models.task_status import TaskStatus from revengai.models.timestamp_model import TimestampModel diff --git a/revengai/models/base_response_list_tag_origin_box_plot_confidence.py b/revengai/models/base_response_list_tag_origin_box_plot_confidence.py new file mode 100644 index 0000000..6829a83 --- /dev/null +++ b/revengai/models/base_response_list_tag_origin_box_plot_confidence.py @@ -0,0 +1,129 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.error_model import ErrorModel +from revengai.models.meta_model import MetaModel +from revengai.models.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence +from typing import Optional, Set +from typing_extensions import Self + +class BaseResponseListTagOriginBoxPlotConfidence(BaseModel): + """ + BaseResponseListTagOriginBoxPlotConfidence + """ # noqa: E501 + status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded") + data: Optional[List[TagOriginBoxPlotConfidence]] = None + message: Optional[StrictStr] = None + errors: Optional[List[ErrorModel]] = None + meta: Optional[MetaModel] = Field(default=None, description="Metadata") + __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"] + + 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 BaseResponseListTagOriginBoxPlotConfidence 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 item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if errors (nullable) is None + # and model_fields_set contains the field + if self.errors is None and "errors" in self.model_fields_set: + _dict['errors'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseResponseListTagOriginBoxPlotConfidence from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") if obj.get("status") is not None else True, + "data": [TagOriginBoxPlotConfidence.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "message": obj.get("message"), + "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None + }) + return _obj + + diff --git a/revengai/models/box_plot_confidence.py b/revengai/models/box_plot_confidence.py new file mode 100644 index 0000000..a42b3e8 --- /dev/null +++ b/revengai/models/box_plot_confidence.py @@ -0,0 +1,98 @@ +# 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, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class BoxPlotConfidence(BaseModel): + """ + Format for confidence - returned in the box plot format + """ # noqa: E501 + min: Union[StrictFloat, StrictInt] + max: Union[StrictFloat, StrictInt] + average: Union[StrictFloat, StrictInt] + upper_quartile: Union[StrictFloat, StrictInt] + lower_quartile: Union[StrictFloat, StrictInt] + positive_count: StrictInt + negative_count: StrictInt + __properties: ClassVar[List[str]] = ["min", "max", "average", "upper_quartile", "lower_quartile", "positive_count", "negative_count"] + + 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 BoxPlotConfidence 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 BoxPlotConfidence from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "min": obj.get("min"), + "max": obj.get("max"), + "average": obj.get("average"), + "upper_quartile": obj.get("upper_quartile"), + "lower_quartile": obj.get("lower_quartile"), + "positive_count": obj.get("positive_count"), + "negative_count": obj.get("negative_count") + }) + return _obj + + diff --git a/revengai/models/origin.py b/revengai/models/origin.py new file mode 100644 index 0000000..76b8400 --- /dev/null +++ b/revengai/models/origin.py @@ -0,0 +1,42 @@ +# 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 json +from enum import Enum +from typing_extensions import Self + + +class Origin(str, Enum): + """ + Origin + """ + + """ + allowed enum values + """ + REV_ENG_MINUS_MALWARE = 'RevEng-Malware' + REV_ENG_MINUS_LIBRARY = 'RevEng-Library' + REV_ENG_MINUS_BENIGN = 'RevEng-Benign' + REVENG = 'RevEng' + REV_ENG_MINUS_HEURISTIC = 'RevEng-Heuristic' + REV_ENG_MINUS_UNKNOWN = 'RevEng-Unknown' + VIRUSTOTAL = 'VirusTotal' + MALWAREBAZAAR = 'MalwareBazaar' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Origin from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/revengai/models/tag_confidence_body.py b/revengai/models/tag_confidence_body.py new file mode 100644 index 0000000..b604cd4 --- /dev/null +++ b/revengai/models/tag_confidence_body.py @@ -0,0 +1,95 @@ +# 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 +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from revengai.models.tags import Tags +from typing import Optional, Set +from typing_extensions import Self + +class TagConfidenceBody(BaseModel): + """ + TagConfidenceBody + """ # noqa: E501 + tags: Annotated[List[Tags], Field(min_length=1, max_length=10)] + __properties: ClassVar[List[str]] = ["tags"] + + 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 TagConfidenceBody 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 item in tags (list) + _items = [] + if self.tags: + for _item_tags in self.tags: + if _item_tags: + _items.append(_item_tags.to_dict()) + _dict['tags'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TagConfidenceBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tags": [Tags.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None + }) + return _obj + + diff --git a/revengai/models/tag_origin_box_plot_confidence.py b/revengai/models/tag_origin_box_plot_confidence.py new file mode 100644 index 0000000..6f7ce34 --- /dev/null +++ b/revengai/models/tag_origin_box_plot_confidence.py @@ -0,0 +1,96 @@ +# 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 +from revengai.models.box_plot_confidence import BoxPlotConfidence +from revengai.models.tags import Tags +from typing import Optional, Set +from typing_extensions import Self + +class TagOriginBoxPlotConfidence(BaseModel): + """ + TagOriginBoxPlotConfidence + """ # noqa: E501 + tag: Tags + box_plot: BoxPlotConfidence + __properties: ClassVar[List[str]] = ["tag", "box_plot"] + + 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 TagOriginBoxPlotConfidence 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 tag + if self.tag: + _dict['tag'] = self.tag.to_dict() + # override the default output from pydantic by calling `to_dict()` of box_plot + if self.box_plot: + _dict['box_plot'] = self.box_plot.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TagOriginBoxPlotConfidence from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tag": Tags.from_dict(obj["tag"]) if obj.get("tag") is not None else None, + "box_plot": BoxPlotConfidence.from_dict(obj["box_plot"]) if obj.get("box_plot") is not None else None + }) + return _obj + + diff --git a/revengai/models/tags.py b/revengai/models/tags.py new file mode 100644 index 0000000..be76a18 --- /dev/null +++ b/revengai/models/tags.py @@ -0,0 +1,89 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from revengai.models.origin import Origin +from typing import Optional, Set +from typing_extensions import Self + +class Tags(BaseModel): + """ + Tags + """ # noqa: E501 + tag: StrictStr = Field(description="The tag name") + origin: Origin = Field(description="The origin of the tag") + __properties: ClassVar[List[str]] = ["tag", "origin"] + + 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 Tags 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 Tags from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tag": obj.get("tag"), + "origin": obj.get("origin") + }) + return _obj + + diff --git a/test/test_base_response_list_tag_origin_box_plot_confidence.py b/test/test_base_response_list_tag_origin_box_plot_confidence.py new file mode 100644 index 0000000..65458e0 --- /dev/null +++ b/test/test_base_response_list_tag_origin_box_plot_confidence.py @@ -0,0 +1,75 @@ +# 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.base_response_list_tag_origin_box_plot_confidence import BaseResponseListTagOriginBoxPlotConfidence + +class TestBaseResponseListTagOriginBoxPlotConfidence(unittest.TestCase): + """BaseResponseListTagOriginBoxPlotConfidence unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BaseResponseListTagOriginBoxPlotConfidence: + """Test BaseResponseListTagOriginBoxPlotConfidence + 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 `BaseResponseListTagOriginBoxPlotConfidence` + """ + model = BaseResponseListTagOriginBoxPlotConfidence() + if include_optional: + return BaseResponseListTagOriginBoxPlotConfidence( + status = True, + data = [ + revengai.models.tag_origin_box_plot_confidence.TagOriginBoxPlotConfidence( + tag = revengai.models.tags.Tags( + tag = '', + origin = 'RevEng-Malware', ), + box_plot = revengai.models.box_plot_confidence.BoxPlotConfidence( + min = 1.337, + max = 1.337, + average = 1.337, + upper_quartile = 1.337, + lower_quartile = 1.337, + positive_count = 56, + negative_count = 56, ), ) + ], + message = '', + errors = [ + revengai.models.error_model.ErrorModel( + code = '', + message = '', ) + ], + meta = revengai.models.meta_model.MetaModel( + pagination = revengai.models.pagination_model.PaginationModel( + page_size = 56, + page_number = 56, + has_next_page = True, ), ) + ) + else: + return BaseResponseListTagOriginBoxPlotConfidence( + ) + """ + + def testBaseResponseListTagOriginBoxPlotConfidence(self): + """Test BaseResponseListTagOriginBoxPlotConfidence""" + # 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_box_plot_confidence.py b/test/test_box_plot_confidence.py new file mode 100644 index 0000000..3480cc6 --- /dev/null +++ b/test/test_box_plot_confidence.py @@ -0,0 +1,63 @@ +# 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.box_plot_confidence import BoxPlotConfidence + +class TestBoxPlotConfidence(unittest.TestCase): + """BoxPlotConfidence unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BoxPlotConfidence: + """Test BoxPlotConfidence + 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 `BoxPlotConfidence` + """ + model = BoxPlotConfidence() + if include_optional: + return BoxPlotConfidence( + min = 1.337, + max = 1.337, + average = 1.337, + upper_quartile = 1.337, + lower_quartile = 1.337, + positive_count = 56, + negative_count = 56 + ) + else: + return BoxPlotConfidence( + min = 1.337, + max = 1.337, + average = 1.337, + upper_quartile = 1.337, + lower_quartile = 1.337, + positive_count = 56, + negative_count = 56, + ) + """ + + def testBoxPlotConfidence(self): + """Test BoxPlotConfidence""" + # 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_confidence_api.py b/test/test_confidence_api.py new file mode 100644 index 0000000..8bf59e6 --- /dev/null +++ b/test/test_confidence_api.py @@ -0,0 +1,37 @@ +# 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.api.confidence_api import ConfidenceApi + + +class TestConfidenceApi(unittest.TestCase): + """ConfidenceApi unit test stubs""" + + def setUp(self) -> None: + self.api = ConfidenceApi() + + def tearDown(self) -> None: + pass + + def test_get_analysis_tag_score(self) -> None: + """Test case for get_analysis_tag_score + + Calculate Tag Confidence Score for an Analysis + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_origin.py b/test/test_origin.py new file mode 100644 index 0000000..2eab0e6 --- /dev/null +++ b/test/test_origin.py @@ -0,0 +1,32 @@ +# 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.origin import Origin + +class TestOrigin(unittest.TestCase): + """Origin unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOrigin(self): + """Test Origin""" + # inst = Origin() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_tag_confidence_body.py b/test/test_tag_confidence_body.py new file mode 100644 index 0000000..831ea50 --- /dev/null +++ b/test/test_tag_confidence_body.py @@ -0,0 +1,59 @@ +# 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.tag_confidence_body import TagConfidenceBody + +class TestTagConfidenceBody(unittest.TestCase): + """TagConfidenceBody unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TagConfidenceBody: + """Test TagConfidenceBody + 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 `TagConfidenceBody` + """ + model = TagConfidenceBody() + if include_optional: + return TagConfidenceBody( + tags = [ + revengai.models.tags.Tags( + tag = '', + origin = 'RevEng-Malware', ) + ] + ) + else: + return TagConfidenceBody( + tags = [ + revengai.models.tags.Tags( + tag = '', + origin = 'RevEng-Malware', ) + ], + ) + """ + + def testTagConfidenceBody(self): + """Test TagConfidenceBody""" + # 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_tag_origin_box_plot_confidence.py b/test/test_tag_origin_box_plot_confidence.py new file mode 100644 index 0000000..a8cc7cf --- /dev/null +++ b/test/test_tag_origin_box_plot_confidence.py @@ -0,0 +1,71 @@ +# 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.tag_origin_box_plot_confidence import TagOriginBoxPlotConfidence + +class TestTagOriginBoxPlotConfidence(unittest.TestCase): + """TagOriginBoxPlotConfidence unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TagOriginBoxPlotConfidence: + """Test TagOriginBoxPlotConfidence + 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 `TagOriginBoxPlotConfidence` + """ + model = TagOriginBoxPlotConfidence() + if include_optional: + return TagOriginBoxPlotConfidence( + tag = revengai.models.tags.Tags( + tag = '', + origin = 'RevEng-Malware', ), + box_plot = revengai.models.box_plot_confidence.BoxPlotConfidence( + min = 1.337, + max = 1.337, + average = 1.337, + upper_quartile = 1.337, + lower_quartile = 1.337, + positive_count = 56, + negative_count = 56, ) + ) + else: + return TagOriginBoxPlotConfidence( + tag = revengai.models.tags.Tags( + tag = '', + origin = 'RevEng-Malware', ), + box_plot = revengai.models.box_plot_confidence.BoxPlotConfidence( + min = 1.337, + max = 1.337, + average = 1.337, + upper_quartile = 1.337, + lower_quartile = 1.337, + positive_count = 56, + negative_count = 56, ), + ) + """ + + def testTagOriginBoxPlotConfidence(self): + """Test TagOriginBoxPlotConfidence""" + # 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_tags.py b/test/test_tags.py new file mode 100644 index 0000000..cbbab84 --- /dev/null +++ b/test/test_tags.py @@ -0,0 +1,53 @@ +# 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.tags import Tags + +class TestTags(unittest.TestCase): + """Tags unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tags: + """Test Tags + 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 `Tags` + """ + model = Tags() + if include_optional: + return Tags( + tag = '', + origin = 'RevEng-Malware' + ) + else: + return Tags( + tag = '', + origin = 'RevEng-Malware', + ) + """ + + def testTags(self): + """Test Tags""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()