diff --git a/.sdk-version b/.sdk-version index 498b115..0c62fbe 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.110.0 +v3.113.0 diff --git a/README.md b/README.md index 8c8203b..d30877d 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,10 @@ 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_auto_unstrip_status**](docs/AnalysesCoreApi.md#v3_get_analysis_auto_unstrip_status) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. *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. +*AnalysesCoreApi* | [**v3_list_analyses**](docs/AnalysesCoreApi.md#v3_list_analyses) | **GET** /v3/analyses | List analyses *AnalysesCoreApi* | [**v3_list_example_analyses**](docs/AnalysesCoreApi.md#v3_list_example_analyses) | **GET** /v3/analyses/examples | List example analyses *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 @@ -164,6 +166,7 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**get_function_capabilities_0**](docs/FunctionsCoreApi.md#get_function_capabilities_0) | **GET** /v3/functions/{function_id}/capabilities | Get capabilities for a function *FunctionsCoreApi* | [**get_function_details**](docs/FunctionsCoreApi.md#get_function_details) | **GET** /v2/functions/{function_id} | Get function details *FunctionsCoreApi* | [**get_function_details_0**](docs/FunctionsCoreApi.md#get_function_details_0) | **GET** /v3/functions/{function_id} | Get function details +*FunctionsCoreApi* | [**get_function_indirect_call_sites**](docs/FunctionsCoreApi.md#get_function_indirect_call_sites) | **GET** /v3/functions/{function_id}/indirect-call-sites | Get indirect call sites for a function *FunctionsCoreApi* | [**get_function_strings**](docs/FunctionsCoreApi.md#get_function_strings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function *FunctionsCoreApi* | [**get_function_strings_0**](docs/FunctionsCoreApi.md#get_function_strings_0) | **GET** /v3/functions/{function_id}/strings | List strings for a function. *FunctionsCoreApi* | [**get_functions_callees_callers**](docs/FunctionsCoreApi.md#get_functions_callees_callers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions @@ -173,6 +176,7 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**list_analysis_functions**](docs/FunctionsCoreApi.md#list_analysis_functions) | **GET** /v3/analyses/{analysis_id}/functions | List functions in an analysis *FunctionsCoreApi* | [**list_imported_functions**](docs/FunctionsCoreApi.md#list_imported_functions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis *FunctionsCoreApi* | [**start_functions_matching**](docs/FunctionsCoreApi.md#start_functions_matching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions +*FunctionsCoreApi* | [**v3_canonicalize_function_names**](docs/FunctionsCoreApi.md#v3_canonicalize_function_names) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names *FunctionsDataTypesApi* | [**batch_update_function_data_types**](docs/FunctionsDataTypesApi.md#batch_update_function_data_types) | **PUT** /v3/analyses/{analysis_id}/functions/data-types | Batch update function data types *FunctionsDataTypesApi* | [**generate_function_data_types_for_analysis**](docs/FunctionsDataTypesApi.md#generate_function_data_types_for_analysis) | **POST** /v2/analyses/{analysis_id}/functions/data_types | Generate Function Data Types *FunctionsDataTypesApi* | [**generate_function_data_types_for_functions**](docs/FunctionsDataTypesApi.md#generate_function_data_types_for_functions) | **POST** /v2/functions/data_types | Generate Function Data Types for an arbitrary list of functions @@ -235,6 +239,7 @@ Class | Method | HTTP request | Description - [AnalysisLogMessage](docs/AnalysisLogMessage.md) - [AnalysisLogs](docs/AnalysisLogs.md) - [AnalysisRecord](docs/AnalysisRecord.md) + - [AnalysisRecordBody](docs/AnalysisRecordBody.md) - [AnalysisReport](docs/AnalysisReport.md) - [AnalysisScope](docs/AnalysisScope.md) - [AnalysisStringFunction](docs/AnalysisStringFunction.md) @@ -242,6 +247,7 @@ Class | Method | HTTP request | Description - [AnalysisStringItem](docs/AnalysisStringItem.md) - [AnalysisStringsResponse](docs/AnalysisStringsResponse.md) - [AnalysisStringsStatusResponse](docs/AnalysisStringsStatusResponse.md) + - [AnalysisTagBody](docs/AnalysisTagBody.md) - [AnalysisTags](docs/AnalysisTags.md) - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) @@ -261,6 +267,7 @@ Class | Method | HTTP request | Description - [AutoRunAgents](docs/AutoRunAgents.md) - [AutoUnstripRequest](docs/AutoUnstripRequest.md) - [AutoUnstripResponse](docs/AutoUnstripResponse.md) + - [AutoUnstripStatusOutputBody](docs/AutoUnstripStatusOutputBody.md) - [BaseResponse](docs/BaseResponse.md) - [BaseResponseAdditionalDetailsStatusResponse](docs/BaseResponseAdditionalDetailsStatusResponse.md) - [BaseResponseAnalysisBulkAddTagsResponse](docs/BaseResponseAnalysisBulkAddTagsResponse.md) @@ -355,6 +362,9 @@ Class | Method | HTTP request | Description - [CalleeFunctionInfo](docs/CalleeFunctionInfo.md) - [CalleesCallerFunctionsResponse](docs/CalleesCallerFunctionsResponse.md) - [CallerFunctionInfo](docs/CallerFunctionInfo.md) + - [CanonicalName](docs/CanonicalName.md) + - [CanonicalizeNamesInputBody](docs/CanonicalizeNamesInputBody.md) + - [CanonicalizeNamesOutputBody](docs/CanonicalizeNamesOutputBody.md) - [Capabilities](docs/Capabilities.md) - [CapabilitiesAgentResponse](docs/CapabilitiesAgentResponse.md) - [CapabilitiesOutputBody](docs/CapabilitiesOutputBody.md) @@ -519,10 +529,13 @@ Class | Method | HTTP request | Description - [ImportedFunctionCallerEntry](docs/ImportedFunctionCallerEntry.md) - [ImportedFunctionDetailOutputBody](docs/ImportedFunctionDetailOutputBody.md) - [ImportedFunctionEntry](docs/ImportedFunctionEntry.md) + - [IndirectCallSite](docs/IndirectCallSite.md) + - [IndirectCallSitesOutputBody](docs/IndirectCallSitesOutputBody.md) - [InlineComment](docs/InlineComment.md) - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InviteUserInputBody](docs/InviteUserInputBody.md) - [IssuerAllowedDomain](docs/IssuerAllowedDomain.md) + - [ListAnalysesOutputBody](docs/ListAnalysesOutputBody.md) - [ListAnalysisFunctionsDataTypesOutputBody](docs/ListAnalysisFunctionsDataTypesOutputBody.md) - [ListAnalysisFunctionsOutputBody](docs/ListAnalysisFunctionsOutputBody.md) - [ListAnalysisStringsOutputBody](docs/ListAnalysisStringsOutputBody.md) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 1e6ffcd..ffafc10 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -27,8 +27,10 @@ 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_auto_unstrip_status**](AnalysesCoreApi.md#v3_get_analysis_auto_unstrip_status) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. [**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. +[**v3_list_analyses**](AnalysesCoreApi.md#v3_list_analyses) | **GET** /v3/analyses | List analyses [**v3_list_example_analyses**](AnalysesCoreApi.md#v3_list_example_analyses) | **GET** /v3/analyses/examples | List example analyses @@ -2136,6 +2138,99 @@ 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_auto_unstrip_status** +> AutoUnstripStatusOutputBody v3_get_analysis_auto_unstrip_status(analysis_id) + +Get the auto-unstrip status for an analysis. + +Returns the status of the auto-unstrip 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): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.auto_unstrip_status_output_body import AutoUnstripStatusOutputBody +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' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# 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 auto-unstrip status for an analysis. + api_response = api_instance.v3_get_analysis_auto_unstrip_status(analysis_id) + print("The response of AnalysesCoreApi->v3_get_analysis_auto_unstrip_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->v3_get_analysis_auto_unstrip_status: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_id** | **int**| Analysis ID | + +### Return type + +[**AutoUnstripStatusOutputBody**](AutoUnstripStatusOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### 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** > 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) @@ -2334,6 +2429,115 @@ 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_list_analyses** +> ListAnalysesOutputBody v3_list_analyses(search_term=search_term, analysis_scope=analysis_scope, status=status, model_name=model_name, usernames=usernames, sha256_hash=sha256_hash, page_size=page_size, next_page_token=next_page_token, order_by=order_by, order=order) + +List analyses + +Returns a page of analyses visible to the caller, filtered and ordered by the query parameters. + +**Error codes:** +- `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.list_analyses_output_body import ListAnalysesOutputBody +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' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# 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) + search_term = 'search_term_example' # str | (optional) + analysis_scope = ["PRIVATE"] # List[str] | Leave empty for no filter (optional) (default to ["PRIVATE"]) + status = ['status_example'] # List[str] | (optional) + model_name = ['model_name_example'] # List[Optional[str]] | (optional) + usernames = ['usernames_example'] # List[Optional[str]] | (optional) + sha256_hash = 'sha256_hash_example' # str | (optional) + page_size = 20 # int | (optional) (default to 20) + next_page_token = 'next_page_token_example' # str | Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). (optional) + order_by = created # str | (optional) (default to created) + order = DESC # str | (optional) (default to DESC) + + try: + # List analyses + api_response = api_instance.v3_list_analyses(search_term=search_term, analysis_scope=analysis_scope, status=status, model_name=model_name, usernames=usernames, sha256_hash=sha256_hash, page_size=page_size, next_page_token=next_page_token, order_by=order_by, order=order) + print("The response of AnalysesCoreApi->v3_list_analyses:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->v3_list_analyses: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **search_term** | **str**| | [optional] + **analysis_scope** | [**List[str]**](str.md)| Leave empty for no filter | [optional] [default to ["PRIVATE"]] + **status** | [**List[str]**](str.md)| | [optional] + **model_name** | [**List[Optional[str]]**](str.md)| | [optional] + **usernames** | [**List[Optional[str]]**](str.md)| | [optional] + **sha256_hash** | **str**| | [optional] + **page_size** | **int**| | [optional] [default to 20] + **next_page_token** | **str**| Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). | [optional] + **order_by** | **str**| | [optional] [default to created] + **order** | **str**| | [optional] [default to DESC] + +### Return type + +[**ListAnalysesOutputBody**](ListAnalysesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**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_list_example_analyses** > ListExampleAnalysesOutputBody v3_list_example_analyses() diff --git a/docs/AnalysisRecordBody.md b/docs/AnalysisRecordBody.md new file mode 100644 index 0000000..876326b --- /dev/null +++ b/docs/AnalysisRecordBody.md @@ -0,0 +1,43 @@ +# AnalysisRecordBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**analysis_id** | **int** | Analysis ID | +**analysis_scope** | **str** | Scope of the analysis | +**base_address** | **int** | Binary base address | +**binary_id** | **int** | Binary ID | +**binary_name** | **str** | Binary filename | +**binary_size** | **int** | Binary size in bytes | +**creation** | **datetime** | When the analysis was created | +**function_boundaries_hash** | **str** | Hash of the binary's provided function boundaries | +**is_owner** | **bool** | True when the caller owns the analysis | +**model_id** | **int** | Model ID | +**model_name** | **str** | Model name | +**sha_256_hash** | **str** | SHA-256 hash of the binary | +**status** | **str** | Analysis status | +**tags** | [**List[AnalysisTagBody]**](AnalysisTagBody.md) | Tags associated with the binary | +**username** | **str** | Username of the analysis owner | + +## Example + +```python +from revengai.models.analysis_record_body import AnalysisRecordBody + +# TODO update the JSON string below +json = "{}" +# create an instance of AnalysisRecordBody from a JSON string +analysis_record_body_instance = AnalysisRecordBody.from_json(json) +# print the JSON string representation of the object +print(AnalysisRecordBody.to_json()) + +# convert the object into a dict +analysis_record_body_dict = analysis_record_body_instance.to_dict() +# create an instance of AnalysisRecordBody from a dict +analysis_record_body_from_dict = AnalysisRecordBody.from_dict(analysis_record_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/AnalysisTagBody.md b/docs/AnalysisTagBody.md new file mode 100644 index 0000000..c53e55b --- /dev/null +++ b/docs/AnalysisTagBody.md @@ -0,0 +1,31 @@ +# AnalysisTagBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collection_id** | **int** | Collection this tag maps to, or null | +**name** | **str** | Tag name | +**origin** | **str** | Origin of the tag | + +## Example + +```python +from revengai.models.analysis_tag_body import AnalysisTagBody + +# TODO update the JSON string below +json = "{}" +# create an instance of AnalysisTagBody from a JSON string +analysis_tag_body_instance = AnalysisTagBody.from_json(json) +# print the JSON string representation of the object +print(AnalysisTagBody.to_json()) + +# convert the object into a dict +analysis_tag_body_dict = analysis_tag_body_instance.to_dict() +# create an instance of AnalysisTagBody from a dict +analysis_tag_body_from_dict = AnalysisTagBody.from_dict(analysis_tag_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/AutoUnstripStatusOutputBody.md b/docs/AutoUnstripStatusOutputBody.md new file mode 100644 index 0000000..a1e4257 --- /dev/null +++ b/docs/AutoUnstripStatusOutputBody.md @@ -0,0 +1,29 @@ +# AutoUnstripStatusOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | Auto-unstrip task status | + +## Example + +```python +from revengai.models.auto_unstrip_status_output_body import AutoUnstripStatusOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of AutoUnstripStatusOutputBody from a JSON string +auto_unstrip_status_output_body_instance = AutoUnstripStatusOutputBody.from_json(json) +# print the JSON string representation of the object +print(AutoUnstripStatusOutputBody.to_json()) + +# convert the object into a dict +auto_unstrip_status_output_body_dict = auto_unstrip_status_output_body_instance.to_dict() +# create an instance of AutoUnstripStatusOutputBody from a dict +auto_unstrip_status_output_body_from_dict = AutoUnstripStatusOutputBody.from_dict(auto_unstrip_status_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/docs/CanonicalName.md b/docs/CanonicalName.md new file mode 100644 index 0000000..958e642 --- /dev/null +++ b/docs/CanonicalName.md @@ -0,0 +1,30 @@ +# CanonicalName + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**canonical_name** | **str** | Canonical form of the name, or the input name itself when it has no canonical form. | +**name** | **str** | The input function name. | + +## Example + +```python +from revengai.models.canonical_name import CanonicalName + +# TODO update the JSON string below +json = "{}" +# create an instance of CanonicalName from a JSON string +canonical_name_instance = CanonicalName.from_json(json) +# print the JSON string representation of the object +print(CanonicalName.to_json()) + +# convert the object into a dict +canonical_name_dict = canonical_name_instance.to_dict() +# create an instance of CanonicalName from a dict +canonical_name_from_dict = CanonicalName.from_dict(canonical_name_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/CanonicalizeNamesInputBody.md b/docs/CanonicalizeNamesInputBody.md new file mode 100644 index 0000000..ae67c9d --- /dev/null +++ b/docs/CanonicalizeNamesInputBody.md @@ -0,0 +1,29 @@ +# CanonicalizeNamesInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**names** | **List[str]** | Function names to canonicalize. | + +## Example + +```python +from revengai.models.canonicalize_names_input_body import CanonicalizeNamesInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of CanonicalizeNamesInputBody from a JSON string +canonicalize_names_input_body_instance = CanonicalizeNamesInputBody.from_json(json) +# print the JSON string representation of the object +print(CanonicalizeNamesInputBody.to_json()) + +# convert the object into a dict +canonicalize_names_input_body_dict = canonicalize_names_input_body_instance.to_dict() +# create an instance of CanonicalizeNamesInputBody from a dict +canonicalize_names_input_body_from_dict = CanonicalizeNamesInputBody.from_dict(canonicalize_names_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/CanonicalizeNamesOutputBody.md b/docs/CanonicalizeNamesOutputBody.md new file mode 100644 index 0000000..c828845 --- /dev/null +++ b/docs/CanonicalizeNamesOutputBody.md @@ -0,0 +1,29 @@ +# CanonicalizeNamesOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**List[CanonicalName]**](CanonicalName.md) | Canonicalized names in the same order as the input. | + +## Example + +```python +from revengai.models.canonicalize_names_output_body import CanonicalizeNamesOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of CanonicalizeNamesOutputBody from a JSON string +canonicalize_names_output_body_instance = CanonicalizeNamesOutputBody.from_json(json) +# print the JSON string representation of the object +print(CanonicalizeNamesOutputBody.to_json()) + +# convert the object into a dict +canonicalize_names_output_body_dict = canonicalize_names_output_body_instance.to_dict() +# create an instance of CanonicalizeNamesOutputBody from a dict +canonicalize_names_output_body_from_dict = CanonicalizeNamesOutputBody.from_dict(canonicalize_names_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/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index 6c308dc..56381c5 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -23,6 +23,7 @@ Method | HTTP request | Description [**get_function_capabilities_0**](FunctionsCoreApi.md#get_function_capabilities_0) | **GET** /v3/functions/{function_id}/capabilities | Get capabilities for a function [**get_function_details**](FunctionsCoreApi.md#get_function_details) | **GET** /v2/functions/{function_id} | Get function details [**get_function_details_0**](FunctionsCoreApi.md#get_function_details_0) | **GET** /v3/functions/{function_id} | Get function details +[**get_function_indirect_call_sites**](FunctionsCoreApi.md#get_function_indirect_call_sites) | **GET** /v3/functions/{function_id}/indirect-call-sites | Get indirect call sites for a function [**get_function_strings**](FunctionsCoreApi.md#get_function_strings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function [**get_function_strings_0**](FunctionsCoreApi.md#get_function_strings_0) | **GET** /v3/functions/{function_id}/strings | List strings for a function. [**get_functions_callees_callers**](FunctionsCoreApi.md#get_functions_callees_callers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions @@ -32,6 +33,7 @@ Method | HTTP request | Description [**list_analysis_functions**](FunctionsCoreApi.md#list_analysis_functions) | **GET** /v3/analyses/{analysis_id}/functions | List functions in an analysis [**list_imported_functions**](FunctionsCoreApi.md#list_imported_functions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis [**start_functions_matching**](FunctionsCoreApi.md#start_functions_matching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions +[**v3_canonicalize_function_names**](FunctionsCoreApi.md#v3_canonicalize_function_names) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names # **add_function_callee** @@ -1732,6 +1734,99 @@ 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_function_indirect_call_sites** +> IndirectCallSitesOutputBody get_function_indirect_call_sites(function_id) + +Get indirect call sites for a function + +Returns the function's indirect call instructions with their resolved call target. + +**Error codes:** +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody +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' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.FunctionsCoreApi(api_client) + function_id = 56 # int | Function ID + + try: + # Get indirect call sites for a function + api_response = api_instance.get_function_indirect_call_sites(function_id) + print("The response of FunctionsCoreApi->get_function_indirect_call_sites:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FunctionsCoreApi->get_function_indirect_call_sites: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **function_id** | **int**| Function ID | + +### Return type + +[**IndirectCallSitesOutputBody**](IndirectCallSitesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### 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_function_strings** > BaseResponseFunctionStringsResponse get_function_strings(function_id, page=page, page_size=page_size, search=search) @@ -2597,3 +2692,97 @@ 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_canonicalize_function_names** +> CanonicalizeNamesOutputBody v3_canonicalize_function_names(canonicalize_names_input_body) + +Canonicalize a batch of function names + +Accepts up to 25 raw function names and returns their canonical forms in the same order. A name with no canonical form is returned unchanged. + +**Error codes:** +- `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request +- `503` [`SERVICE_UNAVAILABLE`](/errors/SERVICE_UNAVAILABLE) — Service Unavailable + +### Example + +* Api Key Authentication (APIKey): +* Bearer Authentication (bearerAuth): + +```python +import revengai +from revengai.models.canonicalize_names_input_body import CanonicalizeNamesInputBody +from revengai.models.canonicalize_names_output_body import CanonicalizeNamesOutputBody +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' + +# Configure Bearer authorization: bearerAuth +configuration = revengai.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.FunctionsCoreApi(api_client) + canonicalize_names_input_body = revengai.CanonicalizeNamesInputBody() # CanonicalizeNamesInputBody | + + try: + # Canonicalize a batch of function names + api_response = api_instance.v3_canonicalize_function_names(canonicalize_names_input_body) + print("The response of FunctionsCoreApi->v3_canonicalize_function_names:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FunctionsCoreApi->v3_canonicalize_function_names: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **canonicalize_names_input_body** | [**CanonicalizeNamesInputBody**](CanonicalizeNamesInputBody.md)| | + +### Return type + +[**CanonicalizeNamesOutputBody**](CanonicalizeNamesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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/IndirectCallSite.md b/docs/IndirectCallSite.md new file mode 100644 index 0000000..145ed8b --- /dev/null +++ b/docs/IndirectCallSite.md @@ -0,0 +1,33 @@ +# IndirectCallSite + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**callee_function_id** | **int** | | [optional] +**inst_vaddr** | **int** | Vaddr of the indirect call instruction. | +**is_external** | **bool** | | +**target_name** | **str** | | [optional] +**target_vaddr** | **int** | Resolved call target vaddr. | + +## Example + +```python +from revengai.models.indirect_call_site import IndirectCallSite + +# TODO update the JSON string below +json = "{}" +# create an instance of IndirectCallSite from a JSON string +indirect_call_site_instance = IndirectCallSite.from_json(json) +# print the JSON string representation of the object +print(IndirectCallSite.to_json()) + +# convert the object into a dict +indirect_call_site_dict = indirect_call_site_instance.to_dict() +# create an instance of IndirectCallSite from a dict +indirect_call_site_from_dict = IndirectCallSite.from_dict(indirect_call_site_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/IndirectCallSitesOutputBody.md b/docs/IndirectCallSitesOutputBody.md new file mode 100644 index 0000000..80238aa --- /dev/null +++ b/docs/IndirectCallSitesOutputBody.md @@ -0,0 +1,30 @@ +# IndirectCallSitesOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**function_id** | **int** | | +**sites** | [**List[IndirectCallSite]**](IndirectCallSite.md) | | + +## Example + +```python +from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of IndirectCallSitesOutputBody from a JSON string +indirect_call_sites_output_body_instance = IndirectCallSitesOutputBody.from_json(json) +# print the JSON string representation of the object +print(IndirectCallSitesOutputBody.to_json()) + +# convert the object into a dict +indirect_call_sites_output_body_dict = indirect_call_sites_output_body_instance.to_dict() +# create an instance of IndirectCallSitesOutputBody from a dict +indirect_call_sites_output_body_from_dict = IndirectCallSitesOutputBody.from_dict(indirect_call_sites_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/docs/ListAnalysesOutputBody.md b/docs/ListAnalysesOutputBody.md new file mode 100644 index 0000000..5715d4e --- /dev/null +++ b/docs/ListAnalysesOutputBody.md @@ -0,0 +1,31 @@ +# ListAnalysesOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**next_page_token** | **str** | Opaque cursor to fetch the next page; empty on the last page | [optional] +**page_size** | **int** | Number of results in this page | +**results** | [**List[AnalysisRecordBody]**](AnalysisRecordBody.md) | The page of matching analyses | + +## Example + +```python +from revengai.models.list_analyses_output_body import ListAnalysesOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of ListAnalysesOutputBody from a JSON string +list_analyses_output_body_instance = ListAnalysesOutputBody.from_json(json) +# print the JSON string representation of the object +print(ListAnalysesOutputBody.to_json()) + +# convert the object into a dict +list_analyses_output_body_dict = list_analyses_output_body_instance.to_dict() +# create an instance of ListAnalysesOutputBody from a dict +list_analyses_output_body_from_dict = ListAnalysesOutputBody.from_dict(list_analyses_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 fb65e44..74f180d 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.110.0" +__version__ = "v3.113.0" # Define package exports __all__ = [ @@ -78,6 +78,7 @@ "AnalysisLogMessage", "AnalysisLogs", "AnalysisRecord", + "AnalysisRecordBody", "AnalysisReport", "AnalysisScope", "AnalysisStringFunction", @@ -85,6 +86,7 @@ "AnalysisStringItem", "AnalysisStringsResponse", "AnalysisStringsStatusResponse", + "AnalysisTagBody", "AnalysisTags", "AnalysisUpdateRequest", "AnalysisUpdateTagsRequest", @@ -104,6 +106,7 @@ "AutoRunAgents", "AutoUnstripRequest", "AutoUnstripResponse", + "AutoUnstripStatusOutputBody", "BaseResponse", "BaseResponseAdditionalDetailsStatusResponse", "BaseResponseAnalysisBulkAddTagsResponse", @@ -198,6 +201,9 @@ "CalleeFunctionInfo", "CalleesCallerFunctionsResponse", "CallerFunctionInfo", + "CanonicalName", + "CanonicalizeNamesInputBody", + "CanonicalizeNamesOutputBody", "Capabilities", "CapabilitiesAgentResponse", "CapabilitiesOutputBody", @@ -362,10 +368,13 @@ "ImportedFunctionCallerEntry", "ImportedFunctionDetailOutputBody", "ImportedFunctionEntry", + "IndirectCallSite", + "IndirectCallSitesOutputBody", "InlineComment", "InsertAnalysisLogRequest", "InviteUserInputBody", "IssuerAllowedDomain", + "ListAnalysesOutputBody", "ListAnalysisFunctionsDataTypesOutputBody", "ListAnalysisFunctionsOutputBody", "ListAnalysisStringsOutputBody", @@ -621,6 +630,7 @@ from revengai.models.analysis_log_message import AnalysisLogMessage as AnalysisLogMessage from revengai.models.analysis_logs import AnalysisLogs as AnalysisLogs from revengai.models.analysis_record import AnalysisRecord as AnalysisRecord +from revengai.models.analysis_record_body import AnalysisRecordBody as AnalysisRecordBody from revengai.models.analysis_report import AnalysisReport as AnalysisReport from revengai.models.analysis_scope import AnalysisScope as AnalysisScope from revengai.models.analysis_string_function import AnalysisStringFunction as AnalysisStringFunction @@ -628,6 +638,7 @@ from revengai.models.analysis_string_item import AnalysisStringItem as AnalysisStringItem from revengai.models.analysis_strings_response import AnalysisStringsResponse as AnalysisStringsResponse from revengai.models.analysis_strings_status_response import AnalysisStringsStatusResponse as AnalysisStringsStatusResponse +from revengai.models.analysis_tag_body import AnalysisTagBody as AnalysisTagBody from revengai.models.analysis_tags import AnalysisTags as AnalysisTags from revengai.models.analysis_update_request import AnalysisUpdateRequest as AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest as AnalysisUpdateTagsRequest @@ -647,6 +658,7 @@ from revengai.models.auto_run_agents import AutoRunAgents as AutoRunAgents from revengai.models.auto_unstrip_request import AutoUnstripRequest as AutoUnstripRequest from revengai.models.auto_unstrip_response import AutoUnstripResponse as AutoUnstripResponse +from revengai.models.auto_unstrip_status_output_body import AutoUnstripStatusOutputBody as AutoUnstripStatusOutputBody from revengai.models.base_response import BaseResponse as BaseResponse from revengai.models.base_response_additional_details_status_response import BaseResponseAdditionalDetailsStatusResponse as BaseResponseAdditionalDetailsStatusResponse from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse as BaseResponseAnalysisBulkAddTagsResponse @@ -741,6 +753,9 @@ from revengai.models.callee_function_info import CalleeFunctionInfo as CalleeFunctionInfo from revengai.models.callees_caller_functions_response import CalleesCallerFunctionsResponse as CalleesCallerFunctionsResponse from revengai.models.caller_function_info import CallerFunctionInfo as CallerFunctionInfo +from revengai.models.canonical_name import CanonicalName as CanonicalName +from revengai.models.canonicalize_names_input_body import CanonicalizeNamesInputBody as CanonicalizeNamesInputBody +from revengai.models.canonicalize_names_output_body import CanonicalizeNamesOutputBody as CanonicalizeNamesOutputBody from revengai.models.capabilities import Capabilities as Capabilities from revengai.models.capabilities_agent_response import CapabilitiesAgentResponse as CapabilitiesAgentResponse from revengai.models.capabilities_output_body import CapabilitiesOutputBody as CapabilitiesOutputBody @@ -905,10 +920,13 @@ from revengai.models.imported_function_caller_entry import ImportedFunctionCallerEntry as ImportedFunctionCallerEntry from revengai.models.imported_function_detail_output_body import ImportedFunctionDetailOutputBody as ImportedFunctionDetailOutputBody from revengai.models.imported_function_entry import ImportedFunctionEntry as ImportedFunctionEntry +from revengai.models.indirect_call_site import IndirectCallSite as IndirectCallSite +from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody as IndirectCallSitesOutputBody from revengai.models.inline_comment import InlineComment as InlineComment from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest as InsertAnalysisLogRequest from revengai.models.invite_user_input_body import InviteUserInputBody as InviteUserInputBody from revengai.models.issuer_allowed_domain import IssuerAllowedDomain as IssuerAllowedDomain +from revengai.models.list_analyses_output_body import ListAnalysesOutputBody as ListAnalysesOutputBody from revengai.models.list_analysis_functions_data_types_output_body import ListAnalysisFunctionsDataTypesOutputBody as ListAnalysisFunctionsDataTypesOutputBody from revengai.models.list_analysis_functions_output_body import ListAnalysisFunctionsOutputBody as ListAnalysisFunctionsOutputBody from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody as ListAnalysisStringsOutputBody diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 133065e..6decf5b 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -25,6 +25,7 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy +from revengai.models.auto_unstrip_status_output_body import AutoUnstripStatusOutputBody from revengai.models.base_response import BaseResponse from revengai.models.base_response_analysis_create_response import BaseResponseAnalysisCreateResponse from revengai.models.base_response_analysis_detail_response import BaseResponseAnalysisDetailResponse @@ -44,6 +45,7 @@ from revengai.models.get_matches_output_body import GetMatchesOutputBody from revengai.models.get_matches_status_output_body import GetMatchesStatusOutputBody from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest +from revengai.models.list_analyses_output_body import ListAnalysesOutputBody from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody from revengai.models.list_example_analyses_output_body import ListExampleAnalysesOutputBody from revengai.models.model_name import ModelName @@ -6794,6 +6796,280 @@ def _upload_file_serialize( + @validate_call + def v3_get_analysis_auto_unstrip_status( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _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, + ) -> AutoUnstripStatusOutputBody: + """Get the auto-unstrip status for an analysis. + + Returns the status of the auto-unstrip 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 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 + (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._v3_get_analysis_auto_unstrip_status_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AutoUnstripStatusOutputBody", + '403': "APIError", + '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 v3_get_analysis_auto_unstrip_status_with_http_info( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _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[AutoUnstripStatusOutputBody]: + """Get the auto-unstrip status for an analysis. + + Returns the status of the auto-unstrip 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 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 + (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._v3_get_analysis_auto_unstrip_status_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AutoUnstripStatusOutputBody", + '403': "APIError", + '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 v3_get_analysis_auto_unstrip_status_without_preload_content( + self, + analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], + _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: + """Get the auto-unstrip status for an analysis. + + Returns the status of the auto-unstrip 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 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 + (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._v3_get_analysis_auto_unstrip_status_serialize( + analysis_id=analysis_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AutoUnstripStatusOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_get_analysis_auto_unstrip_status_serialize( + self, + analysis_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if analysis_id is not None: + _path_params['analysis_id'] = analysis_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/analyses/{analysis_id}/auto-unstrip/status', + 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 v3_get_analysis_strings( self, @@ -7444,6 +7720,436 @@ def _v3_get_analysis_strings_status_serialize( + @validate_call + def v3_list_analyses( + self, + search_term: Optional[StrictStr] = None, + analysis_scope: Annotated[Optional[List[StrictStr]], Field(description="Leave empty for no filter")] = None, + status: Optional[List[StrictStr]] = None, + model_name: Optional[List[Optional[StrictStr]]] = None, + usernames: Optional[List[Optional[StrictStr]]] = None, + sha256_hash: Optional[StrictStr] = None, + page_size: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + next_page_token: Annotated[Optional[StrictStr], Field(description="Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination).")] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListAnalysesOutputBody: + """List analyses + + Returns a page of analyses visible to the caller, filtered and ordered by the query parameters. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + + :param search_term: + :type search_term: str + :param analysis_scope: Leave empty for no filter + :type analysis_scope: List[str] + :param status: + :type status: List[str] + :param model_name: + :type model_name: List[Optional[str]] + :param usernames: + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param page_size: + :type page_size: int + :param next_page_token: Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). + :type next_page_token: str + :param order_by: + :type order_by: str + :param order: + :type 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 + (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._v3_list_analyses_serialize( + search_term=search_term, + analysis_scope=analysis_scope, + status=status, + model_name=model_name, + usernames=usernames, + sha256_hash=sha256_hash, + page_size=page_size, + next_page_token=next_page_token, + order_by=order_by, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListAnalysesOutputBody", + '400': "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 v3_list_analyses_with_http_info( + self, + search_term: Optional[StrictStr] = None, + analysis_scope: Annotated[Optional[List[StrictStr]], Field(description="Leave empty for no filter")] = None, + status: Optional[List[StrictStr]] = None, + model_name: Optional[List[Optional[StrictStr]]] = None, + usernames: Optional[List[Optional[StrictStr]]] = None, + sha256_hash: Optional[StrictStr] = None, + page_size: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + next_page_token: Annotated[Optional[StrictStr], Field(description="Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination).")] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListAnalysesOutputBody]: + """List analyses + + Returns a page of analyses visible to the caller, filtered and ordered by the query parameters. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + + :param search_term: + :type search_term: str + :param analysis_scope: Leave empty for no filter + :type analysis_scope: List[str] + :param status: + :type status: List[str] + :param model_name: + :type model_name: List[Optional[str]] + :param usernames: + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param page_size: + :type page_size: int + :param next_page_token: Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). + :type next_page_token: str + :param order_by: + :type order_by: str + :param order: + :type 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 + (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._v3_list_analyses_serialize( + search_term=search_term, + analysis_scope=analysis_scope, + status=status, + model_name=model_name, + usernames=usernames, + sha256_hash=sha256_hash, + page_size=page_size, + next_page_token=next_page_token, + order_by=order_by, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListAnalysesOutputBody", + '400': "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 v3_list_analyses_without_preload_content( + self, + search_term: Optional[StrictStr] = None, + analysis_scope: Annotated[Optional[List[StrictStr]], Field(description="Leave empty for no filter")] = None, + status: Optional[List[StrictStr]] = None, + model_name: Optional[List[Optional[StrictStr]]] = None, + usernames: Optional[List[Optional[StrictStr]]] = None, + sha256_hash: Optional[StrictStr] = None, + page_size: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + next_page_token: Annotated[Optional[StrictStr], Field(description="Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination).")] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List analyses + + Returns a page of analyses visible to the caller, filtered and ordered by the query parameters. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + + :param search_term: + :type search_term: str + :param analysis_scope: Leave empty for no filter + :type analysis_scope: List[str] + :param status: + :type status: List[str] + :param model_name: + :type model_name: List[Optional[str]] + :param usernames: + :type usernames: List[Optional[str]] + :param sha256_hash: + :type sha256_hash: str + :param page_size: + :type page_size: int + :param next_page_token: Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). + :type next_page_token: str + :param order_by: + :type order_by: str + :param order: + :type 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 + (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._v3_list_analyses_serialize( + search_term=search_term, + analysis_scope=analysis_scope, + status=status, + model_name=model_name, + usernames=usernames, + sha256_hash=sha256_hash, + page_size=page_size, + next_page_token=next_page_token, + order_by=order_by, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListAnalysesOutputBody", + '400': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_list_analyses_serialize( + self, + search_term, + analysis_scope, + status, + model_name, + usernames, + sha256_hash, + page_size, + next_page_token, + order_by, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'analysis_scope': 'multi', + 'status': 'multi', + 'model_name': 'csv', + 'usernames': 'csv', + } + + _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 analysis_scope is not None: + + _query_params.append(('analysis_scope', analysis_scope)) + + if status is not None: + + _query_params.append(('status', status)) + + if model_name is not None: + + _query_params.append(('model_name', model_name)) + + if usernames is not None: + + _query_params.append(('usernames', usernames)) + + if sha256_hash is not None: + + _query_params.append(('sha256_hash', sha256_hash)) + + if page_size is not None: + + _query_params.append(('page_size', page_size)) + + if next_page_token is not None: + + _query_params.append(('next_page_token', next_page_token)) + + if order_by is not None: + + _query_params.append(('order_by', order_by)) + + if order is not None: + + _query_params.append(('order', order)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/analyses', + 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 v3_list_example_analyses( self, diff --git a/revengai/api/functions_core_api.py b/revengai/api/functions_core_api.py index 8d154fd..79bda4a 100644 --- a/revengai/api/functions_core_api.py +++ b/revengai/api/functions_core_api.py @@ -33,6 +33,8 @@ from revengai.models.base_response_functions_detail_response import BaseResponseFunctionsDetailResponse from revengai.models.base_response_list_callees_caller_functions_response import BaseResponseListCalleesCallerFunctionsResponse from revengai.models.call_edges_output_body import CallEdgesOutputBody +from revengai.models.canonicalize_names_input_body import CanonicalizeNamesInputBody +from revengai.models.canonicalize_names_output_body import CanonicalizeNamesOutputBody from revengai.models.capabilities_output_body import CapabilitiesOutputBody from revengai.models.disassembly_output_body import DisassemblyOutputBody from revengai.models.function_details_output_body import FunctionDetailsOutputBody @@ -41,6 +43,7 @@ from revengai.models.get_matches_output_body import GetMatchesOutputBody from revengai.models.get_matches_status_output_body import GetMatchesStatusOutputBody from revengai.models.imported_function_detail_output_body import ImportedFunctionDetailOutputBody +from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody from revengai.models.list_analysis_functions_output_body import ListAnalysisFunctionsOutputBody from revengai.models.list_function_strings_output_body import ListFunctionStringsOutputBody from revengai.models.list_imported_functions_output_body import ListImportedFunctionsOutputBody @@ -5448,6 +5451,280 @@ def _get_function_details_0_serialize( + @validate_call + def get_function_indirect_call_sites( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + _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, + ) -> IndirectCallSitesOutputBody: + """Get indirect call sites for a function + + Returns the function's indirect call instructions with their resolved call target. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + + :param function_id: Function ID (required) + :type function_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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_function_indirect_call_sites_serialize( + function_id=function_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IndirectCallSitesOutputBody", + '403': "APIError", + '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 get_function_indirect_call_sites_with_http_info( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + _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[IndirectCallSitesOutputBody]: + """Get indirect call sites for a function + + Returns the function's indirect call instructions with their resolved call target. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + + :param function_id: Function ID (required) + :type function_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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_function_indirect_call_sites_serialize( + function_id=function_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IndirectCallSitesOutputBody", + '403': "APIError", + '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 get_function_indirect_call_sites_without_preload_content( + self, + function_id: Annotated[int, Field(strict=True, ge=1, description="Function ID")], + _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: + """Get indirect call sites for a function + + Returns the function's indirect call instructions with their resolved call target. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + + :param function_id: Function ID (required) + :type function_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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_function_indirect_call_sites_serialize( + function_id=function_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "IndirectCallSitesOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_function_indirect_call_sites_serialize( + self, + function_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if function_id is not None: + _path_params['function_id'] = function_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/functions/{function_id}/indirect-call-sites', + 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 get_function_strings( self, @@ -8159,3 +8436,290 @@ def _start_functions_matching_serialize( ) + + + @validate_call + def v3_canonicalize_function_names( + self, + canonicalize_names_input_body: CanonicalizeNamesInputBody, + _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, + ) -> CanonicalizeNamesOutputBody: + """Canonicalize a batch of function names + + Accepts up to 25 raw function names and returns their canonical forms in the same order. A name with no canonical form is returned unchanged. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `503` [`SERVICE_UNAVAILABLE`](/errors/SERVICE_UNAVAILABLE) — Service Unavailable + + :param canonicalize_names_input_body: (required) + :type canonicalize_names_input_body: CanonicalizeNamesInputBody + :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._v3_canonicalize_function_names_serialize( + canonicalize_names_input_body=canonicalize_names_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CanonicalizeNamesOutputBody", + '400': "APIError", + '422': "APIError", + '500': "APIError", + '503': "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 v3_canonicalize_function_names_with_http_info( + self, + canonicalize_names_input_body: CanonicalizeNamesInputBody, + _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[CanonicalizeNamesOutputBody]: + """Canonicalize a batch of function names + + Accepts up to 25 raw function names and returns their canonical forms in the same order. A name with no canonical form is returned unchanged. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `503` [`SERVICE_UNAVAILABLE`](/errors/SERVICE_UNAVAILABLE) — Service Unavailable + + :param canonicalize_names_input_body: (required) + :type canonicalize_names_input_body: CanonicalizeNamesInputBody + :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._v3_canonicalize_function_names_serialize( + canonicalize_names_input_body=canonicalize_names_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CanonicalizeNamesOutputBody", + '400': "APIError", + '422': "APIError", + '500': "APIError", + '503': "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 v3_canonicalize_function_names_without_preload_content( + self, + canonicalize_names_input_body: CanonicalizeNamesInputBody, + _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: + """Canonicalize a batch of function names + + Accepts up to 25 raw function names and returns their canonical forms in the same order. A name with no canonical form is returned unchanged. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `503` [`SERVICE_UNAVAILABLE`](/errors/SERVICE_UNAVAILABLE) — Service Unavailable + + :param canonicalize_names_input_body: (required) + :type canonicalize_names_input_body: CanonicalizeNamesInputBody + :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._v3_canonicalize_function_names_serialize( + canonicalize_names_input_body=canonicalize_names_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CanonicalizeNamesOutputBody", + '400': "APIError", + '422': "APIError", + '500': "APIError", + '503': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_canonicalize_function_names_serialize( + self, + canonicalize_names_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 canonicalize_names_input_body is not None: + _body_params = canonicalize_names_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', + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/functions/canonical-names', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/revengai/api_client.py b/revengai/api_client.py index c6e8df6..f99b4cb 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.110.0/python' + self.user_agent = 'OpenAPI-Generator/v3.113.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 0ae4ef3..e3f7a51 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -541,8 +541,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.110.0\n"\ - "SDK Package Version: v3.110.0".\ + "Version of the API: v3.113.0\n"\ + "SDK Package Version: v3.113.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 2503865..09aed17 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -43,6 +43,7 @@ from revengai.models.analysis_log_message import AnalysisLogMessage from revengai.models.analysis_logs import AnalysisLogs from revengai.models.analysis_record import AnalysisRecord +from revengai.models.analysis_record_body import AnalysisRecordBody from revengai.models.analysis_report import AnalysisReport from revengai.models.analysis_scope import AnalysisScope from revengai.models.analysis_string_function import AnalysisStringFunction @@ -50,6 +51,7 @@ from revengai.models.analysis_string_item import AnalysisStringItem from revengai.models.analysis_strings_response import AnalysisStringsResponse from revengai.models.analysis_strings_status_response import AnalysisStringsStatusResponse +from revengai.models.analysis_tag_body import AnalysisTagBody from revengai.models.analysis_tags import AnalysisTags from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest @@ -69,6 +71,7 @@ from revengai.models.auto_run_agents import AutoRunAgents from revengai.models.auto_unstrip_request import AutoUnstripRequest from revengai.models.auto_unstrip_response import AutoUnstripResponse +from revengai.models.auto_unstrip_status_output_body import AutoUnstripStatusOutputBody from revengai.models.base_response import BaseResponse from revengai.models.base_response_additional_details_status_response import BaseResponseAdditionalDetailsStatusResponse from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse @@ -163,6 +166,9 @@ from revengai.models.callee_function_info import CalleeFunctionInfo from revengai.models.callees_caller_functions_response import CalleesCallerFunctionsResponse from revengai.models.caller_function_info import CallerFunctionInfo +from revengai.models.canonical_name import CanonicalName +from revengai.models.canonicalize_names_input_body import CanonicalizeNamesInputBody +from revengai.models.canonicalize_names_output_body import CanonicalizeNamesOutputBody from revengai.models.capabilities import Capabilities from revengai.models.capabilities_agent_response import CapabilitiesAgentResponse from revengai.models.capabilities_output_body import CapabilitiesOutputBody @@ -327,10 +333,13 @@ from revengai.models.imported_function_caller_entry import ImportedFunctionCallerEntry from revengai.models.imported_function_detail_output_body import ImportedFunctionDetailOutputBody from revengai.models.imported_function_entry import ImportedFunctionEntry +from revengai.models.indirect_call_site import IndirectCallSite +from revengai.models.indirect_call_sites_output_body import IndirectCallSitesOutputBody from revengai.models.inline_comment import InlineComment from revengai.models.insert_analysis_log_request import InsertAnalysisLogRequest from revengai.models.invite_user_input_body import InviteUserInputBody from revengai.models.issuer_allowed_domain import IssuerAllowedDomain +from revengai.models.list_analyses_output_body import ListAnalysesOutputBody from revengai.models.list_analysis_functions_data_types_output_body import ListAnalysisFunctionsDataTypesOutputBody from revengai.models.list_analysis_functions_output_body import ListAnalysisFunctionsOutputBody from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody diff --git a/revengai/models/analysis_record_body.py b/revengai/models/analysis_record_body.py new file mode 100644 index 0000000..09c070c --- /dev/null +++ b/revengai/models/analysis_record_body.py @@ -0,0 +1,148 @@ +# 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, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.analysis_tag_body import AnalysisTagBody +from typing import Optional, Set +from typing_extensions import Self + +class AnalysisRecordBody(BaseModel): + """ + AnalysisRecordBody + """ # noqa: E501 + analysis_id: StrictInt = Field(description="Analysis ID") + analysis_scope: StrictStr = Field(description="Scope of the analysis") + base_address: StrictInt = Field(description="Binary base address") + binary_id: StrictInt = Field(description="Binary ID") + binary_name: StrictStr = Field(description="Binary filename") + binary_size: StrictInt = Field(description="Binary size in bytes") + creation: datetime = Field(description="When the analysis was created") + function_boundaries_hash: StrictStr = Field(description="Hash of the binary's provided function boundaries") + is_owner: StrictBool = Field(description="True when the caller owns the analysis") + model_id: StrictInt = Field(description="Model ID") + model_name: StrictStr = Field(description="Model name") + sha_256_hash: StrictStr = Field(description="SHA-256 hash of the binary") + status: StrictStr = Field(description="Analysis status") + tags: Optional[List[AnalysisTagBody]] = Field(description="Tags associated with the binary") + username: StrictStr = Field(description="Username of the analysis owner") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["analysis_id", "analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "creation", "function_boundaries_hash", "is_owner", "model_id", "model_name", "sha_256_hash", "status", "tags", "username"] + + @field_validator('analysis_scope') + def analysis_scope_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['PUBLIC', 'PRIVATE', 'TEAM', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('PUBLIC', 'PRIVATE', '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 AnalysisRecordBody 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 tags (list) + _items = [] + if self.tags: + for _item_tags in self.tags: + if _item_tags: + _items.append(_item_tags.to_dict()) + _dict['tags'] = _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 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 AnalysisRecordBody 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"), + "analysis_scope": obj.get("analysis_scope"), + "base_address": obj.get("base_address"), + "binary_id": obj.get("binary_id"), + "binary_name": obj.get("binary_name"), + "binary_size": obj.get("binary_size"), + "creation": obj.get("creation"), + "function_boundaries_hash": obj.get("function_boundaries_hash"), + "is_owner": obj.get("is_owner"), + "model_id": obj.get("model_id"), + "model_name": obj.get("model_name"), + "sha_256_hash": obj.get("sha_256_hash"), + "status": obj.get("status"), + "tags": [AnalysisTagBody.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, + "username": obj.get("username") + }) + # 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/analysis_tag_body.py b/revengai/models/analysis_tag_body.py new file mode 100644 index 0000000..57d5ed9 --- /dev/null +++ b/revengai/models/analysis_tag_body.py @@ -0,0 +1,108 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AnalysisTagBody(BaseModel): + """ + AnalysisTagBody + """ # noqa: E501 + collection_id: Optional[StrictInt] = Field(description="Collection this tag maps to, or null") + name: StrictStr = Field(description="Tag name") + origin: StrictStr = Field(description="Origin of the tag") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collection_id", "name", "origin"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AnalysisTagBody 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 collection_id (nullable) is None + # and model_fields_set contains the field + if self.collection_id is None and "collection_id" in self.model_fields_set: + _dict['collection_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AnalysisTagBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collection_id": obj.get("collection_id"), + "name": obj.get("name"), + "origin": obj.get("origin") + }) + # 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/auto_unstrip_status_output_body.py b/revengai/models/auto_unstrip_status_output_body.py new file mode 100644 index 0000000..dada910 --- /dev/null +++ b/revengai/models/auto_unstrip_status_output_body.py @@ -0,0 +1,106 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AutoUnstripStatusOutputBody(BaseModel): + """ + AutoUnstripStatusOutputBody + """ # noqa: E501 + status: StrictStr = Field(description="Auto-unstrip task status") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['UNINITIALISED', 'PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('UNINITIALISED', 'PENDING', 'RUNNING', 'COMPLETED', 'FAILED', '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 AutoUnstripStatusOutputBody 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 AutoUnstripStatusOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") + }) + # 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/canonical_name.py b/revengai/models/canonical_name.py new file mode 100644 index 0000000..c8e41b3 --- /dev/null +++ b/revengai/models/canonical_name.py @@ -0,0 +1,101 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CanonicalName(BaseModel): + """ + CanonicalName + """ # noqa: E501 + canonical_name: StrictStr = Field(description="Canonical form of the name, or the input name itself when it has no canonical form.") + name: StrictStr = Field(description="The input function name.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["canonical_name", "name"] + + 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 CanonicalName 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 CanonicalName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "canonical_name": obj.get("canonical_name"), + "name": obj.get("name") + }) + # 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/canonicalize_names_input_body.py b/revengai/models/canonicalize_names_input_body.py new file mode 100644 index 0000000..b929a58 --- /dev/null +++ b/revengai/models/canonicalize_names_input_body.py @@ -0,0 +1,105 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class CanonicalizeNamesInputBody(BaseModel): + """ + CanonicalizeNamesInputBody + """ # noqa: E501 + names: Optional[Annotated[List[StrictStr], Field(min_length=1, max_length=25)]] = Field(description="Function names to canonicalize.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["names"] + + 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 CanonicalizeNamesInputBody 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 names (nullable) is None + # and model_fields_set contains the field + if self.names is None and "names" in self.model_fields_set: + _dict['names'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CanonicalizeNamesInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "names": obj.get("names") + }) + # 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/canonicalize_names_output_body.py b/revengai/models/canonicalize_names_output_body.py new file mode 100644 index 0000000..8c96bbd --- /dev/null +++ b/revengai/models/canonicalize_names_output_body.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 pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.canonical_name import CanonicalName +from typing import Optional, Set +from typing_extensions import Self + +class CanonicalizeNamesOutputBody(BaseModel): + """ + CanonicalizeNamesOutputBody + """ # noqa: E501 + results: Optional[List[CanonicalName]] = Field(description="Canonicalized names in the same order as the input.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["results"] + + 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 CanonicalizeNamesOutputBody 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 results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _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 results (nullable) is None + # and model_fields_set contains the field + if self.results is None and "results" in self.model_fields_set: + _dict['results'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CanonicalizeNamesOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [CanonicalName.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # 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/indirect_call_site.py b/revengai/models/indirect_call_site.py new file mode 100644 index 0000000..32352f9 --- /dev/null +++ b/revengai/models/indirect_call_site.py @@ -0,0 +1,107 @@ +# 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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class IndirectCallSite(BaseModel): + """ + IndirectCallSite + """ # noqa: E501 + callee_function_id: Optional[StrictInt] = None + inst_vaddr: StrictInt = Field(description="Vaddr of the indirect call instruction.") + is_external: StrictBool + target_name: Optional[StrictStr] = None + target_vaddr: StrictInt = Field(description="Resolved call target vaddr.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["callee_function_id", "inst_vaddr", "is_external", "target_name", "target_vaddr"] + + 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 IndirectCallSite 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 IndirectCallSite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "callee_function_id": obj.get("callee_function_id"), + "inst_vaddr": obj.get("inst_vaddr"), + "is_external": obj.get("is_external"), + "target_name": obj.get("target_name"), + "target_vaddr": obj.get("target_vaddr") + }) + # 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/indirect_call_sites_output_body.py b/revengai/models/indirect_call_sites_output_body.py new file mode 100644 index 0000000..2e0426d --- /dev/null +++ b/revengai/models/indirect_call_sites_output_body.py @@ -0,0 +1,114 @@ +# 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, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.indirect_call_site import IndirectCallSite +from typing import Optional, Set +from typing_extensions import Self + +class IndirectCallSitesOutputBody(BaseModel): + """ + IndirectCallSitesOutputBody + """ # noqa: E501 + function_id: StrictInt + sites: Optional[List[IndirectCallSite]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["function_id", "sites"] + + 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 IndirectCallSitesOutputBody 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 sites (list) + _items = [] + if self.sites: + for _item_sites in self.sites: + if _item_sites: + _items.append(_item_sites.to_dict()) + _dict['sites'] = _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 sites (nullable) is None + # and model_fields_set contains the field + if self.sites is None and "sites" in self.model_fields_set: + _dict['sites'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of IndirectCallSitesOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "function_id": obj.get("function_id"), + "sites": [IndirectCallSite.from_dict(_item) for _item in obj["sites"]] if obj.get("sites") is not None else None + }) + # 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/list_analyses_output_body.py b/revengai/models/list_analyses_output_body.py new file mode 100644 index 0000000..6d34f8d --- /dev/null +++ b/revengai/models/list_analyses_output_body.py @@ -0,0 +1,116 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.analysis_record_body import AnalysisRecordBody +from typing import Optional, Set +from typing_extensions import Self + +class ListAnalysesOutputBody(BaseModel): + """ + ListAnalysesOutputBody + """ # noqa: E501 + next_page_token: Optional[StrictStr] = Field(default=None, description="Opaque cursor to fetch the next page; empty on the last page") + page_size: StrictInt = Field(description="Number of results in this page") + results: Optional[List[AnalysisRecordBody]] = Field(description="The page of matching analyses") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["next_page_token", "page_size", "results"] + + 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 ListAnalysesOutputBody 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 results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _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 results (nullable) is None + # and model_fields_set contains the field + if self.results is None and "results" in self.model_fields_set: + _dict['results'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListAnalysesOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "next_page_token": obj.get("next_page_token"), + "page_size": obj.get("page_size"), + "results": [AnalysisRecordBody.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # 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 + +