diff --git a/.sdk-version b/.sdk-version index 32f8572..b0ab92d 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.8.1 +v3.12.0 diff --git a/README.md b/README.md index c798d2a..fc594da 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**get_analysis_logs**](docs/AnalysesCoreApi.md#get_analysis_logs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis *AnalysesCoreApi* | [**get_analysis_params**](docs/AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information *AnalysesCoreApi* | [**get_analysis_status**](docs/AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis +*AnalysesCoreApi* | [**insert_analysis_log**](docs/AnalysesCoreApi.md#insert_analysis_log) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis *AnalysesCoreApi* | [**list_analyses**](docs/AnalysesCoreApi.md#list_analyses) | **GET** /v2/analyses/list | Gets the most recent analyses *AnalysesCoreApi* | [**lookup_binary_id**](docs/AnalysesCoreApi.md#lookup_binary_id) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID *AnalysesCoreApi* | [**requeue_analysis**](docs/AnalysesCoreApi.md#requeue_analysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis @@ -364,6 +365,7 @@ Class | Method | HTTP request | Description - [ISA](docs/ISA.md) - [IconModel](docs/IconModel.md) - [ImportModel](docs/ImportModel.md) + - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InverseFunctionMapItem](docs/InverseFunctionMapItem.md) - [InverseStringMapItem](docs/InverseStringMapItem.md) - [InverseValue](docs/InverseValue.md) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 530a8bc..61af217 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**get_analysis_logs**](AnalysesCoreApi.md#get_analysis_logs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis [**get_analysis_params**](AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information [**get_analysis_status**](AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis +[**insert_analysis_log**](AnalysesCoreApi.md#insert_analysis_log) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis [**list_analyses**](AnalysesCoreApi.md#list_analyses) | **GET** /v2/analyses/list | Gets the most recent analyses [**lookup_binary_id**](AnalysesCoreApi.md#lookup_binary_id) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID [**requeue_analysis**](AnalysesCoreApi.md#requeue_analysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis @@ -586,6 +587,89 @@ 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) +# **insert_analysis_log** +> BaseResponse insert_analysis_log(analysis_id, insert_analysis_log_request) + +Insert a log entry for an analysis + +Inserts a log record for an analysis. Only the analysis owner can insert logs. + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.base_response import BaseResponse +from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest +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) + analysis_id = 56 # int | + insert_analysis_log_request = revengai.InsertAnalysisLogRequest() # InsertAnalysisLogRequest | + + try: + # Insert a log entry for an analysis + api_response = api_instance.insert_analysis_log(analysis_id, insert_analysis_log_request) + print("The response of AnalysesCoreApi->insert_analysis_log:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->insert_analysis_log: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| | + **insert_analysis_log_request** | [**InsertAnalysisLogRequest**](InsertAnalysisLogRequest.md)| | + +### Return type + +[**BaseResponse**](BaseResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Successful Response | - | +**422** | Invalid request parameters | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **list_analyses** > BaseResponseRecent list_analyses(search_term=search_term, workspace=workspace, status=status, model_name=model_name, dynamic_execution_status=dynamic_execution_status, usernames=usernames, sha256_hash=sha256_hash, limit=limit, offset=offset, order_by=order_by, order=order) diff --git a/docs/BaseResponse.md b/docs/BaseResponse.md index 186e173..219e865 100644 --- a/docs/BaseResponse.md +++ b/docs/BaseResponse.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **status** | **bool** | Response status on whether the request succeeded | [optional] [default to True] -**data** | [**AnyOf**](AnyOf.md) | Response data | [optional] +**data** | **object** | | [optional] **message** | **str** | | [optional] **errors** | [**List[ErrorModel]**](ErrorModel.md) | | [optional] **meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] diff --git a/docs/Basic.md b/docs/Basic.md index 1333295..3532b10 100644 --- a/docs/Basic.md +++ b/docs/Basic.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**binary_id** | **int** | The ID of the binary | **binary_name** | **str** | The name of the binary uploaded | **binary_size** | **int** | The size of the binary uploaded (bytes) | **creation** | **datetime** | When the binary was uploaded | diff --git a/docs/InsertAnalysisLogRequest.md b/docs/InsertAnalysisLogRequest.md new file mode 100644 index 0000000..8cdfb7d --- /dev/null +++ b/docs/InsertAnalysisLogRequest.md @@ -0,0 +1,29 @@ +# InsertAnalysisLogRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**log** | **str** | The log message to insert for the analysis | + +## Example + +```python +from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of InsertAnalysisLogRequest from a JSON string +insert_analysis_log_request_instance = InsertAnalysisLogRequest.from_json(json) +# print the JSON string representation of the object +print(InsertAnalysisLogRequest.to_json()) + +# convert the object into a dict +insert_analysis_log_request_dict = insert_analysis_log_request_instance.to_dict() +# create an instance of InsertAnalysisLogRequest from a dict +insert_analysis_log_request_from_dict = InsertAnalysisLogRequest.from_dict(insert_analysis_log_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ModelName.md b/docs/ModelName.md index e326521..b93df23 100644 --- a/docs/ModelName.md +++ b/docs/ModelName.md @@ -16,6 +16,12 @@ Custom enum for the model name * `BINNET_MINUS_0_DOT_7_MINUS_ARM_MINUS_64_MINUS_LINUX` (value: `'binnet-0.7-arm-64-linux'`) +* `BINNET_MINUS_0_DOT_7_MINUS_X86_MINUS_64_MINUS_ANDROID` (value: `'binnet-0.7-x86-64-android'`) + +* `BINNET_MINUS_0_DOT_7_MINUS_X86_MINUS_32_MINUS_ANDROID` (value: `'binnet-0.7-x86-32-android'`) + +* `BINNET_MINUS_0_DOT_7_MINUS_ARM_MINUS_64_MINUS_ANDROID` (value: `'binnet-0.7-arm-64-android'`) + [[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 5aac1f5..c1ce2d7 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.8.1" +__version__ = "v3.12.0" # Define package exports __all__ = [ @@ -259,6 +259,7 @@ "ISA", "IconModel", "ImportModel", + "InsertAnalysisLogRequest", "InverseFunctionMapItem", "InverseStringMapItem", "InverseValue", @@ -587,6 +588,7 @@ from revengai.models.isa import ISA as ISA from revengai.models.icon_model import IconModel as IconModel from revengai.models.import_model import ImportModel as ImportModel +from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest as InsertAnalysisLogRequest from revengai.models.inverse_function_map_item import InverseFunctionMapItem as InverseFunctionMapItem from revengai.models.inverse_string_map_item import InverseStringMapItem as InverseStringMapItem from revengai.models.inverse_value import InverseValue as InverseValue diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 77c66f4..98677dd 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -22,6 +22,7 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy +from revengai.models.base_response import BaseResponse 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 @@ -35,6 +36,7 @@ from revengai.models.base_response_status import BaseResponseStatus from revengai.models.base_response_upload_response import BaseResponseUploadResponse from revengai.models.dynamic_execution_status_input import DynamicExecutionStatusInput +from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest from revengai.models.model_name import ModelName from revengai.models.order import Order from revengai.models.re_analysis_form import ReAnalysisForm @@ -1948,6 +1950,298 @@ def _get_analysis_status_serialize( + @validate_call + def insert_analysis_log( + self, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, + _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, + ) -> BaseResponse: + """Insert a log entry for an analysis + + Inserts a log record for an analysis. Only the analysis owner can insert logs. + + :param analysis_id: (required) + :type analysis_id: int + :param insert_analysis_log_request: (required) + :type insert_analysis_log_request: InsertAnalysisLogRequest + :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._insert_analysis_log_serialize( + analysis_id=analysis_id, + insert_analysis_log_request=insert_analysis_log_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BaseResponse", + '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 insert_analysis_log_with_http_info( + self, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, + _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[BaseResponse]: + """Insert a log entry for an analysis + + Inserts a log record for an analysis. Only the analysis owner can insert logs. + + :param analysis_id: (required) + :type analysis_id: int + :param insert_analysis_log_request: (required) + :type insert_analysis_log_request: InsertAnalysisLogRequest + :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._insert_analysis_log_serialize( + analysis_id=analysis_id, + insert_analysis_log_request=insert_analysis_log_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BaseResponse", + '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 insert_analysis_log_without_preload_content( + self, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, + _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: + """Insert a log entry for an analysis + + Inserts a log record for an analysis. Only the analysis owner can insert logs. + + :param analysis_id: (required) + :type analysis_id: int + :param insert_analysis_log_request: (required) + :type insert_analysis_log_request: InsertAnalysisLogRequest + :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._insert_analysis_log_serialize( + analysis_id=analysis_id, + insert_analysis_log_request=insert_analysis_log_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "BaseResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _insert_analysis_log_serialize( + self, + analysis_id, + insert_analysis_log_request, + _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 insert_analysis_log_request is not None: + _body_params = insert_analysis_log_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/analyses/{analysis_id}/logs', + 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 list_analyses( self, diff --git a/revengai/api_client.py b/revengai/api_client.py index c09e1ab..2914080 100644 --- a/revengai/api_client.py +++ b/revengai/api_client.py @@ -90,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/v3.8.1/python' + self.user_agent = 'OpenAPI-Generator/v3.12.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 7627b10..6c3b1bc 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -533,8 +533,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v3.8.1\n"\ - "SDK Package Version: v3.8.1".\ + "Version of the API: v3.12.0\n"\ + "SDK Package Version: v3.12.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 ab0ca5a..2536248 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -226,6 +226,7 @@ from revengai.models.isa import ISA from revengai.models.icon_model import IconModel from revengai.models.import_model import ImportModel +from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest from revengai.models.inverse_function_map_item import InverseFunctionMapItem from revengai.models.inverse_string_map_item import InverseStringMapItem from revengai.models.inverse_value import InverseValue diff --git a/revengai/models/base_response.py b/revengai/models/base_response.py index 2916d76..ece9668 100644 --- a/revengai/models/base_response.py +++ b/revengai/models/base_response.py @@ -28,7 +28,7 @@ class BaseResponse(BaseModel): BaseResponse """ # noqa: E501 status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded") - data: Optional[Any] = Field(default=None, description="Response data") + data: Optional[Dict[str, Any]] = None message: Optional[StrictStr] = None errors: Optional[List[ErrorModel]] = None meta: Optional[MetaModel] = Field(default=None, description="Metadata") @@ -73,9 +73,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of data - if self.data: - _dict['data'] = self.data.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in errors (list) _items = [] if self.errors: @@ -114,7 +111,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "status": obj.get("status") if obj.get("status") is not None else True, - "data": AnyOf.from_dict(obj["data"]) if obj.get("data") is not None else None, + "data": obj.get("data"), "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 diff --git a/revengai/models/basic.py b/revengai/models/basic.py index 1b0d0dd..2b546b3 100644 --- a/revengai/models/basic.py +++ b/revengai/models/basic.py @@ -26,6 +26,7 @@ class Basic(BaseModel): """ Basic """ # noqa: E501 + binary_id: StrictInt = Field(description="The ID of the binary") binary_name: StrictStr = Field(description="The name of the binary uploaded") binary_size: StrictInt = Field(description="The size of the binary uploaded (bytes)") creation: datetime = Field(description="When the binary was uploaded") @@ -42,7 +43,7 @@ class Basic(BaseModel): base_address: Optional[StrictInt] binary_uuid: Optional[StrictStr] = None sequencer_version: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address", "binary_uuid", "sequencer_version"] + __properties: ClassVar[List[str]] = ["binary_id", "binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address", "binary_uuid", "sequencer_version"] model_config = ConfigDict( populate_by_name=True, @@ -110,6 +111,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "binary_id": obj.get("binary_id"), "binary_name": obj.get("binary_name"), "binary_size": obj.get("binary_size"), "creation": obj.get("creation"), diff --git a/revengai/models/insert_analysis_log_request.py b/revengai/models/insert_analysis_log_request.py new file mode 100644 index 0000000..c88ef1d --- /dev/null +++ b/revengai/models/insert_analysis_log_request.py @@ -0,0 +1,87 @@ +# 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 typing import Optional, Set +from typing_extensions import Self + +class InsertAnalysisLogRequest(BaseModel): + """ + InsertAnalysisLogRequest + """ # noqa: E501 + log: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The log message to insert for the analysis") + __properties: ClassVar[List[str]] = ["log"] + + 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 InsertAnalysisLogRequest 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 InsertAnalysisLogRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "log": obj.get("log") + }) + return _obj + + diff --git a/revengai/models/model_name.py b/revengai/models/model_name.py index b7fa438..1f5489e 100644 --- a/revengai/models/model_name.py +++ b/revengai/models/model_name.py @@ -31,6 +31,9 @@ class ModelName(str, Enum): BINNET_MINUS_0_DOT_7_MINUS_X86_MINUS_32_MINUS_LINUX = 'binnet-0.7-x86-32-linux' BINNET_MINUS_0_DOT_7_MINUS_ARM_MINUS_64_MINUS_WINDOWS = 'binnet-0.7-arm-64-windows' BINNET_MINUS_0_DOT_7_MINUS_ARM_MINUS_64_MINUS_LINUX = 'binnet-0.7-arm-64-linux' + BINNET_MINUS_0_DOT_7_MINUS_X86_MINUS_64_MINUS_ANDROID = 'binnet-0.7-x86-64-android' + BINNET_MINUS_0_DOT_7_MINUS_X86_MINUS_32_MINUS_ANDROID = 'binnet-0.7-x86-32-android' + BINNET_MINUS_0_DOT_7_MINUS_ARM_MINUS_64_MINUS_ANDROID = 'binnet-0.7-arm-64-android' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/test/test_analyses_core_api.py b/test/test_analyses_core_api.py index da999c7..010c482 100644 --- a/test/test_analyses_core_api.py +++ b/test/test_analyses_core_api.py @@ -74,6 +74,13 @@ def test_get_analysis_status(self) -> None: """ pass + def test_insert_analysis_log(self) -> None: + """Test case for insert_analysis_log + + Insert a log entry for an analysis + """ + pass + def test_list_analyses(self) -> None: """Test case for list_analyses diff --git a/test/test_base_response_basic.py b/test/test_base_response_basic.py index 90c572a..098e4b9 100644 --- a/test/test_base_response_basic.py +++ b/test/test_base_response_basic.py @@ -36,6 +36,7 @@ def make_instance(self, include_optional) -> BaseResponseBasic: return BaseResponseBasic( status = True, data = revengai.models.basic.Basic( + binary_id = 56, binary_name = '', binary_size = 56, creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), diff --git a/test/test_basic.py b/test/test_basic.py index a0933c2..fbc93ed 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -34,6 +34,7 @@ def make_instance(self, include_optional) -> Basic: model = Basic() if include_optional: return Basic( + binary_id = 56, binary_name = '', binary_size = 56, creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), @@ -53,6 +54,7 @@ def make_instance(self, include_optional) -> Basic: ) else: return Basic( + binary_id = 56, binary_name = '', binary_size = 56, creation = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), diff --git a/test/test_insert_analysis_log_request.py b/test/test_insert_analysis_log_request.py new file mode 100644 index 0000000..f473530 --- /dev/null +++ b/test/test_insert_analysis_log_request.py @@ -0,0 +1,51 @@ +# 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.insert_analysis_log_request import InsertAnalysisLogRequest + +class TestInsertAnalysisLogRequest(unittest.TestCase): + """InsertAnalysisLogRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> InsertAnalysisLogRequest: + """Test InsertAnalysisLogRequest + 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 `InsertAnalysisLogRequest` + """ + model = InsertAnalysisLogRequest() + if include_optional: + return InsertAnalysisLogRequest( + log = '0' + ) + else: + return InsertAnalysisLogRequest( + log = '0', + ) + """ + + def testInsertAnalysisLogRequest(self): + """Test InsertAnalysisLogRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()