diff --git a/.sdk-version b/.sdk-version index 349a9d4..d66c631 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.89.0 +v3.91.0 diff --git a/README.md b/README.md index 80a7384..086c86e 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**get_analysis_params**](docs/AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information *AnalysesCoreApi* | [**get_analysis_queue_position**](docs/AnalysesCoreApi.md#get_analysis_queue_position) | **GET** /v2/analyses/{analysis_id}/queue-position | Get the queue position of an analysis *AnalysesCoreApi* | [**get_analysis_status**](docs/AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis -*AnalysesCoreApi* | [**get_analysis_strings**](docs/AnalysesCoreApi.md#get_analysis_strings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. -*AnalysesCoreApi* | [**get_analysis_strings_status**](docs/AnalysesCoreApi.md#get_analysis_strings_status) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for 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 @@ -77,6 +75,8 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**update_analysis**](docs/AnalysesCoreApi.md#update_analysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis *AnalysesCoreApi* | [**update_analysis_tags**](docs/AnalysesCoreApi.md#update_analysis_tags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags *AnalysesCoreApi* | [**upload_file**](docs/AnalysesCoreApi.md#upload_file) | **POST** /v2/upload | Upload File +*AnalysesCoreApi* | [**v3_get_analysis_strings**](docs/AnalysesCoreApi.md#v3_get_analysis_strings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. +*AnalysesCoreApi* | [**v3_get_analysis_strings_status**](docs/AnalysesCoreApi.md#v3_get_analysis_strings_status) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. *AnalysesResultsMetadataApi* | [**get_analysis_functions_paginated**](docs/AnalysesResultsMetadataApi.md#get_analysis_functions_paginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**get_capabilities**](docs/AnalysesResultsMetadataApi.md#get_capabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis *AnalysesResultsMetadataApi* | [**get_functions_list**](docs/AnalysesResultsMetadataApi.md#get_functions_list) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis @@ -98,6 +98,7 @@ Class | Method | HTTP request | Description *BinariesApi* | [**get_binary_related_status**](docs/BinariesApi.md#get_binary_related_status) | **GET** /v2/binaries/{binary_id}/related/status | Gets the status of the unpack binary task for a binary *BinariesApi* | [**get_related_binaries**](docs/BinariesApi.md#get_related_binaries) | **GET** /v2/binaries/{binary_id}/related | Gets the related binaries of a binary. *CollectionsApi* | [**create_collection**](docs/CollectionsApi.md#create_collection) | **POST** /v2/collections | Creates new collection information +*CollectionsApi* | [**create_collection_0**](docs/CollectionsApi.md#create_collection_0) | **POST** /v3/collections | Create a collection. *CollectionsApi* | [**delete_collection**](docs/CollectionsApi.md#delete_collection) | **DELETE** /v2/collections/{collection_id} | Deletes a collection *CollectionsApi* | [**get_collection**](docs/CollectionsApi.md#get_collection) | **GET** /v2/collections/{collection_id} | Returns a collection *CollectionsApi* | [**list_collections**](docs/CollectionsApi.md#list_collections) | **GET** /v2/collections | Gets basic collections information @@ -305,6 +306,7 @@ Class | Method | HTTP request | Description - [BatchRenameOutputBody](docs/BatchRenameOutputBody.md) - [BinariesRelatedStatusResponse](docs/BinariesRelatedStatusResponse.md) - [BinariesTaskStatus](docs/BinariesTaskStatus.md) + - [Binary](docs/Binary.md) - [BinaryAdditionalDetailsDataResponse](docs/BinaryAdditionalDetailsDataResponse.md) - [BinaryAdditionalResponse](docs/BinaryAdditionalResponse.md) - [BinaryConfig](docs/BinaryConfig.md) @@ -347,6 +349,8 @@ Class | Method | HTTP request | Description - [ConversationWithEvents](docs/ConversationWithEvents.md) - [CreateAIDecompOutputBody](docs/CreateAIDecompOutputBody.md) - [CreateCheckoutSessionInputBody](docs/CreateCheckoutSessionInputBody.md) + - [CreateCollectionInputBody](docs/CreateCollectionInputBody.md) + - [CreateCollectionOutputBody](docs/CreateCollectionOutputBody.md) - [CreateConversationRequest](docs/CreateConversationRequest.md) - [CreatePortalSessionInputBody](docs/CreatePortalSessionInputBody.md) - [Created](docs/Created.md) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 1fa0d9d..b4e93ea 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -15,8 +15,6 @@ Method | HTTP request | Description [**get_analysis_params**](AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information [**get_analysis_queue_position**](AnalysesCoreApi.md#get_analysis_queue_position) | **GET** /v2/analyses/{analysis_id}/queue-position | Get the queue position of an analysis [**get_analysis_status**](AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis -[**get_analysis_strings**](AnalysesCoreApi.md#get_analysis_strings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. -[**get_analysis_strings_status**](AnalysesCoreApi.md#get_analysis_strings_status) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for 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 @@ -25,6 +23,8 @@ Method | HTTP request | Description [**update_analysis**](AnalysesCoreApi.md#update_analysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis [**update_analysis_tags**](AnalysesCoreApi.md#update_analysis_tags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags [**upload_file**](AnalysesCoreApi.md#upload_file) | **POST** /v2/upload | Upload File +[**v3_get_analysis_strings**](AnalysesCoreApi.md#v3_get_analysis_strings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. +[**v3_get_analysis_strings_status**](AnalysesCoreApi.md#v3_get_analysis_strings_status) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. # **add_user_string_to_analysis** @@ -945,192 +945,6 @@ 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) -# **get_analysis_strings** -> ListAnalysisStringsOutputBody get_analysis_strings(analysis_id, page=page, page_size=page_size, search=search, function_search=function_search, order_by=order_by, sort_order=sort_order) - -List strings for an analysis. - -Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. - -**Error codes:** -- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found -- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - -### Example - -* Api Key Authentication (APIKey): - -```python -import revengai -from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody -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 | Analysis ID - page = 1 # int | Page number (1-indexed). (optional) (default to 1) - page_size = 100 # int | Number of results per page. (optional) (default to 100) - search = 'search_example' # str | Filter by string value (case-insensitive substring match). (optional) - function_search = 'function_search_example' # str | Filter by function name (case-insensitive substring match). (optional) - order_by = value # str | Field to order results by. (optional) (default to value) - sort_order = ASC # str | Sort direction. (optional) (default to ASC) - - try: - # List strings for an analysis. - api_response = api_instance.get_analysis_strings(analysis_id, page=page, page_size=page_size, search=search, function_search=function_search, order_by=order_by, sort_order=sort_order) - print("The response of AnalysesCoreApi->get_analysis_strings:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AnalysesCoreApi->get_analysis_strings: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **analysis_id** | **int**| Analysis ID | - **page** | **int**| Page number (1-indexed). | [optional] [default to 1] - **page_size** | **int**| Number of results per page. | [optional] [default to 100] - **search** | **str**| Filter by string value (case-insensitive substring match). | [optional] - **function_search** | **str**| Filter by function name (case-insensitive substring match). | [optional] - **order_by** | **str**| Field to order results by. | [optional] [default to value] - **sort_order** | **str**| Sort direction. | [optional] [default to ASC] - -### Return type - -[**ListAnalysisStringsOutputBody**](ListAnalysisStringsOutputBody.md) - -### Authorization - -[APIKey](../README.md#APIKey) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**422** | Unprocessable Entity | - | -**500** | Internal Server Error | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_analysis_strings_status** -> GetAnalysisStringsStatusOutputBody get_analysis_strings_status(analysis_id) - -Get the string-extraction status for an analysis. - -Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. - -**Error codes:** -- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found -- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - -### Example - -* Api Key Authentication (APIKey): - -```python -import revengai -from revengai.models.get_analysis_strings_status_output_body import GetAnalysisStringsStatusOutputBody -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 | Analysis ID - - try: - # Get the string-extraction status for an analysis. - api_response = api_instance.get_analysis_strings_status(analysis_id) - print("The response of AnalysesCoreApi->get_analysis_strings_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AnalysesCoreApi->get_analysis_strings_status: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **analysis_id** | **int**| Analysis ID | - -### Return type - -[**GetAnalysisStringsStatusOutputBody**](GetAnalysisStringsStatusOutputBody.md) - -### Authorization - -[APIKey](../README.md#APIKey) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**422** | Unprocessable Entity | - | -**500** | Internal Server Error | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **insert_analysis_log** > BaseResponse insert_analysis_log(analysis_id, insert_analysis_log_request) @@ -1820,3 +1634,189 @@ 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) +# **v3_get_analysis_strings** +> ListAnalysisStringsOutputBody v3_get_analysis_strings(analysis_id, page=page, page_size=page_size, search=search, function_search=function_search, order_by=order_by, sort_order=sort_order) + +List strings for an analysis. + +Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody +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 | Analysis ID + page = 1 # int | Page number (1-indexed). (optional) (default to 1) + page_size = 100 # int | Number of results per page. (optional) (default to 100) + search = 'search_example' # str | Filter by string value (case-insensitive substring match). (optional) + function_search = 'function_search_example' # str | Filter by function name (case-insensitive substring match). (optional) + order_by = value # str | Field to order results by. (optional) (default to value) + sort_order = ASC # str | Sort direction. (optional) (default to ASC) + + try: + # List strings for an analysis. + api_response = api_instance.v3_get_analysis_strings(analysis_id, page=page, page_size=page_size, search=search, function_search=function_search, order_by=order_by, sort_order=sort_order) + print("The response of AnalysesCoreApi->v3_get_analysis_strings:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->v3_get_analysis_strings: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + **page** | **int**| Page number (1-indexed). | [optional] [default to 1] + **page_size** | **int**| Number of results per page. | [optional] [default to 100] + **search** | **str**| Filter by string value (case-insensitive substring match). | [optional] + **function_search** | **str**| Filter by function name (case-insensitive substring match). | [optional] + **order_by** | **str**| Field to order results by. | [optional] [default to value] + **sort_order** | **str**| Sort direction. | [optional] [default to ASC] + +### Return type + +[**ListAnalysisStringsOutputBody**](ListAnalysisStringsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **v3_get_analysis_strings_status** +> GetAnalysisStringsStatusOutputBody v3_get_analysis_strings_status(analysis_id) + +Get the string-extraction status for an analysis. + +Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.get_analysis_strings_status_output_body import GetAnalysisStringsStatusOutputBody +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 | Analysis ID + + try: + # Get the string-extraction status for an analysis. + api_response = api_instance.v3_get_analysis_strings_status(analysis_id) + print("The response of AnalysesCoreApi->v3_get_analysis_strings_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->v3_get_analysis_strings_status: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + +### Return type + +[**GetAnalysisStringsStatusOutputBody**](GetAnalysisStringsStatusOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Binary.md b/docs/Binary.md new file mode 100644 index 0000000..79e5e0d --- /dev/null +++ b/docs/Binary.md @@ -0,0 +1,35 @@ +# Binary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**analysis_id** | **int** | | +**binary_id** | **int** | | +**binary_name** | **str** | | +**created_at** | **datetime** | | +**is_system_analysis** | **bool** | | +**owner_id** | **int** | | +**sha_256_hash** | **str** | | + +## Example + +```python +from revengai.models.binary import Binary + +# TODO update the JSON string below +json = "{}" +# create an instance of Binary from a JSON string +binary_instance = Binary.from_json(json) +# print the JSON string representation of the object +print(Binary.to_json()) + +# convert the object into a dict +binary_dict = binary_instance.to_dict() +# create an instance of Binary from a dict +binary_from_dict = Binary.from_dict(binary_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/CollectionsApi.md b/docs/CollectionsApi.md index 983ef16..614de10 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://api.reveng.ai* Method | HTTP request | Description ------------- | ------------- | ------------- [**create_collection**](CollectionsApi.md#create_collection) | **POST** /v2/collections | Creates new collection information +[**create_collection_0**](CollectionsApi.md#create_collection_0) | **POST** /v3/collections | Create a collection. [**delete_collection**](CollectionsApi.md#delete_collection) | **DELETE** /v2/collections/{collection_id} | Deletes a collection [**get_collection**](CollectionsApi.md#get_collection) | **GET** /v2/collections/{collection_id} | Returns a collection [**list_collections**](CollectionsApi.md#list_collections) | **GET** /v2/collections | Gets basic collections information @@ -94,6 +95,93 @@ 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) +# **create_collection_0** +> CreateCollectionOutputBody create_collection_0(create_collection_input_body) + +Create a collection. + +Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.create_collection_input_body import CreateCollectionInputBody +from revengai.models.create_collection_output_body import CreateCollectionOutputBody +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.CollectionsApi(api_client) + create_collection_input_body = revengai.CreateCollectionInputBody() # CreateCollectionInputBody | + + try: + # Create a collection. + api_response = api_instance.create_collection_0(create_collection_input_body) + print("The response of CollectionsApi->create_collection_0:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->create_collection_0: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_collection_input_body** | [**CreateCollectionInputBody**](CreateCollectionInputBody.md)| | + +### Return type + +[**CreateCollectionOutputBody**](CreateCollectionOutputBody.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** | Created | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **delete_collection** > BaseResponseBool delete_collection(collection_id) diff --git a/docs/CreateCollectionInputBody.md b/docs/CreateCollectionInputBody.md new file mode 100644 index 0000000..d001742 --- /dev/null +++ b/docs/CreateCollectionInputBody.md @@ -0,0 +1,34 @@ +# CreateCollectionInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | **List[int]** | Optional binary IDs to link to the collection. | [optional] +**collection_name** | **str** | Collection name. | +**collection_scope** | **str** | Visibility scope. | [default to 'PRIVATE'] +**description** | **str** | Collection description. | +**model_id** | **int** | Model ID the collection is associated with. | +**tags** | **List[str]** | Optional tags to attach to the collection. | [optional] + +## Example + +```python +from revengai.models.create_collection_input_body import CreateCollectionInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateCollectionInputBody from a JSON string +create_collection_input_body_instance = CreateCollectionInputBody.from_json(json) +# print the JSON string representation of the object +print(CreateCollectionInputBody.to_json()) + +# convert the object into a dict +create_collection_input_body_dict = create_collection_input_body_instance.to_dict() +# create an instance of CreateCollectionInputBody from a dict +create_collection_input_body_from_dict = CreateCollectionInputBody.from_dict(create_collection_input_body_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateCollectionOutputBody.md b/docs/CreateCollectionOutputBody.md new file mode 100644 index 0000000..00a7688 --- /dev/null +++ b/docs/CreateCollectionOutputBody.md @@ -0,0 +1,39 @@ +# CreateCollectionOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | [**List[Binary]**](Binary.md) | | [optional] +**collection_id** | **int** | | +**collection_name** | **str** | | +**collection_scope** | **str** | | +**created_at** | **datetime** | | +**description** | **str** | | +**model_id** | **int** | | +**tags** | **List[str]** | | [optional] +**team_id** | **int** | | +**updated_at** | **datetime** | | +**user_id** | **int** | | + +## Example + +```python +from revengai.models.create_collection_output_body import CreateCollectionOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateCollectionOutputBody from a JSON string +create_collection_output_body_instance = CreateCollectionOutputBody.from_json(json) +# print the JSON string representation of the object +print(CreateCollectionOutputBody.to_json()) + +# convert the object into a dict +create_collection_output_body_dict = create_collection_output_body_instance.to_dict() +# create an instance of CreateCollectionOutputBody from a dict +create_collection_output_body_from_dict = CreateCollectionOutputBody.from_dict(create_collection_output_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/revengai/__init__.py b/revengai/__init__.py index 480b009..36f0cb8 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.89.0" +__version__ = "v3.91.0" # Define package exports __all__ = [ @@ -168,6 +168,7 @@ "BatchRenameOutputBody", "BinariesRelatedStatusResponse", "BinariesTaskStatus", + "Binary", "BinaryAdditionalDetailsDataResponse", "BinaryAdditionalResponse", "BinaryConfig", @@ -210,6 +211,8 @@ "ConversationWithEvents", "CreateAIDecompOutputBody", "CreateCheckoutSessionInputBody", + "CreateCollectionInputBody", + "CreateCollectionOutputBody", "CreateConversationRequest", "CreatePortalSessionInputBody", "Created", @@ -619,6 +622,7 @@ from revengai.models.batch_rename_output_body import BatchRenameOutputBody as BatchRenameOutputBody from revengai.models.binaries_related_status_response import BinariesRelatedStatusResponse as BinariesRelatedStatusResponse from revengai.models.binaries_task_status import BinariesTaskStatus as BinariesTaskStatus +from revengai.models.binary import Binary as Binary from revengai.models.binary_additional_details_data_response import BinaryAdditionalDetailsDataResponse as BinaryAdditionalDetailsDataResponse from revengai.models.binary_additional_response import BinaryAdditionalResponse as BinaryAdditionalResponse from revengai.models.binary_config import BinaryConfig as BinaryConfig @@ -661,6 +665,8 @@ from revengai.models.conversation_with_events import ConversationWithEvents as ConversationWithEvents from revengai.models.create_ai_decomp_output_body import CreateAIDecompOutputBody as CreateAIDecompOutputBody from revengai.models.create_checkout_session_input_body import CreateCheckoutSessionInputBody as CreateCheckoutSessionInputBody +from revengai.models.create_collection_input_body import CreateCollectionInputBody as CreateCollectionInputBody +from revengai.models.create_collection_output_body import CreateCollectionOutputBody as CreateCollectionOutputBody from revengai.models.create_conversation_request import CreateConversationRequest as CreateConversationRequest from revengai.models.create_portal_session_input_body import CreatePortalSessionInputBody as CreatePortalSessionInputBody from revengai.models.created import Created as Created diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index c060849..386c733 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -3100,15 +3100,10 @@ def _get_analysis_status_serialize( @validate_call - def get_analysis_strings( + def insert_analysis_log( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, - page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, - search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, - function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, - order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, - sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3121,25 +3116,15 @@ def get_analysis_strings( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListAnalysisStringsOutputBody: - """List strings for an analysis. + ) -> BaseResponse: + """Insert a log entry for an analysis - Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Inserts a log record for an analysis. Only the analysis owner can insert logs. - :param analysis_id: Analysis ID (required) + :param analysis_id: (required) :type analysis_id: int - :param page: Page number (1-indexed). - :type page: int - :param page_size: Number of results per page. - :type page_size: int - :param search: Filter by string value (case-insensitive substring match). - :type search: str - :param function_search: Filter by function name (case-insensitive substring match). - :type function_search: str - :param order_by: Field to order results by. - :type order_by: str - :param sort_order: Sort direction. - :type sort_order: str + :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 @@ -3162,14 +3147,9 @@ def get_analysis_strings( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_serialize( + _param = self._insert_analysis_log_serialize( analysis_id=analysis_id, - page=page, - page_size=page_size, - search=search, - function_search=function_search, - order_by=order_by, - sort_order=sort_order, + insert_analysis_log_request=insert_analysis_log_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3177,11 +3157,8 @@ def get_analysis_strings( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListAnalysisStringsOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '201': "BaseResponse", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3195,15 +3172,10 @@ def get_analysis_strings( @validate_call - def get_analysis_strings_with_http_info( + def insert_analysis_log_with_http_info( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, - page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, - search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, - function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, - order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, - sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3216,25 +3188,15 @@ def get_analysis_strings_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListAnalysisStringsOutputBody]: - """List strings for an analysis. + ) -> ApiResponse[BaseResponse]: + """Insert a log entry for an analysis - Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Inserts a log record for an analysis. Only the analysis owner can insert logs. - :param analysis_id: Analysis ID (required) + :param analysis_id: (required) :type analysis_id: int - :param page: Page number (1-indexed). - :type page: int - :param page_size: Number of results per page. - :type page_size: int - :param search: Filter by string value (case-insensitive substring match). - :type search: str - :param function_search: Filter by function name (case-insensitive substring match). - :type function_search: str - :param order_by: Field to order results by. - :type order_by: str - :param sort_order: Sort direction. - :type sort_order: str + :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 @@ -3257,14 +3219,9 @@ def get_analysis_strings_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_serialize( + _param = self._insert_analysis_log_serialize( analysis_id=analysis_id, - page=page, - page_size=page_size, - search=search, - function_search=function_search, - order_by=order_by, - sort_order=sort_order, + insert_analysis_log_request=insert_analysis_log_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3272,11 +3229,8 @@ def get_analysis_strings_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListAnalysisStringsOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '201': "BaseResponse", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3290,15 +3244,10 @@ def get_analysis_strings_with_http_info( @validate_call - def get_analysis_strings_without_preload_content( + def insert_analysis_log_without_preload_content( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, - page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, - search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, - function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, - order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, - sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, + analysis_id: StrictInt, + insert_analysis_log_request: InsertAnalysisLogRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3312,24 +3261,14 @@ def get_analysis_strings_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List strings for an analysis. + """Insert a log entry for an analysis - Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Inserts a log record for an analysis. Only the analysis owner can insert logs. - :param analysis_id: Analysis ID (required) + :param analysis_id: (required) :type analysis_id: int - :param page: Page number (1-indexed). - :type page: int - :param page_size: Number of results per page. - :type page_size: int - :param search: Filter by string value (case-insensitive substring match). - :type search: str - :param function_search: Filter by function name (case-insensitive substring match). - :type function_search: str - :param order_by: Field to order results by. - :type order_by: str - :param sort_order: Sort direction. - :type sort_order: str + :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 @@ -3352,14 +3291,9 @@ def get_analysis_strings_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_serialize( + _param = self._insert_analysis_log_serialize( analysis_id=analysis_id, - page=page, - page_size=page_size, - search=search, - function_search=function_search, - order_by=order_by, - sort_order=sort_order, + insert_analysis_log_request=insert_analysis_log_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3367,11 +3301,8 @@ def get_analysis_strings_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ListAnalysisStringsOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '201': "BaseResponse", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3380,15 +3311,10 @@ def get_analysis_strings_without_preload_content( return response_data.response - def _get_analysis_strings_serialize( + def _insert_analysis_log_serialize( self, analysis_id, - page, - page_size, - search, - function_search, - order_by, - sort_order, + insert_analysis_log_request, _request_auth, _content_type, _headers, @@ -3413,33 +3339,11 @@ def _get_analysis_strings_serialize( if analysis_id is not None: _path_params['analysis_id'] = analysis_id # process the query parameters - if page is not None: - - _query_params.append(('page', page)) - - if page_size is not None: - - _query_params.append(('page_size', page_size)) - - if search is not None: - - _query_params.append(('search', search)) - - if function_search is not None: - - _query_params.append(('function_search', function_search)) - - if order_by is not None: - - _query_params.append(('order_by', order_by)) - - if sort_order is not None: - - _query_params.append(('sort_order', sort_order)) - # 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` @@ -3450,6 +3354,19 @@ def _get_analysis_strings_serialize( ] ) + # 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] = [ @@ -3457,8 +3374,8 @@ def _get_analysis_strings_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v3/analyses/{analysis_id}/functions/strings', + method='POST', + resource_path='/v2/analyses/{analysis_id}/logs', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3475,9 +3392,19 @@ def _get_analysis_strings_serialize( @validate_call - def get_analysis_strings_status( + def list_analyses( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + search_term: Optional[StrictStr] = None, + workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, + status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, + model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, + dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, + usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, + order: Optional[Order] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3490,13 +3417,33 @@ def get_analysis_strings_status( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GetAnalysisStringsStatusOutputBody: - """Get the string-extraction status for an analysis. + ) -> BaseResponseRecent: + """Gets the most recent analyses - Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit - :param analysis_id: Analysis ID (required) - :type analysis_id: int + :param search_term: + :type search_term: str + :param workspace: The workspace to be viewed + :type workspace: List[Workspace] + :param status: The status of the analysis + :type status: List[StatusInput] + :param model_name: Show analysis belonging to the model + :type model_name: List[ModelName] + :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status + :type dynamic_execution_status: DynamicExecutionStatus + :param usernames: Show analysis belonging to the user + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2AnalysesEnumsOrderBy + :param order: + :type order: Order :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 @@ -3519,8 +3466,18 @@ def get_analysis_strings_status( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_status_serialize( - analysis_id=analysis_id, + _param = self._list_analyses_serialize( + 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, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3528,11 +3485,8 @@ def get_analysis_strings_status( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetAnalysisStringsStatusOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseRecent", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3546,10 +3500,20 @@ def get_analysis_strings_status( @validate_call - def get_analysis_strings_status_with_http_info( + def list_analyses_with_http_info( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - _request_timeout: Union[ + search_term: Optional[StrictStr] = None, + workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, + status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, + model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, + dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, + usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, + order: Optional[Order] = None, + _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], Tuple[ @@ -3561,13 +3525,33 @@ def get_analysis_strings_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[GetAnalysisStringsStatusOutputBody]: - """Get the string-extraction status for an analysis. + ) -> ApiResponse[BaseResponseRecent]: + """Gets the most recent analyses - Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit - :param analysis_id: Analysis ID (required) - :type analysis_id: int + :param search_term: + :type search_term: str + :param workspace: The workspace to be viewed + :type workspace: List[Workspace] + :param status: The status of the analysis + :type status: List[StatusInput] + :param model_name: Show analysis belonging to the model + :type model_name: List[ModelName] + :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status + :type dynamic_execution_status: DynamicExecutionStatus + :param usernames: Show analysis belonging to the user + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2AnalysesEnumsOrderBy + :param order: + :type order: Order :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 @@ -3590,8 +3574,18 @@ def get_analysis_strings_status_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_status_serialize( - analysis_id=analysis_id, + _param = self._list_analyses_serialize( + 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, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3599,11 +3593,8 @@ def get_analysis_strings_status_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetAnalysisStringsStatusOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseRecent", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3617,9 +3608,19 @@ def get_analysis_strings_status_with_http_info( @validate_call - def get_analysis_strings_status_without_preload_content( + def list_analyses_without_preload_content( self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + search_term: Optional[StrictStr] = None, + workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, + status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, + model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, + dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, + usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, + sha256_hash: Optional[StrictStr] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, + order: Optional[Order] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3633,12 +3634,32 @@ def get_analysis_strings_status_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get the string-extraction status for an analysis. + """Gets the most recent analyses - Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit - :param analysis_id: Analysis ID (required) - :type analysis_id: int + :param search_term: + :type search_term: str + :param workspace: The workspace to be viewed + :type workspace: List[Workspace] + :param status: The status of the analysis + :type status: List[StatusInput] + :param model_name: Show analysis belonging to the model + :type model_name: List[ModelName] + :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status + :type dynamic_execution_status: DynamicExecutionStatus + :param usernames: Show analysis belonging to the user + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2AnalysesEnumsOrderBy + :param order: + :type order: Order :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 @@ -3661,8 +3682,18 @@ def get_analysis_strings_status_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_analysis_strings_status_serialize( - analysis_id=analysis_id, + _param = self._list_analyses_serialize( + 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, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3670,11 +3701,8 @@ def get_analysis_strings_status_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetAnalysisStringsStatusOutputBody", - '403': "APIError", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseRecent", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -3683,9 +3711,19 @@ def get_analysis_strings_status_without_preload_content( return response_data.response - def _get_analysis_strings_status_serialize( + def _list_analyses_serialize( self, - analysis_id, + search_term, + workspace, + status, + model_name, + dynamic_execution_status, + usernames, + sha256_hash, + limit, + offset, + order_by, + order, _request_auth, _content_type, _headers, @@ -3695,6 +3733,10 @@ def _get_analysis_strings_status_serialize( _host = None _collection_formats: Dict[str, str] = { + 'workspace': 'multi', + 'status': 'multi', + 'model_name': 'multi', + 'usernames': 'multi', } _path_params: Dict[str, str] = {} @@ -3707,9 +3749,51 @@ def _get_analysis_strings_status_serialize( _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 + if search_term is not None: + + _query_params.append(('search_term', search_term)) + + if workspace is not None: + + _query_params.append(('workspace', workspace)) + + if status is not None: + + _query_params.append(('status', status)) + + if model_name is not None: + + _query_params.append(('model_name', model_name)) + + if dynamic_execution_status is not None: + + _query_params.append(('dynamic_execution_status', dynamic_execution_status.value)) + + if usernames is not None: + + _query_params.append(('usernames', usernames)) + + if sha256_hash is not None: + + _query_params.append(('sha256_hash', sha256_hash)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + if order_by is not None: + + _query_params.append(('order_by', order_by.value)) + + if order is not None: + + _query_params.append(('order', order.value)) + # process the header parameters # process the form parameters # process the body parameter @@ -3731,7 +3815,7 @@ def _get_analysis_strings_status_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v3/analyses/{analysis_id}/functions/strings/status', + resource_path='/v2/analyses/list', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3748,10 +3832,9 @@ def _get_analysis_strings_status_serialize( @validate_call - def insert_analysis_log( + def lookup_binary_id( self, - analysis_id: StrictInt, - insert_analysis_log_request: InsertAnalysisLogRequest, + binary_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3764,15 +3847,13 @@ def insert_analysis_log( _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 + ) -> object: + """Gets the analysis ID from binary ID - Inserts a log record for an analysis. Only the analysis owner can insert logs. + Given an binary ID gets the ID of an analysis - :param analysis_id: (required) - :type analysis_id: int - :param insert_analysis_log_request: (required) - :type insert_analysis_log_request: InsertAnalysisLogRequest + :param binary_id: (required) + :type binary_id: int :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 @@ -3795,9 +3876,8 @@ def insert_analysis_log( :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, + _param = self._lookup_binary_id_serialize( + binary_id=binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3805,7 +3885,7 @@ def insert_analysis_log( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "object", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -3820,10 +3900,9 @@ def insert_analysis_log( @validate_call - def insert_analysis_log_with_http_info( + def lookup_binary_id_with_http_info( self, - analysis_id: StrictInt, - insert_analysis_log_request: InsertAnalysisLogRequest, + binary_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3836,15 +3915,13 @@ def insert_analysis_log_with_http_info( _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 + ) -> ApiResponse[object]: + """Gets the analysis ID from binary ID - Inserts a log record for an analysis. Only the analysis owner can insert logs. + Given an binary ID gets the ID of an analysis - :param analysis_id: (required) - :type analysis_id: int - :param insert_analysis_log_request: (required) - :type insert_analysis_log_request: InsertAnalysisLogRequest + :param binary_id: (required) + :type binary_id: int :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 @@ -3867,9 +3944,8 @@ def insert_analysis_log_with_http_info( :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, + _param = self._lookup_binary_id_serialize( + binary_id=binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3877,7 +3953,7 @@ def insert_analysis_log_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "object", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -3892,10 +3968,9 @@ def insert_analysis_log_with_http_info( @validate_call - def insert_analysis_log_without_preload_content( + def lookup_binary_id_without_preload_content( self, - analysis_id: StrictInt, - insert_analysis_log_request: InsertAnalysisLogRequest, + binary_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3909,14 +3984,12 @@ def insert_analysis_log_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Insert a log entry for an analysis + """Gets the analysis ID from binary ID - Inserts a log record for an analysis. Only the analysis owner can insert logs. + Given an binary ID gets the ID of an analysis - :param analysis_id: (required) - :type analysis_id: int - :param insert_analysis_log_request: (required) - :type insert_analysis_log_request: InsertAnalysisLogRequest + :param binary_id: (required) + :type binary_id: int :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 @@ -3939,9 +4012,8 @@ def insert_analysis_log_without_preload_content( :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, + _param = self._lookup_binary_id_serialize( + binary_id=binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3949,7 +4021,7 @@ def insert_analysis_log_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "object", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -3959,10 +4031,9 @@ def insert_analysis_log_without_preload_content( return response_data.response - def _insert_analysis_log_serialize( + def _lookup_binary_id_serialize( self, - analysis_id, - insert_analysis_log_request, + binary_id, _request_auth, _content_type, _headers, @@ -3984,14 +4055,12 @@ def _insert_analysis_log_serialize( _body_params: Optional[bytes] = None # process the path parameters - if analysis_id is not None: - _path_params['analysis_id'] = analysis_id + if binary_id is not None: + _path_params['binary_id'] = binary_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` @@ -4002,19 +4071,6 @@ def _insert_analysis_log_serialize( ] ) - # 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] = [ @@ -4022,8 +4078,8 @@ def _insert_analysis_log_serialize( ] return self.api_client.param_serialize( - method='POST', - resource_path='/v2/analyses/{analysis_id}/logs', + method='GET', + resource_path='/v2/analyses/lookup/{binary_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4040,19 +4096,10 @@ def _insert_analysis_log_serialize( @validate_call - def list_analyses( + def put_analysis_strings( self, - search_term: Optional[StrictStr] = None, - workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, - status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, - model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, - dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, - usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, - sha256_hash: Optional[StrictStr] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, - order: Optional[Order] = None, + analysis_id: StrictInt, + put_analysis_strings_request: PutAnalysisStringsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4065,33 +4112,15 @@ def list_analyses( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseRecent: - """Gets the most recent analyses + ) -> BaseResponse: + """Add strings to the analysis - Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit + Add strings to the analysis. Rejects if any string already exists at the given vaddr. - :param search_term: - :type search_term: str - :param workspace: The workspace to be viewed - :type workspace: List[Workspace] - :param status: The status of the analysis - :type status: List[StatusInput] - :param model_name: Show analysis belonging to the model - :type model_name: List[ModelName] - :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status - :type dynamic_execution_status: DynamicExecutionStatus - :param usernames: Show analysis belonging to the user - :type usernames: List[Optional[str]] - :param sha256_hash: - :type sha256_hash: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2AnalysesEnumsOrderBy - :param order: - :type order: Order + :param analysis_id: (required) + :type analysis_id: int + :param put_analysis_strings_request: (required) + :type put_analysis_strings_request: PutAnalysisStringsRequest :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 @@ -4114,18 +4143,9 @@ def list_analyses( :return: Returns the result object. """ # noqa: E501 - _param = self._list_analyses_serialize( - 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, + _param = self._put_analysis_strings_serialize( + analysis_id=analysis_id, + put_analysis_strings_request=put_analysis_strings_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4133,7 +4153,7 @@ def list_analyses( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseRecent", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4148,19 +4168,10 @@ def list_analyses( @validate_call - def list_analyses_with_http_info( + def put_analysis_strings_with_http_info( self, - search_term: Optional[StrictStr] = None, - workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, - status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, - model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, - dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, - usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, - sha256_hash: Optional[StrictStr] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, - order: Optional[Order] = None, + analysis_id: StrictInt, + put_analysis_strings_request: PutAnalysisStringsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4173,33 +4184,15 @@ def list_analyses_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseRecent]: - """Gets the most recent analyses + ) -> ApiResponse[BaseResponse]: + """Add strings to the analysis - Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit + Add strings to the analysis. Rejects if any string already exists at the given vaddr. - :param search_term: - :type search_term: str - :param workspace: The workspace to be viewed - :type workspace: List[Workspace] - :param status: The status of the analysis - :type status: List[StatusInput] - :param model_name: Show analysis belonging to the model - :type model_name: List[ModelName] - :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status - :type dynamic_execution_status: DynamicExecutionStatus - :param usernames: Show analysis belonging to the user - :type usernames: List[Optional[str]] - :param sha256_hash: - :type sha256_hash: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2AnalysesEnumsOrderBy - :param order: - :type order: Order + :param analysis_id: (required) + :type analysis_id: int + :param put_analysis_strings_request: (required) + :type put_analysis_strings_request: PutAnalysisStringsRequest :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 @@ -4222,18 +4215,9 @@ def list_analyses_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_analyses_serialize( - 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, + _param = self._put_analysis_strings_serialize( + analysis_id=analysis_id, + put_analysis_strings_request=put_analysis_strings_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4241,7 +4225,7 @@ def list_analyses_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseRecent", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4256,19 +4240,10 @@ def list_analyses_with_http_info( @validate_call - def list_analyses_without_preload_content( + def put_analysis_strings_without_preload_content( self, - search_term: Optional[StrictStr] = None, - workspace: Annotated[Optional[List[Workspace]], Field(description="The workspace to be viewed")] = None, - status: Annotated[Optional[List[StatusInput]], Field(description="The status of the analysis")] = None, - model_name: Annotated[Optional[List[ModelName]], Field(description="Show analysis belonging to the model")] = None, - dynamic_execution_status: Annotated[Optional[DynamicExecutionStatus], Field(description="Show analysis that have a dynamic execution with the given status")] = None, - usernames: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Show analysis belonging to the user")] = None, - sha256_hash: Optional[StrictStr] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2AnalysesEnumsOrderBy] = None, - order: Optional[Order] = None, + analysis_id: StrictInt, + put_analysis_strings_request: PutAnalysisStringsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4282,32 +4257,14 @@ def list_analyses_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Gets the most recent analyses + """Add strings to the analysis - Gets the most recent analyses provided a scope, this is then paginated, if pages and limit doesnt fit, it increases the limit + Add strings to the analysis. Rejects if any string already exists at the given vaddr. - :param search_term: - :type search_term: str - :param workspace: The workspace to be viewed - :type workspace: List[Workspace] - :param status: The status of the analysis - :type status: List[StatusInput] - :param model_name: Show analysis belonging to the model - :type model_name: List[ModelName] - :param dynamic_execution_status: Show analysis that have a dynamic execution with the given status - :type dynamic_execution_status: DynamicExecutionStatus - :param usernames: Show analysis belonging to the user - :type usernames: List[Optional[str]] - :param sha256_hash: - :type sha256_hash: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2AnalysesEnumsOrderBy - :param order: - :type order: Order + :param analysis_id: (required) + :type analysis_id: int + :param put_analysis_strings_request: (required) + :type put_analysis_strings_request: PutAnalysisStringsRequest :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 @@ -4330,18 +4287,9 @@ def list_analyses_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_analyses_serialize( - 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, + _param = self._put_analysis_strings_serialize( + analysis_id=analysis_id, + put_analysis_strings_request=put_analysis_strings_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4349,7 +4297,7 @@ def list_analyses_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseRecent", + '201': "BaseResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4359,19 +4307,10 @@ def list_analyses_without_preload_content( return response_data.response - def _list_analyses_serialize( + def _put_analysis_strings_serialize( self, - search_term, - workspace, - status, - model_name, - dynamic_execution_status, - usernames, - sha256_hash, - limit, - offset, - order_by, - order, + analysis_id, + put_analysis_strings_request, _request_auth, _content_type, _headers, @@ -4381,70 +4320,26 @@ def _list_analyses_serialize( _host = None _collection_formats: Dict[str, str] = { - 'workspace': 'multi', - 'status': 'multi', - 'model_name': 'multi', - 'usernames': 'multi', } - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[ - str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] - ] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - if search_term is not None: - - _query_params.append(('search_term', search_term)) - - if workspace is not None: - - _query_params.append(('workspace', workspace)) - - if status is not None: - - _query_params.append(('status', status)) - - if model_name is not None: - - _query_params.append(('model_name', model_name)) - - if dynamic_execution_status is not None: - - _query_params.append(('dynamic_execution_status', dynamic_execution_status.value)) - - if usernames is not None: - - _query_params.append(('usernames', usernames)) - - if sha256_hash is not None: - - _query_params.append(('sha256_hash', sha256_hash)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - if offset is not None: - - _query_params.append(('offset', offset)) - - if order_by is not None: - - _query_params.append(('order_by', order_by.value)) - - if order is not None: - - _query_params.append(('order', order.value)) - + _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 put_analysis_strings_request is not None: + _body_params = put_analysis_strings_request # set the HTTP header `Accept` @@ -4455,6 +4350,19 @@ def _list_analyses_serialize( ] ) + # 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] = [ @@ -4462,8 +4370,8 @@ def _list_analyses_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v2/analyses/list', + method='PUT', + resource_path='/v2/analyses/{analysis_id}/strings', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4480,9 +4388,11 @@ def _list_analyses_serialize( @validate_call - def lookup_binary_id( + def requeue_analysis( self, - binary_id: StrictInt, + analysis_id: StrictInt, + re_analysis_form: ReAnalysisForm, + x_rev_eng_application: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4495,13 +4405,17 @@ def lookup_binary_id( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> object: - """Gets the analysis ID from binary ID + ) -> BaseResponseCreated: + """Requeue Analysis - Given an binary ID gets the ID of an analysis + Re-queues an already uploaded analysis - :param binary_id: (required) - :type binary_id: int + :param analysis_id: (required) + :type analysis_id: int + :param re_analysis_form: (required) + :type re_analysis_form: ReAnalysisForm + :param x_rev_eng_application: + :type x_rev_eng_application: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -4524,8 +4438,10 @@ def lookup_binary_id( :return: Returns the result object. """ # noqa: E501 - _param = self._lookup_binary_id_serialize( - binary_id=binary_id, + _param = self._requeue_analysis_serialize( + analysis_id=analysis_id, + re_analysis_form=re_analysis_form, + x_rev_eng_application=x_rev_eng_application, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4533,8 +4449,10 @@ def lookup_binary_id( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "object", + '201': "BaseResponseCreated", '422': "BaseResponse", + '404': "BaseResponse", + '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -4548,9 +4466,11 @@ def lookup_binary_id( @validate_call - def lookup_binary_id_with_http_info( + def requeue_analysis_with_http_info( self, - binary_id: StrictInt, + analysis_id: StrictInt, + re_analysis_form: ReAnalysisForm, + x_rev_eng_application: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4563,13 +4483,17 @@ def lookup_binary_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[object]: - """Gets the analysis ID from binary ID + ) -> ApiResponse[BaseResponseCreated]: + """Requeue Analysis - Given an binary ID gets the ID of an analysis + Re-queues an already uploaded analysis - :param binary_id: (required) - :type binary_id: int + :param analysis_id: (required) + :type analysis_id: int + :param re_analysis_form: (required) + :type re_analysis_form: ReAnalysisForm + :param x_rev_eng_application: + :type x_rev_eng_application: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -4592,8 +4516,10 @@ def lookup_binary_id_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._lookup_binary_id_serialize( - binary_id=binary_id, + _param = self._requeue_analysis_serialize( + analysis_id=analysis_id, + re_analysis_form=re_analysis_form, + x_rev_eng_application=x_rev_eng_application, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4601,8 +4527,10 @@ def lookup_binary_id_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "object", + '201': "BaseResponseCreated", '422': "BaseResponse", + '404': "BaseResponse", + '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -4616,9 +4544,11 @@ def lookup_binary_id_with_http_info( @validate_call - def lookup_binary_id_without_preload_content( + def requeue_analysis_without_preload_content( self, - binary_id: StrictInt, + analysis_id: StrictInt, + re_analysis_form: ReAnalysisForm, + x_rev_eng_application: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4632,12 +4562,16 @@ def lookup_binary_id_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Gets the analysis ID from binary ID + """Requeue Analysis - Given an binary ID gets the ID of an analysis + Re-queues an already uploaded analysis - :param binary_id: (required) - :type binary_id: int + :param analysis_id: (required) + :type analysis_id: int + :param re_analysis_form: (required) + :type re_analysis_form: ReAnalysisForm + :param x_rev_eng_application: + :type x_rev_eng_application: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -4660,8 +4594,10 @@ def lookup_binary_id_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._lookup_binary_id_serialize( - binary_id=binary_id, + _param = self._requeue_analysis_serialize( + analysis_id=analysis_id, + re_analysis_form=re_analysis_form, + x_rev_eng_application=x_rev_eng_application, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4669,8 +4605,10 @@ def lookup_binary_id_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "object", + '201': "BaseResponseCreated", '422': "BaseResponse", + '404': "BaseResponse", + '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -4679,9 +4617,11 @@ def lookup_binary_id_without_preload_content( return response_data.response - def _lookup_binary_id_serialize( + def _requeue_analysis_serialize( self, - binary_id, + analysis_id, + re_analysis_form, + x_rev_eng_application, _request_auth, _content_type, _headers, @@ -4703,12 +4643,16 @@ def _lookup_binary_id_serialize( _body_params: Optional[bytes] = None # process the path parameters - if binary_id is not None: - _path_params['binary_id'] = binary_id + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id # process the query parameters # process the header parameters + if x_rev_eng_application is not None: + _header_params['X-RevEng-Application'] = x_rev_eng_application # process the form parameters # process the body parameter + if re_analysis_form is not None: + _body_params = re_analysis_form # set the HTTP header `Accept` @@ -4719,6 +4663,19 @@ def _lookup_binary_id_serialize( ] ) + # 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] = [ @@ -4726,8 +4683,8 @@ def _lookup_binary_id_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v2/analyses/lookup/{binary_id}', + method='POST', + resource_path='/v2/analyses/{analysis_id}/requeue', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4744,10 +4701,10 @@ def _lookup_binary_id_serialize( @validate_call - def put_analysis_strings( + def update_analysis( self, analysis_id: StrictInt, - put_analysis_strings_request: PutAnalysisStringsRequest, + analysis_update_request: AnalysisUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4760,15 +4717,15 @@ def put_analysis_strings( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponse: - """Add strings to the analysis + ) -> BaseResponseAnalysisDetailResponse: + """Update Analysis - Add strings to the analysis. Rejects if any string already exists at the given vaddr. + Updates analysis attributes (binary_name, analysis_scope). User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param put_analysis_strings_request: (required) - :type put_analysis_strings_request: PutAnalysisStringsRequest + :param analysis_update_request: (required) + :type analysis_update_request: AnalysisUpdateRequest :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 @@ -4791,9 +4748,9 @@ def put_analysis_strings( :return: Returns the result object. """ # noqa: E501 - _param = self._put_analysis_strings_serialize( + _param = self._update_analysis_serialize( analysis_id=analysis_id, - put_analysis_strings_request=put_analysis_strings_request, + analysis_update_request=analysis_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4801,7 +4758,7 @@ def put_analysis_strings( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "BaseResponseAnalysisDetailResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4816,10 +4773,10 @@ def put_analysis_strings( @validate_call - def put_analysis_strings_with_http_info( + def update_analysis_with_http_info( self, analysis_id: StrictInt, - put_analysis_strings_request: PutAnalysisStringsRequest, + analysis_update_request: AnalysisUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4832,15 +4789,15 @@ def put_analysis_strings_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponse]: - """Add strings to the analysis + ) -> ApiResponse[BaseResponseAnalysisDetailResponse]: + """Update Analysis - Add strings to the analysis. Rejects if any string already exists at the given vaddr. + Updates analysis attributes (binary_name, analysis_scope). User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param put_analysis_strings_request: (required) - :type put_analysis_strings_request: PutAnalysisStringsRequest + :param analysis_update_request: (required) + :type analysis_update_request: AnalysisUpdateRequest :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 @@ -4863,9 +4820,9 @@ def put_analysis_strings_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._put_analysis_strings_serialize( + _param = self._update_analysis_serialize( analysis_id=analysis_id, - put_analysis_strings_request=put_analysis_strings_request, + analysis_update_request=analysis_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4873,7 +4830,7 @@ def put_analysis_strings_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "BaseResponseAnalysisDetailResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4888,10 +4845,10 @@ def put_analysis_strings_with_http_info( @validate_call - def put_analysis_strings_without_preload_content( + def update_analysis_without_preload_content( self, analysis_id: StrictInt, - put_analysis_strings_request: PutAnalysisStringsRequest, + analysis_update_request: AnalysisUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4905,14 +4862,14 @@ def put_analysis_strings_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Add strings to the analysis + """Update Analysis - Add strings to the analysis. Rejects if any string already exists at the given vaddr. + Updates analysis attributes (binary_name, analysis_scope). User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param put_analysis_strings_request: (required) - :type put_analysis_strings_request: PutAnalysisStringsRequest + :param analysis_update_request: (required) + :type analysis_update_request: AnalysisUpdateRequest :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 @@ -4935,9 +4892,9 @@ def put_analysis_strings_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._put_analysis_strings_serialize( + _param = self._update_analysis_serialize( analysis_id=analysis_id, - put_analysis_strings_request=put_analysis_strings_request, + analysis_update_request=analysis_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4945,7 +4902,7 @@ def put_analysis_strings_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponse", + '200': "BaseResponseAnalysisDetailResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -4955,10 +4912,10 @@ def put_analysis_strings_without_preload_content( return response_data.response - def _put_analysis_strings_serialize( + def _update_analysis_serialize( self, analysis_id, - put_analysis_strings_request, + analysis_update_request, _request_auth, _content_type, _headers, @@ -4986,8 +4943,8 @@ def _put_analysis_strings_serialize( # process the header parameters # process the form parameters # process the body parameter - if put_analysis_strings_request is not None: - _body_params = put_analysis_strings_request + if analysis_update_request is not None: + _body_params = analysis_update_request # set the HTTP header `Accept` @@ -5018,8 +4975,8 @@ def _put_analysis_strings_serialize( ] return self.api_client.param_serialize( - method='PUT', - resource_path='/v2/analyses/{analysis_id}/strings', + method='PATCH', + resource_path='/v2/analyses/{analysis_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5036,11 +4993,10 @@ def _put_analysis_strings_serialize( @validate_call - def requeue_analysis( + def update_analysis_tags( self, analysis_id: StrictInt, - re_analysis_form: ReAnalysisForm, - x_rev_eng_application: Optional[StrictStr] = None, + analysis_update_tags_request: AnalysisUpdateTagsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5053,17 +5009,15 @@ def requeue_analysis( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseCreated: - """Requeue Analysis + ) -> BaseResponseAnalysisUpdateTagsResponse: + """Update Analysis Tags - Re-queues an already uploaded analysis + Updates analysis tags. User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param re_analysis_form: (required) - :type re_analysis_form: ReAnalysisForm - :param x_rev_eng_application: - :type x_rev_eng_application: str + :param analysis_update_tags_request: (required) + :type analysis_update_tags_request: AnalysisUpdateTagsRequest :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 @@ -5086,10 +5040,9 @@ def requeue_analysis( :return: Returns the result object. """ # noqa: E501 - _param = self._requeue_analysis_serialize( + _param = self._update_analysis_tags_serialize( analysis_id=analysis_id, - re_analysis_form=re_analysis_form, - x_rev_eng_application=x_rev_eng_application, + analysis_update_tags_request=analysis_update_tags_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5097,10 +5050,8 @@ def requeue_analysis( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponseCreated", + '200': "BaseResponseAnalysisUpdateTagsResponse", '422': "BaseResponse", - '404': "BaseResponse", - '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -5114,11 +5065,10 @@ def requeue_analysis( @validate_call - def requeue_analysis_with_http_info( + def update_analysis_tags_with_http_info( self, analysis_id: StrictInt, - re_analysis_form: ReAnalysisForm, - x_rev_eng_application: Optional[StrictStr] = None, + analysis_update_tags_request: AnalysisUpdateTagsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5131,17 +5081,15 @@ def requeue_analysis_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseCreated]: - """Requeue Analysis + ) -> ApiResponse[BaseResponseAnalysisUpdateTagsResponse]: + """Update Analysis Tags - Re-queues an already uploaded analysis + Updates analysis tags. User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param re_analysis_form: (required) - :type re_analysis_form: ReAnalysisForm - :param x_rev_eng_application: - :type x_rev_eng_application: str + :param analysis_update_tags_request: (required) + :type analysis_update_tags_request: AnalysisUpdateTagsRequest :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 @@ -5164,10 +5112,9 @@ def requeue_analysis_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._requeue_analysis_serialize( + _param = self._update_analysis_tags_serialize( analysis_id=analysis_id, - re_analysis_form=re_analysis_form, - x_rev_eng_application=x_rev_eng_application, + analysis_update_tags_request=analysis_update_tags_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5175,10 +5122,8 @@ def requeue_analysis_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponseCreated", + '200': "BaseResponseAnalysisUpdateTagsResponse", '422': "BaseResponse", - '404': "BaseResponse", - '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -5192,11 +5137,10 @@ def requeue_analysis_with_http_info( @validate_call - def requeue_analysis_without_preload_content( + def update_analysis_tags_without_preload_content( self, analysis_id: StrictInt, - re_analysis_form: ReAnalysisForm, - x_rev_eng_application: Optional[StrictStr] = None, + analysis_update_tags_request: AnalysisUpdateTagsRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5210,16 +5154,14 @@ def requeue_analysis_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Requeue Analysis + """Update Analysis Tags - Re-queues an already uploaded analysis + Updates analysis tags. User must be the owner. :param analysis_id: (required) :type analysis_id: int - :param re_analysis_form: (required) - :type re_analysis_form: ReAnalysisForm - :param x_rev_eng_application: - :type x_rev_eng_application: str + :param analysis_update_tags_request: (required) + :type analysis_update_tags_request: AnalysisUpdateTagsRequest :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 @@ -5242,10 +5184,9 @@ def requeue_analysis_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._requeue_analysis_serialize( + _param = self._update_analysis_tags_serialize( analysis_id=analysis_id, - re_analysis_form=re_analysis_form, - x_rev_eng_application=x_rev_eng_application, + analysis_update_tags_request=analysis_update_tags_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5253,10 +5194,8 @@ def requeue_analysis_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "BaseResponseCreated", + '200': "BaseResponseAnalysisUpdateTagsResponse", '422': "BaseResponse", - '404': "BaseResponse", - '400': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -5265,11 +5204,10 @@ def requeue_analysis_without_preload_content( return response_data.response - def _requeue_analysis_serialize( + def _update_analysis_tags_serialize( self, analysis_id, - re_analysis_form, - x_rev_eng_application, + analysis_update_tags_request, _request_auth, _content_type, _headers, @@ -5295,12 +5233,10 @@ def _requeue_analysis_serialize( _path_params['analysis_id'] = analysis_id # process the query parameters # process the header parameters - if x_rev_eng_application is not None: - _header_params['X-RevEng-Application'] = x_rev_eng_application # process the form parameters # process the body parameter - if re_analysis_form is not None: - _body_params = re_analysis_form + if analysis_update_tags_request is not None: + _body_params = analysis_update_tags_request # set the HTTP header `Accept` @@ -5331,8 +5267,8 @@ def _requeue_analysis_serialize( ] return self.api_client.param_serialize( - method='POST', - resource_path='/v2/analyses/{analysis_id}/requeue', + method='PATCH', + resource_path='/v2/analyses/{analysis_id}/tags', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5349,10 +5285,12 @@ def _requeue_analysis_serialize( @validate_call - def update_analysis( + def upload_file( self, - analysis_id: StrictInt, - analysis_update_request: AnalysisUpdateRequest, + upload_file_type: UploadFileType, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + packed_password: Optional[StrictStr] = None, + force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5365,15 +5303,18 @@ def update_analysis( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseAnalysisDetailResponse: - """Update Analysis + ) -> BaseResponseUploadResponse: + """Upload File - Updates analysis attributes (binary_name, analysis_scope). User must be the owner. - :param analysis_id: (required) - :type analysis_id: int - :param analysis_update_request: (required) - :type analysis_update_request: AnalysisUpdateRequest + :param upload_file_type: (required) + :type upload_file_type: UploadFileType + :param file: (required) + :type file: bytearray + :param packed_password: + :type packed_password: str + :param force_overwrite: + :type force_overwrite: bool :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 @@ -5396,9 +5337,11 @@ def update_analysis( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_serialize( - analysis_id=analysis_id, - analysis_update_request=analysis_update_request, + _param = self._upload_file_serialize( + upload_file_type=upload_file_type, + file=file, + packed_password=packed_password, + force_overwrite=force_overwrite, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5406,7 +5349,7 @@ def update_analysis( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisDetailResponse", + '200': "BaseResponseUploadResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -5421,10 +5364,12 @@ def update_analysis( @validate_call - def update_analysis_with_http_info( + def upload_file_with_http_info( self, - analysis_id: StrictInt, - analysis_update_request: AnalysisUpdateRequest, + upload_file_type: UploadFileType, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + packed_password: Optional[StrictStr] = None, + force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5437,15 +5382,18 @@ def update_analysis_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseAnalysisDetailResponse]: - """Update Analysis + ) -> ApiResponse[BaseResponseUploadResponse]: + """Upload File - Updates analysis attributes (binary_name, analysis_scope). User must be the owner. - :param analysis_id: (required) - :type analysis_id: int - :param analysis_update_request: (required) - :type analysis_update_request: AnalysisUpdateRequest + :param upload_file_type: (required) + :type upload_file_type: UploadFileType + :param file: (required) + :type file: bytearray + :param packed_password: + :type packed_password: str + :param force_overwrite: + :type force_overwrite: bool :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 @@ -5468,9 +5416,11 @@ def update_analysis_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_serialize( - analysis_id=analysis_id, - analysis_update_request=analysis_update_request, + _param = self._upload_file_serialize( + upload_file_type=upload_file_type, + file=file, + packed_password=packed_password, + force_overwrite=force_overwrite, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5478,7 +5428,7 @@ def update_analysis_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisDetailResponse", + '200': "BaseResponseUploadResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -5493,10 +5443,12 @@ def update_analysis_with_http_info( @validate_call - def update_analysis_without_preload_content( + def upload_file_without_preload_content( self, - analysis_id: StrictInt, - analysis_update_request: AnalysisUpdateRequest, + upload_file_type: UploadFileType, + file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + packed_password: Optional[StrictStr] = None, + force_overwrite: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5510,14 +5462,17 @@ def update_analysis_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Update Analysis + """Upload File - Updates analysis attributes (binary_name, analysis_scope). User must be the owner. - :param analysis_id: (required) - :type analysis_id: int - :param analysis_update_request: (required) - :type analysis_update_request: AnalysisUpdateRequest + :param upload_file_type: (required) + :type upload_file_type: UploadFileType + :param file: (required) + :type file: bytearray + :param packed_password: + :type packed_password: str + :param force_overwrite: + :type force_overwrite: bool :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 @@ -5540,9 +5495,11 @@ def update_analysis_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_serialize( - analysis_id=analysis_id, - analysis_update_request=analysis_update_request, + _param = self._upload_file_serialize( + upload_file_type=upload_file_type, + file=file, + packed_password=packed_password, + force_overwrite=force_overwrite, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5550,7 +5507,7 @@ def update_analysis_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisDetailResponse", + '200': "BaseResponseUploadResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -5560,10 +5517,12 @@ def update_analysis_without_preload_content( return response_data.response - def _update_analysis_serialize( + def _upload_file_serialize( self, - analysis_id, - analysis_update_request, + upload_file_type, + file, + packed_password, + force_overwrite, _request_auth, _content_type, _headers, @@ -5585,14 +5544,20 @@ def _update_analysis_serialize( _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 + if packed_password is not None: + + _query_params.append(('packed_password', packed_password)) + # process the header parameters # process the form parameters + if upload_file_type is not None: + _form_params.append(('upload_file_type', upload_file_type)) + if file is not None: + _files['file'] = file + if force_overwrite is not None: + _form_params.append(('force_overwrite', force_overwrite)) # process the body parameter - if analysis_update_request is not None: - _body_params = analysis_update_request # set the HTTP header `Accept` @@ -5610,7 +5575,7 @@ def _update_analysis_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'application/json' + 'multipart/form-data' ] ) ) @@ -5623,8 +5588,8 @@ def _update_analysis_serialize( ] return self.api_client.param_serialize( - method='PATCH', - resource_path='/v2/analyses/{analysis_id}', + method='POST', + resource_path='/v2/upload', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5641,10 +5606,15 @@ def _update_analysis_serialize( @validate_call - def update_analysis_tags( + def v3_get_analysis_strings( self, - analysis_id: StrictInt, - analysis_update_tags_request: AnalysisUpdateTagsRequest, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, + page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, + search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, + function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, + order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, + sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5657,15 +5627,25 @@ def update_analysis_tags( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseAnalysisUpdateTagsResponse: - """Update Analysis Tags + ) -> ListAnalysisStringsOutputBody: + """List strings for an analysis. - Updates analysis tags. User must be the owner. + Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param analysis_id: (required) + :param analysis_id: Analysis ID (required) :type analysis_id: int - :param analysis_update_tags_request: (required) - :type analysis_update_tags_request: AnalysisUpdateTagsRequest + :param page: Page number (1-indexed). + :type page: int + :param page_size: Number of results per page. + :type page_size: int + :param search: Filter by string value (case-insensitive substring match). + :type search: str + :param function_search: Filter by function name (case-insensitive substring match). + :type function_search: str + :param order_by: Field to order results by. + :type order_by: str + :param sort_order: Sort direction. + :type sort_order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -5688,9 +5668,14 @@ def update_analysis_tags( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_tags_serialize( + _param = self._v3_get_analysis_strings_serialize( analysis_id=analysis_id, - analysis_update_tags_request=analysis_update_tags_request, + page=page, + page_size=page_size, + search=search, + function_search=function_search, + order_by=order_by, + sort_order=sort_order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5698,8 +5683,11 @@ def update_analysis_tags( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisUpdateTagsResponse", - '422': "BaseResponse", + '200': "ListAnalysisStringsOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -5713,10 +5701,15 @@ def update_analysis_tags( @validate_call - def update_analysis_tags_with_http_info( + def v3_get_analysis_strings_with_http_info( self, - analysis_id: StrictInt, - analysis_update_tags_request: AnalysisUpdateTagsRequest, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, + page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, + search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, + function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, + order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, + sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5729,15 +5722,25 @@ def update_analysis_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseAnalysisUpdateTagsResponse]: - """Update Analysis Tags + ) -> ApiResponse[ListAnalysisStringsOutputBody]: + """List strings for an analysis. - Updates analysis tags. User must be the owner. + Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param analysis_id: (required) + :param analysis_id: Analysis ID (required) :type analysis_id: int - :param analysis_update_tags_request: (required) - :type analysis_update_tags_request: AnalysisUpdateTagsRequest + :param page: Page number (1-indexed). + :type page: int + :param page_size: Number of results per page. + :type page_size: int + :param search: Filter by string value (case-insensitive substring match). + :type search: str + :param function_search: Filter by function name (case-insensitive substring match). + :type function_search: str + :param order_by: Field to order results by. + :type order_by: str + :param sort_order: Sort direction. + :type sort_order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -5760,9 +5763,14 @@ def update_analysis_tags_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_tags_serialize( + _param = self._v3_get_analysis_strings_serialize( analysis_id=analysis_id, - analysis_update_tags_request=analysis_update_tags_request, + page=page, + page_size=page_size, + search=search, + function_search=function_search, + order_by=order_by, + sort_order=sort_order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5770,8 +5778,11 @@ def update_analysis_tags_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisUpdateTagsResponse", - '422': "BaseResponse", + '200': "ListAnalysisStringsOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -5785,10 +5796,15 @@ def update_analysis_tags_with_http_info( @validate_call - def update_analysis_tags_without_preload_content( + def v3_get_analysis_strings_without_preload_content( self, - analysis_id: StrictInt, - analysis_update_tags_request: AnalysisUpdateTagsRequest, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-indexed).")] = None, + page_size: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Number of results per page.")] = None, + search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by string value (case-insensitive substring match).")] = None, + function_search: Annotated[Optional[Annotated[str, Field(strict=True, max_length=255)]], Field(description="Filter by function name (case-insensitive substring match).")] = None, + order_by: Annotated[Optional[StrictStr], Field(description="Field to order results by.")] = None, + sort_order: Annotated[Optional[StrictStr], Field(description="Sort direction.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5802,14 +5818,24 @@ def update_analysis_tags_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Update Analysis Tags + """List strings for an analysis. - Updates analysis tags. User must be the owner. + Returns the strings discovered in an analysis, combining function-level and analysis-level strings. Supports value/function-name search, sorting and pagination. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param analysis_id: (required) + :param analysis_id: Analysis ID (required) :type analysis_id: int - :param analysis_update_tags_request: (required) - :type analysis_update_tags_request: AnalysisUpdateTagsRequest + :param page: Page number (1-indexed). + :type page: int + :param page_size: Number of results per page. + :type page_size: int + :param search: Filter by string value (case-insensitive substring match). + :type search: str + :param function_search: Filter by function name (case-insensitive substring match). + :type function_search: str + :param order_by: Field to order results by. + :type order_by: str + :param sort_order: Sort direction. + :type sort_order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -5832,9 +5858,14 @@ def update_analysis_tags_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_analysis_tags_serialize( + _param = self._v3_get_analysis_strings_serialize( analysis_id=analysis_id, - analysis_update_tags_request=analysis_update_tags_request, + page=page, + page_size=page_size, + search=search, + function_search=function_search, + order_by=order_by, + sort_order=sort_order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5842,8 +5873,11 @@ def update_analysis_tags_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseAnalysisUpdateTagsResponse", - '422': "BaseResponse", + '200': "ListAnalysisStringsOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -5852,10 +5886,15 @@ def update_analysis_tags_without_preload_content( return response_data.response - def _update_analysis_tags_serialize( + def _v3_get_analysis_strings_serialize( self, analysis_id, - analysis_update_tags_request, + page, + page_size, + search, + function_search, + order_by, + sort_order, _request_auth, _content_type, _headers, @@ -5880,11 +5919,33 @@ def _update_analysis_tags_serialize( if analysis_id is not None: _path_params['analysis_id'] = analysis_id # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if page_size is not None: + + _query_params.append(('page_size', page_size)) + + if search is not None: + + _query_params.append(('search', search)) + + if function_search is not None: + + _query_params.append(('function_search', function_search)) + + if order_by is not None: + + _query_params.append(('order_by', order_by)) + + if sort_order is not None: + + _query_params.append(('sort_order', sort_order)) + # process the header parameters # process the form parameters # process the body parameter - if analysis_update_tags_request is not None: - _body_params = analysis_update_tags_request # set the HTTP header `Accept` @@ -5895,19 +5956,6 @@ def _update_analysis_tags_serialize( ] ) - # 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] = [ @@ -5915,8 +5963,8 @@ def _update_analysis_tags_serialize( ] return self.api_client.param_serialize( - method='PATCH', - resource_path='/v2/analyses/{analysis_id}/tags', + method='GET', + resource_path='/v3/analyses/{analysis_id}/functions/strings', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5933,12 +5981,9 @@ def _update_analysis_tags_serialize( @validate_call - def upload_file( + def v3_get_analysis_strings_status( self, - upload_file_type: UploadFileType, - file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], - packed_password: Optional[StrictStr] = None, - force_overwrite: Optional[StrictBool] = None, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5951,18 +5996,13 @@ def upload_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseUploadResponse: - """Upload File + ) -> GetAnalysisStringsStatusOutputBody: + """Get the string-extraction status for an analysis. + Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param upload_file_type: (required) - :type upload_file_type: UploadFileType - :param file: (required) - :type file: bytearray - :param packed_password: - :type packed_password: str - :param force_overwrite: - :type force_overwrite: bool + :param analysis_id: Analysis ID (required) + :type analysis_id: int :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 @@ -5985,11 +6025,8 @@ def upload_file( :return: Returns the result object. """ # noqa: E501 - _param = self._upload_file_serialize( - upload_file_type=upload_file_type, - file=file, - packed_password=packed_password, - force_overwrite=force_overwrite, + _param = self._v3_get_analysis_strings_status_serialize( + analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5997,8 +6034,11 @@ def upload_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseUploadResponse", - '422': "BaseResponse", + '200': "GetAnalysisStringsStatusOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -6012,12 +6052,9 @@ def upload_file( @validate_call - def upload_file_with_http_info( + def v3_get_analysis_strings_status_with_http_info( self, - upload_file_type: UploadFileType, - file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], - packed_password: Optional[StrictStr] = None, - force_overwrite: Optional[StrictBool] = None, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -6030,18 +6067,13 @@ def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseUploadResponse]: - """Upload File + ) -> ApiResponse[GetAnalysisStringsStatusOutputBody]: + """Get the string-extraction status for an analysis. + Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param upload_file_type: (required) - :type upload_file_type: UploadFileType - :param file: (required) - :type file: bytearray - :param packed_password: - :type packed_password: str - :param force_overwrite: - :type force_overwrite: bool + :param analysis_id: Analysis ID (required) + :type analysis_id: int :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 @@ -6064,11 +6096,8 @@ def upload_file_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._upload_file_serialize( - upload_file_type=upload_file_type, - file=file, - packed_password=packed_password, - force_overwrite=force_overwrite, + _param = self._v3_get_analysis_strings_status_serialize( + analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -6076,8 +6105,11 @@ def upload_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseUploadResponse", - '422': "BaseResponse", + '200': "GetAnalysisStringsStatusOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -6091,12 +6123,9 @@ def upload_file_with_http_info( @validate_call - def upload_file_without_preload_content( + def v3_get_analysis_strings_status_without_preload_content( self, - upload_file_type: UploadFileType, - file: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], - packed_password: Optional[StrictStr] = None, - force_overwrite: Optional[StrictBool] = None, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -6110,17 +6139,12 @@ def upload_file_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Upload File + """Get the string-extraction status for an analysis. + Returns the status of the string-extraction task for the binary backing the analysis. One of UNINITIALISED, PENDING, RUNNING, COMPLETED, FAILED. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - :param upload_file_type: (required) - :type upload_file_type: UploadFileType - :param file: (required) - :type file: bytearray - :param packed_password: - :type packed_password: str - :param force_overwrite: - :type force_overwrite: bool + :param analysis_id: Analysis ID (required) + :type analysis_id: int :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 @@ -6143,11 +6167,8 @@ def upload_file_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._upload_file_serialize( - upload_file_type=upload_file_type, - file=file, - packed_password=packed_password, - force_overwrite=force_overwrite, + _param = self._v3_get_analysis_strings_status_serialize( + analysis_id=analysis_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -6155,8 +6176,11 @@ def upload_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseUploadResponse", - '422': "BaseResponse", + '200': "GetAnalysisStringsStatusOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -6165,12 +6189,9 @@ def upload_file_without_preload_content( return response_data.response - def _upload_file_serialize( + def _v3_get_analysis_strings_status_serialize( self, - upload_file_type, - file, - packed_password, - force_overwrite, + analysis_id, _request_auth, _content_type, _headers, @@ -6192,19 +6213,11 @@ def _upload_file_serialize( _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 - if packed_password is not None: - - _query_params.append(('packed_password', packed_password)) - # process the header parameters # process the form parameters - if upload_file_type is not None: - _form_params.append(('upload_file_type', upload_file_type)) - if file is not None: - _files['file'] = file - if force_overwrite is not None: - _form_params.append(('force_overwrite', force_overwrite)) # process the body parameter @@ -6216,19 +6229,6 @@ def _upload_file_serialize( ] ) - # 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( - [ - 'multipart/form-data' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ @@ -6236,8 +6236,8 @@ def _upload_file_serialize( ] return self.api_client.param_serialize( - method='POST', - resource_path='/v2/upload', + method='GET', + resource_path='/v3/analyses/{analysis_id}/functions/strings/status', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/revengai/api/collections_api.py b/revengai/api/collections_api.py index 912942e..155ca14 100644 --- a/revengai/api/collections_api.py +++ b/revengai/api/collections_api.py @@ -28,6 +28,8 @@ from revengai.models.collection_create_request import CollectionCreateRequest from revengai.models.collection_tags_update_request import CollectionTagsUpdateRequest from revengai.models.collection_update_request import CollectionUpdateRequest +from revengai.models.create_collection_input_body import CreateCollectionInputBody +from revengai.models.create_collection_output_body import CreateCollectionOutputBody from revengai.models.filters import Filters from revengai.models.order import Order @@ -326,6 +328,289 @@ def _create_collection_serialize( + @validate_call + def create_collection_0( + self, + create_collection_input_body: CreateCollectionInputBody, + _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, + ) -> CreateCollectionOutputBody: + """Create a collection. + + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody + :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._create_collection_0_serialize( + create_collection_input_body=create_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_collection_0_with_http_info( + self, + create_collection_input_body: CreateCollectionInputBody, + _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[CreateCollectionOutputBody]: + """Create a collection. + + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody + :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._create_collection_0_serialize( + create_collection_input_body=create_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_collection_0_without_preload_content( + self, + create_collection_input_body: CreateCollectionInputBody, + _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: + """Create a collection. + + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody + :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._create_collection_0_serialize( + create_collection_input_body=create_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_collection_0_serialize( + self, + create_collection_input_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_collection_input_body is not None: + _body_params = create_collection_input_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/collections', + 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 delete_collection( self, diff --git a/revengai/api_client.py b/revengai/api_client.py index 00714ef..ad2d8ce 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.89.0/python' + self.user_agent = 'OpenAPI-Generator/v3.91.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index f93573c..b7b2ce3 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.89.0\n"\ - "SDK Package Version: v3.89.0".\ + "Version of the API: v3.91.0\n"\ + "SDK Package Version: v3.91.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 6e3f2cb..c4e53b2 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -134,6 +134,7 @@ from revengai.models.batch_rename_output_body import BatchRenameOutputBody from revengai.models.binaries_related_status_response import BinariesRelatedStatusResponse from revengai.models.binaries_task_status import BinariesTaskStatus +from revengai.models.binary import Binary from revengai.models.binary_additional_details_data_response import BinaryAdditionalDetailsDataResponse from revengai.models.binary_additional_response import BinaryAdditionalResponse from revengai.models.binary_config import BinaryConfig @@ -176,6 +177,8 @@ from revengai.models.conversation_with_events import ConversationWithEvents from revengai.models.create_ai_decomp_output_body import CreateAIDecompOutputBody from revengai.models.create_checkout_session_input_body import CreateCheckoutSessionInputBody +from revengai.models.create_collection_input_body import CreateCollectionInputBody +from revengai.models.create_collection_output_body import CreateCollectionOutputBody from revengai.models.create_conversation_request import CreateConversationRequest from revengai.models.create_portal_session_input_body import CreatePortalSessionInputBody from revengai.models.created import Created diff --git a/revengai/models/binary.py b/revengai/models/binary.py new file mode 100644 index 0000000..516692c --- /dev/null +++ b/revengai/models/binary.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Binary(BaseModel): + """ + Binary + """ # noqa: E501 + analysis_id: StrictInt + binary_id: StrictInt + binary_name: StrictStr + created_at: datetime + is_system_analysis: StrictBool + owner_id: StrictInt + sha_256_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["analysis_id", "binary_id", "binary_name", "created_at", "is_system_analysis", "owner_id", "sha_256_hash"] + + 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 Binary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Binary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "analysis_id": obj.get("analysis_id"), + "binary_id": obj.get("binary_id"), + "binary_name": obj.get("binary_name"), + "created_at": obj.get("created_at"), + "is_system_analysis": obj.get("is_system_analysis"), + "owner_id": obj.get("owner_id"), + "sha_256_hash": obj.get("sha_256_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/create_collection_input_body.py b/revengai/models/create_collection_input_body.py new file mode 100644 index 0000000..8029bb8 --- /dev/null +++ b/revengai/models/create_collection_input_body.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class CreateCollectionInputBody(BaseModel): + """ + CreateCollectionInputBody + """ # noqa: E501 + binaries: Optional[List[StrictInt]] = Field(default=None, description="Optional binary IDs to link to the collection.") + collection_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Collection name.") + collection_scope: StrictStr = Field(description="Visibility scope.") + description: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Collection description.") + model_id: Annotated[int, Field(strict=True, ge=1)] = Field(description="Model ID the collection is associated with.") + tags: Optional[List[StrictStr]] = Field(default=None, description="Optional tags to attach to the collection.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries", "collection_name", "collection_scope", "description", "model_id", "tags"] + + @field_validator('collection_scope') + def collection_scope_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['PRIVATE', 'PUBLIC', 'PROTECTED', 'TEAM', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('PRIVATE', 'PUBLIC', 'PROTECTED', 'TEAM', 'unknown_default_open_api')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateCollectionInputBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if binaries (nullable) is None + # and model_fields_set contains the field + if self.binaries is None and "binaries" in self.model_fields_set: + _dict['binaries'] = None + + # set to None if tags (nullable) is None + # and model_fields_set contains the field + if self.tags is None and "tags" in self.model_fields_set: + _dict['tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateCollectionInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binaries": obj.get("binaries"), + "collection_name": obj.get("collection_name"), + "collection_scope": obj.get("collection_scope") if obj.get("collection_scope") is not None else 'PRIVATE', + "description": obj.get("description"), + "model_id": obj.get("model_id"), + "tags": obj.get("tags") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/create_collection_output_body.py b/revengai/models/create_collection_output_body.py new file mode 100644 index 0000000..f678000 --- /dev/null +++ b/revengai/models/create_collection_output_body.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.binary import Binary +from typing import Optional, Set +from typing_extensions import Self + +class CreateCollectionOutputBody(BaseModel): + """ + CreateCollectionOutputBody + """ # noqa: E501 + binaries: Optional[List[Binary]] = None + collection_id: StrictInt + collection_name: StrictStr + collection_scope: StrictStr + created_at: datetime + description: StrictStr + model_id: StrictInt + tags: Optional[List[StrictStr]] = None + team_id: StrictInt + updated_at: datetime + user_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries", "collection_id", "collection_name", "collection_scope", "created_at", "description", "model_id", "tags", "team_id", "updated_at", "user_id"] + + 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 CreateCollectionOutputBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in binaries (list) + _items = [] + if self.binaries: + for _item_binaries in self.binaries: + if _item_binaries: + _items.append(_item_binaries.to_dict()) + _dict['binaries'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if binaries (nullable) is None + # and model_fields_set contains the field + if self.binaries is None and "binaries" in self.model_fields_set: + _dict['binaries'] = None + + # set to None if tags (nullable) is None + # and model_fields_set contains the field + if self.tags is None and "tags" in self.model_fields_set: + _dict['tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateCollectionOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binaries": [Binary.from_dict(_item) for _item in obj["binaries"]] if obj.get("binaries") is not None else None, + "collection_id": obj.get("collection_id"), + "collection_name": obj.get("collection_name"), + "collection_scope": obj.get("collection_scope"), + "created_at": obj.get("created_at"), + "description": obj.get("description"), + "model_id": obj.get("model_id"), + "tags": obj.get("tags"), + "team_id": obj.get("team_id"), + "updated_at": obj.get("updated_at"), + "user_id": obj.get("user_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +