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 122ed9c..26af275 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.110.0 + 3.113.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.110.0" + implementation "ai.reveng:sdk:3.113.0" } ``` @@ -114,8 +114,10 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**updateAnalysis**](docs/AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis *AnalysesCoreApi* | [**updateAnalysisTags**](docs/AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags *AnalysesCoreApi* | [**uploadFile**](docs/AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File +*AnalysesCoreApi* | [**v3GetAnalysisAutoUnstripStatus**](docs/AnalysesCoreApi.md#v3GetAnalysisAutoUnstripStatus) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. *AnalysesCoreApi* | [**v3GetAnalysisStrings**](docs/AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. *AnalysesCoreApi* | [**v3GetAnalysisStringsStatus**](docs/AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. +*AnalysesCoreApi* | [**v3ListAnalyses**](docs/AnalysesCoreApi.md#v3ListAnalyses) | **GET** /v3/analyses | List analyses *AnalysesCoreApi* | [**v3ListExampleAnalyses**](docs/AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses *AnalysesResultsMetadataApi* | [**getAnalysisFunctionsPaginated**](docs/AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**getCapabilities**](docs/AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis @@ -199,6 +201,7 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**getFunctionCapabilities_0**](docs/FunctionsCoreApi.md#getFunctionCapabilities_0) | **GET** /v3/functions/{function_id}/capabilities | Get capabilities for a function *FunctionsCoreApi* | [**getFunctionDetails**](docs/FunctionsCoreApi.md#getFunctionDetails) | **GET** /v2/functions/{function_id} | Get function details *FunctionsCoreApi* | [**getFunctionDetails_0**](docs/FunctionsCoreApi.md#getFunctionDetails_0) | **GET** /v3/functions/{function_id} | Get function details +*FunctionsCoreApi* | [**getFunctionIndirectCallSites**](docs/FunctionsCoreApi.md#getFunctionIndirectCallSites) | **GET** /v3/functions/{function_id}/indirect-call-sites | Get indirect call sites for a function *FunctionsCoreApi* | [**getFunctionStrings**](docs/FunctionsCoreApi.md#getFunctionStrings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function *FunctionsCoreApi* | [**getFunctionStrings_0**](docs/FunctionsCoreApi.md#getFunctionStrings_0) | **GET** /v3/functions/{function_id}/strings | List strings for a function. *FunctionsCoreApi* | [**getFunctionsCalleesCallers**](docs/FunctionsCoreApi.md#getFunctionsCalleesCallers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions @@ -208,6 +211,7 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**listAnalysisFunctions**](docs/FunctionsCoreApi.md#listAnalysisFunctions) | **GET** /v3/analyses/{analysis_id}/functions | List functions in an analysis *FunctionsCoreApi* | [**listImportedFunctions**](docs/FunctionsCoreApi.md#listImportedFunctions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis *FunctionsCoreApi* | [**startFunctionsMatching**](docs/FunctionsCoreApi.md#startFunctionsMatching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions +*FunctionsCoreApi* | [**v3CanonicalizeFunctionNames**](docs/FunctionsCoreApi.md#v3CanonicalizeFunctionNames) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names *FunctionsDataTypesApi* | [**batchUpdateFunctionDataTypes**](docs/FunctionsDataTypesApi.md#batchUpdateFunctionDataTypes) | **PUT** /v3/analyses/{analysis_id}/functions/data-types | Batch update function data types *FunctionsDataTypesApi* | [**generateFunctionDataTypesForAnalysis**](docs/FunctionsDataTypesApi.md#generateFunctionDataTypesForAnalysis) | **POST** /v2/analyses/{analysis_id}/functions/data_types | Generate Function Data Types *FunctionsDataTypesApi* | [**generateFunctionDataTypesForFunctions**](docs/FunctionsDataTypesApi.md#generateFunctionDataTypesForFunctions) | **POST** /v2/functions/data_types | Generate Function Data Types for an arbitrary list of functions @@ -270,6 +274,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) @@ -277,6 +282,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) @@ -296,6 +302,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) @@ -390,6 +397,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) @@ -555,10 +565,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/build.gradle b/build.gradle index 2c8d568..7a82db4 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.110.0' +version = '3.113.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.110.0") + coordinates("ai.reveng", "sdk", "3.113.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 8b7bb83..b8e651a 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.110.0", + version := "3.113.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 28f8dd0..6614dcf 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -27,8 +27,10 @@ All URIs are relative to *https://api.reveng.ai* | [**updateAnalysis**](AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis | | [**updateAnalysisTags**](AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags | | [**uploadFile**](AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File | +| [**v3GetAnalysisAutoUnstripStatus**](AnalysesCoreApi.md#v3GetAnalysisAutoUnstripStatus) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. | | [**v3GetAnalysisStrings**](AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. | | [**v3GetAnalysisStringsStatus**](AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. | +| [**v3ListAnalyses**](AnalysesCoreApi.md#v3ListAnalyses) | **GET** /v3/analyses | List analyses | | [**v3ListExampleAnalyses**](AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses | @@ -1814,6 +1816,83 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3GetAnalysisAutoUnstripStatus** +> AutoUnstripStatusOutputBody v3GetAnalysisAutoUnstripStatus(analysisId) + +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 +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + AutoUnstripStatusOutputBody result = apiInstance.v3GetAnalysisAutoUnstripStatus(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3GetAnalysisAutoUnstripStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| 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 | - | + # **v3GetAnalysisStrings** > ListAnalysisStringsOutputBody v3GetAnalysisStrings(analysisId, page, pageSize, search, functionSearch, orderBy, sortOrder) @@ -1980,6 +2059,100 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3ListAnalyses** +> ListAnalysesOutputBody v3ListAnalyses(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, 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 +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + String searchTerm = "searchTerm_example"; // String | + List analysisScope = Arrays.asList(); // List | Leave empty for no filter + List status = Arrays.asList(); // List | + List modelName = Arrays.asList(); // List | + List usernames = Arrays.asList(); // List | + String sha256Hash = "sha256Hash_example"; // String | + Long pageSize = 20L; // Long | + String nextPageToken = "nextPageToken_example"; // String | Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). + String orderBy = "created"; // String | + String order = "ASC"; // String | + try { + ListAnalysesOutputBody result = apiInstance.v3ListAnalyses(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3ListAnalyses"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **searchTerm** | **String**| | [optional] | +| **analysisScope** | [**List<String>**](String.md)| Leave empty for no filter | [optional] [enum: PRIVATE, PUBLIC, TEAM] | +| **status** | [**List<String>**](String.md)| | [optional] [enum: Uploaded, Queued, Complete, Error, Processing] | +| **modelName** | [**List<String>**](String.md)| | [optional] | +| **usernames** | [**List<String>**](String.md)| | [optional] | +| **sha256Hash** | **String**| | [optional] | +| **pageSize** | **Long**| | [optional] [default to 20] | +| **nextPageToken** | **String**| Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). | [optional] | +| **orderBy** | **String**| | [optional] [default to created] [enum: created, binary_name, binary_size] | +| **order** | **String**| | [optional] [default to DESC] [enum: ASC, 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 | - | + # **v3ListExampleAnalyses** > ListExampleAnalysesOutputBody v3ListExampleAnalyses() diff --git a/docs/AnalysisRecordBody.md b/docs/AnalysisRecordBody.md new file mode 100644 index 0000000..ced29cc --- /dev/null +++ b/docs/AnalysisRecordBody.md @@ -0,0 +1,38 @@ + + +# AnalysisRecordBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | Analysis ID | | +|**analysisScope** | [**AnalysisScopeEnum**](#AnalysisScopeEnum) | Scope of the analysis | | +|**baseAddress** | **Long** | Binary base address | | +|**binaryId** | **Long** | Binary ID | | +|**binaryName** | **String** | Binary filename | | +|**binarySize** | **Long** | Binary size in bytes | | +|**creation** | **OffsetDateTime** | When the analysis was created | | +|**functionBoundariesHash** | **String** | Hash of the binary's provided function boundaries | | +|**isOwner** | **Boolean** | True when the caller owns the analysis | | +|**modelId** | **Long** | Model ID | | +|**modelName** | **String** | Model name | | +|**sha256Hash** | **String** | SHA-256 hash of the binary | | +|**status** | **String** | Analysis status | | +|**tags** | [**List<AnalysisTagBody>**](AnalysisTagBody.md) | Tags associated with the binary | | +|**username** | **String** | Username of the analysis owner | | + + + +## Enum: AnalysisScopeEnum + +| Name | Value | +|---- | -----| +| PUBLIC | "PUBLIC" | +| PRIVATE | "PRIVATE" | +| TEAM | "TEAM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/AnalysisTagBody.md b/docs/AnalysisTagBody.md new file mode 100644 index 0000000..d65ca23 --- /dev/null +++ b/docs/AnalysisTagBody.md @@ -0,0 +1,15 @@ + + +# AnalysisTagBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**collectionId** | **Long** | Collection this tag maps to, or null | | +|**name** | **String** | Tag name | | +|**origin** | **String** | Origin of the tag | | + + + diff --git a/docs/AutoUnstripStatusOutputBody.md b/docs/AutoUnstripStatusOutputBody.md new file mode 100644 index 0000000..a4db63e --- /dev/null +++ b/docs/AutoUnstripStatusOutputBody.md @@ -0,0 +1,26 @@ + + +# AutoUnstripStatusOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | [**StatusEnum**](#StatusEnum) | Auto-unstrip task status | | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| UNINITIALISED | "UNINITIALISED" | +| PENDING | "PENDING" | +| RUNNING | "RUNNING" | +| COMPLETED | "COMPLETED" | +| FAILED | "FAILED" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CanonicalName.md b/docs/CanonicalName.md new file mode 100644 index 0000000..86fc915 --- /dev/null +++ b/docs/CanonicalName.md @@ -0,0 +1,14 @@ + + +# CanonicalName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**canonicalName** | **String** | Canonical form of the name, or the input name itself when it has no canonical form. | | +|**name** | **String** | The input function name. | | + + + diff --git a/docs/CanonicalizeNamesInputBody.md b/docs/CanonicalizeNamesInputBody.md new file mode 100644 index 0000000..c608d7e --- /dev/null +++ b/docs/CanonicalizeNamesInputBody.md @@ -0,0 +1,13 @@ + + +# CanonicalizeNamesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**names** | **List<String>** | Function names to canonicalize. | | + + + diff --git a/docs/CanonicalizeNamesOutputBody.md b/docs/CanonicalizeNamesOutputBody.md new file mode 100644 index 0000000..756e452 --- /dev/null +++ b/docs/CanonicalizeNamesOutputBody.md @@ -0,0 +1,13 @@ + + +# CanonicalizeNamesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**results** | [**List<CanonicalName>**](CanonicalName.md) | Canonicalized names in the same order as the input. | | + + + diff --git a/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index 98cbb69..dd24a5e 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -23,6 +23,7 @@ All URIs are relative to *https://api.reveng.ai* | [**getFunctionCapabilities_0**](FunctionsCoreApi.md#getFunctionCapabilities_0) | **GET** /v3/functions/{function_id}/capabilities | Get capabilities for a function | | [**getFunctionDetails**](FunctionsCoreApi.md#getFunctionDetails) | **GET** /v2/functions/{function_id} | Get function details | | [**getFunctionDetails_0**](FunctionsCoreApi.md#getFunctionDetails_0) | **GET** /v3/functions/{function_id} | Get function details | +| [**getFunctionIndirectCallSites**](FunctionsCoreApi.md#getFunctionIndirectCallSites) | **GET** /v3/functions/{function_id}/indirect-call-sites | Get indirect call sites for a function | | [**getFunctionStrings**](FunctionsCoreApi.md#getFunctionStrings) | **GET** /v2/functions/{function_id}/strings | Get string information found in the function | | [**getFunctionStrings_0**](FunctionsCoreApi.md#getFunctionStrings_0) | **GET** /v3/functions/{function_id}/strings | List strings for a function. | | [**getFunctionsCalleesCallers**](FunctionsCoreApi.md#getFunctionsCalleesCallers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions | @@ -32,6 +33,7 @@ All URIs are relative to *https://api.reveng.ai* | [**listAnalysisFunctions**](FunctionsCoreApi.md#listAnalysisFunctions) | **GET** /v3/analyses/{analysis_id}/functions | List functions in an analysis | | [**listImportedFunctions**](FunctionsCoreApi.md#listImportedFunctions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis | | [**startFunctionsMatching**](FunctionsCoreApi.md#startFunctionsMatching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions | +| [**v3CanonicalizeFunctionNames**](FunctionsCoreApi.md#v3CanonicalizeFunctionNames) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names | @@ -1475,6 +1477,83 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **getFunctionIndirectCallSites** +> IndirectCallSitesOutputBody getFunctionIndirectCallSites(functionId) + +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 +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.FunctionsCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + FunctionsCoreApi apiInstance = new FunctionsCoreApi(defaultClient); + Long functionId = 56L; // Long | Function ID + try { + IndirectCallSitesOutputBody result = apiInstance.getFunctionIndirectCallSites(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#getFunctionIndirectCallSites"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **Long**| 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 | - | + # **getFunctionStrings** > BaseResponseFunctionStringsResponse getFunctionStrings(functionId, page, pageSize, search) @@ -2195,3 +2274,80 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3CanonicalizeFunctionNames** +> CanonicalizeNamesOutputBody v3CanonicalizeFunctionNames(canonicalizeNamesInputBody) + +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 +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.FunctionsCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + FunctionsCoreApi apiInstance = new FunctionsCoreApi(defaultClient); + CanonicalizeNamesInputBody canonicalizeNamesInputBody = new CanonicalizeNamesInputBody(); // CanonicalizeNamesInputBody | + try { + CanonicalizeNamesOutputBody result = apiInstance.v3CanonicalizeFunctionNames(canonicalizeNamesInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#v3CanonicalizeFunctionNames"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **canonicalizeNamesInputBody** | [**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 | - | + diff --git a/docs/IndirectCallSite.md b/docs/IndirectCallSite.md new file mode 100644 index 0000000..026900a --- /dev/null +++ b/docs/IndirectCallSite.md @@ -0,0 +1,17 @@ + + +# IndirectCallSite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**calleeFunctionId** | **Long** | | [optional] | +|**instVaddr** | **Long** | Vaddr of the indirect call instruction. | | +|**isExternal** | **Boolean** | | | +|**targetName** | **String** | | [optional] | +|**targetVaddr** | **Long** | Resolved call target vaddr. | | + + + diff --git a/docs/IndirectCallSitesOutputBody.md b/docs/IndirectCallSitesOutputBody.md new file mode 100644 index 0000000..0b9c3c7 --- /dev/null +++ b/docs/IndirectCallSitesOutputBody.md @@ -0,0 +1,14 @@ + + +# IndirectCallSitesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functionId** | **Long** | | | +|**sites** | [**List<IndirectCallSite>**](IndirectCallSite.md) | | | + + + diff --git a/docs/ListAnalysesOutputBody.md b/docs/ListAnalysesOutputBody.md new file mode 100644 index 0000000..e63ca5a --- /dev/null +++ b/docs/ListAnalysesOutputBody.md @@ -0,0 +1,15 @@ + + +# ListAnalysesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nextPageToken** | **String** | Opaque cursor to fetch the next page; empty on the last page | [optional] | +|**pageSize** | **Long** | Number of results in this page | | +|**results** | [**List<AnalysisRecordBody>**](AnalysisRecordBody.md) | The page of matching analyses | | + + + diff --git a/pom.xml b/pom.xml index 80b313e..0cba5bc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.110.0 + 3.113.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index 6212660..b1ad703 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -34,6 +34,7 @@ import ai.reveng.model.AnalysisUpdateRequest; import ai.reveng.model.AnalysisUpdateTagsRequest; import ai.reveng.model.AppApiRestV2AnalysesEnumsOrderBy; +import ai.reveng.model.AutoUnstripStatusOutputBody; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseAnalysisCreateResponse; import ai.reveng.model.BaseResponseAnalysisDetailResponse; @@ -54,6 +55,7 @@ import ai.reveng.model.GetMatchesOutputBody; import ai.reveng.model.GetMatchesStatusOutputBody; import ai.reveng.model.InsertAnalysisLogRequest; +import ai.reveng.model.ListAnalysesOutputBody; import ai.reveng.model.ListAnalysisStringsOutputBody; import ai.reveng.model.ListExampleAnalysesOutputBody; import ai.reveng.model.ModelName; @@ -3482,6 +3484,149 @@ public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull UploadFileType upl localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAnalysisAutoUnstripStatus + * @param analysisId Analysis ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAnalysisAutoUnstripStatusCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/auto-unstrip/status" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetAnalysisAutoUnstripStatusValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3GetAnalysisAutoUnstripStatus(Async)"); + } + + return v3GetAnalysisAutoUnstripStatusCall(analysisId, _callback); + + } + + /** + * 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 analysisId Analysis ID (required) + * @return AutoUnstripStatusOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AutoUnstripStatusOutputBody v3GetAnalysisAutoUnstripStatus(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisAutoUnstripStatusWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * 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 analysisId Analysis ID (required) + * @return ApiResponse<AutoUnstripStatusOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3GetAnalysisAutoUnstripStatusWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisAutoUnstripStatusValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the auto-unstrip status for an analysis. (asynchronously) + * 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 analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAnalysisAutoUnstripStatusAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisAutoUnstripStatusValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3GetAnalysisStrings * @param analysisId Analysis ID (required) @@ -3816,6 +3961,215 @@ public okhttp3.Call v3GetAnalysisStringsStatusAsync(@javax.annotation.Nonnull Lo localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3ListAnalyses + * @param searchTerm (optional) + * @param analysisScope Leave empty for no filter (optional) + * @param status (optional) + * @param modelName (optional) + * @param usernames (optional) + * @param sha256Hash (optional) + * @param pageSize (optional, default to 20) + * @param nextPageToken Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). (optional) + * @param orderBy (optional, default to created) + * @param order (optional, default to DESC) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListAnalysesCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List analysisScope, @javax.annotation.Nullable List status, @javax.annotation.Nullable List modelName, @javax.annotation.Nullable List usernames, @javax.annotation.Nullable String sha256Hash, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable String nextPageToken, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/analyses"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (searchTerm != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search_term", searchTerm)); + } + + if (analysisScope != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "analysis_scope", analysisScope)); + } + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "status", status)); + } + + if (modelName != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "model_name", modelName)); + } + + if (usernames != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "usernames", usernames)); + } + + if (sha256Hash != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sha256_hash", sha256Hash)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize)); + } + + if (nextPageToken != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("next_page_token", nextPageToken)); + } + + if (orderBy != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order_by", orderBy)); + } + + if (order != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order", order)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3ListAnalysesValidateBeforeCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List analysisScope, @javax.annotation.Nullable List status, @javax.annotation.Nullable List modelName, @javax.annotation.Nullable List usernames, @javax.annotation.Nullable String sha256Hash, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable String nextPageToken, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + return v3ListAnalysesCall(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, order, _callback); + + } + + /** + * 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 searchTerm (optional) + * @param analysisScope Leave empty for no filter (optional) + * @param status (optional) + * @param modelName (optional) + * @param usernames (optional) + * @param sha256Hash (optional) + * @param pageSize (optional, default to 20) + * @param nextPageToken Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). (optional) + * @param orderBy (optional, default to created) + * @param order (optional, default to DESC) + * @return ListAnalysesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ListAnalysesOutputBody v3ListAnalyses(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List analysisScope, @javax.annotation.Nullable List status, @javax.annotation.Nullable List modelName, @javax.annotation.Nullable List usernames, @javax.annotation.Nullable String sha256Hash, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable String nextPageToken, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + ApiResponse localVarResp = v3ListAnalysesWithHttpInfo(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, order); + return localVarResp.getData(); + } + + /** + * 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 searchTerm (optional) + * @param analysisScope Leave empty for no filter (optional) + * @param status (optional) + * @param modelName (optional) + * @param usernames (optional) + * @param sha256Hash (optional) + * @param pageSize (optional, default to 20) + * @param nextPageToken Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). (optional) + * @param orderBy (optional, default to created) + * @param order (optional, default to DESC) + * @return ApiResponse<ListAnalysesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3ListAnalysesWithHttpInfo(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List analysisScope, @javax.annotation.Nullable List status, @javax.annotation.Nullable List modelName, @javax.annotation.Nullable List usernames, @javax.annotation.Nullable String sha256Hash, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable String nextPageToken, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + okhttp3.Call localVarCall = v3ListAnalysesValidateBeforeCall(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List analyses (asynchronously) + * 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 searchTerm (optional) + * @param analysisScope Leave empty for no filter (optional) + * @param status (optional) + * @param modelName (optional) + * @param usernames (optional) + * @param sha256Hash (optional) + * @param pageSize (optional, default to 20) + * @param nextPageToken Forward-pagination cursor from a prior response. When set, order_by/order are taken from the token (the sort cannot change mid-pagination). (optional) + * @param orderBy (optional, default to created) + * @param order (optional, default to DESC) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListAnalysesAsync(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List analysisScope, @javax.annotation.Nullable List status, @javax.annotation.Nullable List modelName, @javax.annotation.Nullable List usernames, @javax.annotation.Nullable String sha256Hash, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable String nextPageToken, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListAnalysesValidateBeforeCall(searchTerm, analysisScope, status, modelName, usernames, sha256Hash, pageSize, nextPageToken, orderBy, order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3ListExampleAnalyses * @param _callback Callback for upload/download progress diff --git a/src/main/java/ai/reveng/api/FunctionsCoreApi.java b/src/main/java/ai/reveng/api/FunctionsCoreApi.java index 08ec7f0..ab0be0a 100644 --- a/src/main/java/ai/reveng/api/FunctionsCoreApi.java +++ b/src/main/java/ai/reveng/api/FunctionsCoreApi.java @@ -43,6 +43,8 @@ import ai.reveng.model.BaseResponseFunctionsDetailResponse; import ai.reveng.model.BaseResponseListCalleesCallerFunctionsResponse; import ai.reveng.model.CallEdgesOutputBody; +import ai.reveng.model.CanonicalizeNamesInputBody; +import ai.reveng.model.CanonicalizeNamesOutputBody; import ai.reveng.model.CapabilitiesOutputBody; import ai.reveng.model.DisassemblyOutputBody; import ai.reveng.model.FunctionDetailsOutputBody; @@ -51,6 +53,7 @@ import ai.reveng.model.GetMatchesOutputBody; import ai.reveng.model.GetMatchesStatusOutputBody; import ai.reveng.model.ImportedFunctionDetailOutputBody; +import ai.reveng.model.IndirectCallSitesOutputBody; import ai.reveng.model.ListAnalysisFunctionsOutputBody; import ai.reveng.model.ListFunctionStringsOutputBody; import ai.reveng.model.ListImportedFunctionsOutputBody; @@ -2891,6 +2894,149 @@ public okhttp3.Call getFunctionDetails_0Async(@javax.annotation.Nonnull Long fun localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for getFunctionIndirectCallSites + * @param functionId Function ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call getFunctionIndirectCallSitesCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/indirect-call-sites" + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFunctionIndirectCallSitesValidateBeforeCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling getFunctionIndirectCallSites(Async)"); + } + + return getFunctionIndirectCallSitesCall(functionId, _callback); + + } + + /** + * 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 functionId Function ID (required) + * @return IndirectCallSitesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public IndirectCallSitesOutputBody getFunctionIndirectCallSites(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = getFunctionIndirectCallSitesWithHttpInfo(functionId); + return localVarResp.getData(); + } + + /** + * 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 functionId Function ID (required) + * @return ApiResponse<IndirectCallSitesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse getFunctionIndirectCallSitesWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = getFunctionIndirectCallSitesValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get indirect call sites for a function (asynchronously) + * 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 functionId Function ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call getFunctionIndirectCallSitesAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFunctionIndirectCallSitesValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for getFunctionStrings * @param functionId (required) @@ -4296,4 +4442,147 @@ public okhttp3.Call startFunctionsMatchingAsync(@javax.annotation.Nonnull StartM localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3CanonicalizeFunctionNames + * @param canonicalizeNamesInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call v3CanonicalizeFunctionNamesCall(@javax.annotation.Nonnull CanonicalizeNamesInputBody canonicalizeNamesInputBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = canonicalizeNamesInputBody; + + // create path and map variables + String localVarPath = "/v3/functions/canonical-names"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3CanonicalizeFunctionNamesValidateBeforeCall(@javax.annotation.Nonnull CanonicalizeNamesInputBody canonicalizeNamesInputBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'canonicalizeNamesInputBody' is set + if (canonicalizeNamesInputBody == null) { + throw new ApiException("Missing the required parameter 'canonicalizeNamesInputBody' when calling v3CanonicalizeFunctionNames(Async)"); + } + + return v3CanonicalizeFunctionNamesCall(canonicalizeNamesInputBody, _callback); + + } + + /** + * 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 canonicalizeNamesInputBody (required) + * @return CanonicalizeNamesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public CanonicalizeNamesOutputBody v3CanonicalizeFunctionNames(@javax.annotation.Nonnull CanonicalizeNamesInputBody canonicalizeNamesInputBody) throws ApiException { + ApiResponse localVarResp = v3CanonicalizeFunctionNamesWithHttpInfo(canonicalizeNamesInputBody); + return localVarResp.getData(); + } + + /** + * 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 canonicalizeNamesInputBody (required) + * @return ApiResponse<CanonicalizeNamesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse v3CanonicalizeFunctionNamesWithHttpInfo(@javax.annotation.Nonnull CanonicalizeNamesInputBody canonicalizeNamesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3CanonicalizeFunctionNamesValidateBeforeCall(canonicalizeNamesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Canonicalize a batch of function names (asynchronously) + * 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 canonicalizeNamesInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
422 Unprocessable Entity -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call v3CanonicalizeFunctionNamesAsync(@javax.annotation.Nonnull CanonicalizeNamesInputBody canonicalizeNamesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3CanonicalizeFunctionNamesValidateBeforeCall(canonicalizeNamesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index a652a42..544fa26 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.110.0/java"); + setUserAgent("OpenAPI-Generator/3.113.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 8e375f7..c10cfcf 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.110.0"; + public static final String VERSION = "3.113.0"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 193d507..1a79d33 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -128,12 +128,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisLogMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisLogs.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecordBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisReport.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTagBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTags.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsRequest.CustomTypeAdapterFactory()); @@ -151,6 +153,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoRunAgents.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripStatusOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAdditionalDetailsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisBulkAddTagsResponse.CustomTypeAdapterFactory()); @@ -243,6 +246,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CalleeFunctionInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CalleesCallerFunctionsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CallerFunctionInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CanonicalName.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CanonicalizeNamesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CanonicalizeNamesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Capabilities.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CapabilitiesAgentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CapabilitiesOutputBody.CustomTypeAdapterFactory()); @@ -402,10 +408,13 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportedFunctionCallerEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportedFunctionDetailOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportedFunctionEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IndirectCallSite.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IndirectCallSitesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InlineComment.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InviteUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IssuerAllowedDomain.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisStringsOutputBody.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisRecordBody.java b/src/main/java/ai/reveng/model/AnalysisRecordBody.java new file mode 100644 index 0000000..3c62e13 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisRecordBody.java @@ -0,0 +1,751 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.AnalysisTagBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisRecordBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisRecordBody { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + /** + * Scope of the analysis + */ + @JsonAdapter(AnalysisScopeEnum.Adapter.class) + public enum AnalysisScopeEnum { + PUBLIC("PUBLIC"), + + PRIVATE("PRIVATE"), + + TEAM("TEAM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + AnalysisScopeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnalysisScopeEnum fromValue(String value) { + for (AnalysisScopeEnum b : AnalysisScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AnalysisScopeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnalysisScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnalysisScopeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AnalysisScopeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ANALYSIS_SCOPE = "analysis_scope"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_SCOPE) + @javax.annotation.Nonnull + private AnalysisScopeEnum analysisScope; + + public static final String SERIALIZED_NAME_BASE_ADDRESS = "base_address"; + @SerializedName(SERIALIZED_NAME_BASE_ADDRESS) + @javax.annotation.Nonnull + private Long baseAddress; + + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Long binaryId; + + public static final String SERIALIZED_NAME_BINARY_NAME = "binary_name"; + @SerializedName(SERIALIZED_NAME_BINARY_NAME) + @javax.annotation.Nonnull + private String binaryName; + + public static final String SERIALIZED_NAME_BINARY_SIZE = "binary_size"; + @SerializedName(SERIALIZED_NAME_BINARY_SIZE) + @javax.annotation.Nonnull + private Long binarySize; + + public static final String SERIALIZED_NAME_CREATION = "creation"; + @SerializedName(SERIALIZED_NAME_CREATION) + @javax.annotation.Nonnull + private OffsetDateTime creation; + + public static final String SERIALIZED_NAME_FUNCTION_BOUNDARIES_HASH = "function_boundaries_hash"; + @SerializedName(SERIALIZED_NAME_FUNCTION_BOUNDARIES_HASH) + @javax.annotation.Nonnull + private String functionBoundariesHash; + + public static final String SERIALIZED_NAME_IS_OWNER = "is_owner"; + @SerializedName(SERIALIZED_NAME_IS_OWNER) + @javax.annotation.Nonnull + private Boolean isOwner; + + public static final String SERIALIZED_NAME_MODEL_ID = "model_id"; + @SerializedName(SERIALIZED_NAME_MODEL_ID) + @javax.annotation.Nonnull + private Long modelId; + + public static final String SERIALIZED_NAME_MODEL_NAME = "model_name"; + @SerializedName(SERIALIZED_NAME_MODEL_NAME) + @javax.annotation.Nonnull + private String modelName; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public AnalysisRecordBody() { + } + + public AnalysisRecordBody analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Analysis ID + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public AnalysisRecordBody analysisScope(@javax.annotation.Nonnull AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + return this; + } + + /** + * Scope of the analysis + * @return analysisScope + */ + @javax.annotation.Nonnull + public AnalysisScopeEnum getAnalysisScope() { + return analysisScope; + } + + public void setAnalysisScope(@javax.annotation.Nonnull AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + } + + + public AnalysisRecordBody baseAddress(@javax.annotation.Nonnull Long baseAddress) { + this.baseAddress = baseAddress; + return this; + } + + /** + * Binary base address + * @return baseAddress + */ + @javax.annotation.Nonnull + public Long getBaseAddress() { + return baseAddress; + } + + public void setBaseAddress(@javax.annotation.Nonnull Long baseAddress) { + this.baseAddress = baseAddress; + } + + + public AnalysisRecordBody binaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * Binary ID + * @return binaryId + */ + @javax.annotation.Nonnull + public Long getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + } + + + public AnalysisRecordBody binaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + return this; + } + + /** + * Binary filename + * @return binaryName + */ + @javax.annotation.Nonnull + public String getBinaryName() { + return binaryName; + } + + public void setBinaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + } + + + public AnalysisRecordBody binarySize(@javax.annotation.Nonnull Long binarySize) { + this.binarySize = binarySize; + return this; + } + + /** + * Binary size in bytes + * @return binarySize + */ + @javax.annotation.Nonnull + public Long getBinarySize() { + return binarySize; + } + + public void setBinarySize(@javax.annotation.Nonnull Long binarySize) { + this.binarySize = binarySize; + } + + + public AnalysisRecordBody creation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + return this; + } + + /** + * When the analysis was created + * @return creation + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreation() { + return creation; + } + + public void setCreation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + } + + + public AnalysisRecordBody functionBoundariesHash(@javax.annotation.Nonnull String functionBoundariesHash) { + this.functionBoundariesHash = functionBoundariesHash; + return this; + } + + /** + * Hash of the binary's provided function boundaries + * @return functionBoundariesHash + */ + @javax.annotation.Nonnull + public String getFunctionBoundariesHash() { + return functionBoundariesHash; + } + + public void setFunctionBoundariesHash(@javax.annotation.Nonnull String functionBoundariesHash) { + this.functionBoundariesHash = functionBoundariesHash; + } + + + public AnalysisRecordBody isOwner(@javax.annotation.Nonnull Boolean isOwner) { + this.isOwner = isOwner; + return this; + } + + /** + * True when the caller owns the analysis + * @return isOwner + */ + @javax.annotation.Nonnull + public Boolean getIsOwner() { + return isOwner; + } + + public void setIsOwner(@javax.annotation.Nonnull Boolean isOwner) { + this.isOwner = isOwner; + } + + + public AnalysisRecordBody modelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + return this; + } + + /** + * Model ID + * @return modelId + */ + @javax.annotation.Nonnull + public Long getModelId() { + return modelId; + } + + public void setModelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + } + + + public AnalysisRecordBody modelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Model name + * @return modelName + */ + @javax.annotation.Nonnull + public String getModelName() { + return modelName; + } + + public void setModelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + } + + + public AnalysisRecordBody sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * SHA-256 hash of the binary + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public AnalysisRecordBody status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Analysis status + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public AnalysisRecordBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public AnalysisRecordBody addTagsItem(AnalysisTagBody tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags associated with the binary + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public AnalysisRecordBody username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * Username of the analysis owner + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AnalysisRecordBody instance itself + */ + public AnalysisRecordBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisRecordBody analysisRecordBody = (AnalysisRecordBody) o; + return Objects.equals(this.analysisId, analysisRecordBody.analysisId) && + Objects.equals(this.analysisScope, analysisRecordBody.analysisScope) && + Objects.equals(this.baseAddress, analysisRecordBody.baseAddress) && + Objects.equals(this.binaryId, analysisRecordBody.binaryId) && + Objects.equals(this.binaryName, analysisRecordBody.binaryName) && + Objects.equals(this.binarySize, analysisRecordBody.binarySize) && + Objects.equals(this.creation, analysisRecordBody.creation) && + Objects.equals(this.functionBoundariesHash, analysisRecordBody.functionBoundariesHash) && + Objects.equals(this.isOwner, analysisRecordBody.isOwner) && + Objects.equals(this.modelId, analysisRecordBody.modelId) && + Objects.equals(this.modelName, analysisRecordBody.modelName) && + Objects.equals(this.sha256Hash, analysisRecordBody.sha256Hash) && + Objects.equals(this.status, analysisRecordBody.status) && + Objects.equals(this.tags, analysisRecordBody.tags) && + Objects.equals(this.username, analysisRecordBody.username)&& + Objects.equals(this.additionalProperties, analysisRecordBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, analysisScope, baseAddress, binaryId, binaryName, binarySize, creation, functionBoundariesHash, isOwner, modelId, modelName, sha256Hash, status, tags, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisRecordBody {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" analysisScope: ").append(toIndentedString(analysisScope)).append("\n"); + sb.append(" baseAddress: ").append(toIndentedString(baseAddress)).append("\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); + sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); + sb.append(" binarySize: ").append(toIndentedString(binarySize)).append("\n"); + sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); + sb.append(" functionBoundariesHash: ").append(toIndentedString(functionBoundariesHash)).append("\n"); + sb.append(" isOwner: ").append(toIndentedString(isOwner)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnalysisRecordBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisRecordBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnalysisRecordBody is not found in the empty JSON string", AnalysisRecordBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisRecordBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("analysis_scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `analysis_scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("analysis_scope").toString())); + } + // validate the required field `analysis_scope` + AnalysisScopeEnum.validateJsonElement(jsonObj.get("analysis_scope")); + if (!jsonObj.get("binary_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_name").toString())); + } + if (!jsonObj.get("function_boundaries_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_boundaries_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_boundaries_hash").toString())); + } + if (!jsonObj.get("model_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `model_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model_name").toString())); + } + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + AnalysisTagBody.validateJsonElement(jsonArraytags.get(i)); + } + } + if (!jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisRecordBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisRecordBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisRecordBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisRecordBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AnalysisRecordBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisRecordBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisRecordBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisRecordBody + * @throws IOException if the JSON string is invalid with respect to AnalysisRecordBody + */ + public static AnalysisRecordBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisRecordBody.class); + } + + /** + * Convert an instance of AnalysisRecordBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisTagBody.java b/src/main/java/ai/reveng/model/AnalysisTagBody.java new file mode 100644 index 0000000..77a2efc --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisTagBody.java @@ -0,0 +1,263 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisTagBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisTagBody { + public static final String SERIALIZED_NAME_COLLECTION_ID = "collection_id"; + @SerializedName(SERIALIZED_NAME_COLLECTION_ID) + @javax.annotation.Nullable + private Long collectionId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ORIGIN = "origin"; + @SerializedName(SERIALIZED_NAME_ORIGIN) + @javax.annotation.Nonnull + private String origin; + + public AnalysisTagBody() { + } + + public AnalysisTagBody collectionId(@javax.annotation.Nullable Long collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Collection this tag maps to, or null + * @return collectionId + */ + @javax.annotation.Nullable + public Long getCollectionId() { + return collectionId; + } + + public void setCollectionId(@javax.annotation.Nullable Long collectionId) { + this.collectionId = collectionId; + } + + + public AnalysisTagBody name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Tag name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AnalysisTagBody origin(@javax.annotation.Nonnull String origin) { + this.origin = origin; + return this; + } + + /** + * Origin of the tag + * @return origin + */ + @javax.annotation.Nonnull + public String getOrigin() { + return origin; + } + + public void setOrigin(@javax.annotation.Nonnull String origin) { + this.origin = origin; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisTagBody analysisTagBody = (AnalysisTagBody) o; + return Objects.equals(this.collectionId, analysisTagBody.collectionId) && + Objects.equals(this.name, analysisTagBody.name) && + Objects.equals(this.origin, analysisTagBody.origin); + } + + @Override + public int hashCode() { + return Objects.hash(collectionId, name, origin); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisTagBody {\n"); + sb.append(" collectionId: ").append(toIndentedString(collectionId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" origin: ").append(toIndentedString(origin)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("collection_id", "name", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("collection_id", "name", "origin")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnalysisTagBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisTagBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnalysisTagBody is not found in the empty JSON string", AnalysisTagBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AnalysisTagBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AnalysisTagBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisTagBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("origin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `origin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("origin").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisTagBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisTagBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisTagBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisTagBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AnalysisTagBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisTagBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisTagBody + * @throws IOException if the JSON string is invalid with respect to AnalysisTagBody + */ + public static AnalysisTagBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisTagBody.class); + } + + /** + * Convert an instance of AnalysisTagBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AutoUnstripStatusOutputBody.java b/src/main/java/ai/reveng/model/AutoUnstripStatusOutputBody.java new file mode 100644 index 0000000..f895a9c --- /dev/null +++ b/src/main/java/ai/reveng/model/AutoUnstripStatusOutputBody.java @@ -0,0 +1,270 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AutoUnstripStatusOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AutoUnstripStatusOutputBody { + /** + * Auto-unstrip task status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public AutoUnstripStatusOutputBody() { + } + + public AutoUnstripStatusOutputBody status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Auto-unstrip task status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutoUnstripStatusOutputBody autoUnstripStatusOutputBody = (AutoUnstripStatusOutputBody) o; + return Objects.equals(this.status, autoUnstripStatusOutputBody.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutoUnstripStatusOutputBody {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutoUnstripStatusOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutoUnstripStatusOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AutoUnstripStatusOutputBody is not found in the empty JSON string", AutoUnstripStatusOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutoUnstripStatusOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AutoUnstripStatusOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutoUnstripStatusOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutoUnstripStatusOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutoUnstripStatusOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutoUnstripStatusOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutoUnstripStatusOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutoUnstripStatusOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutoUnstripStatusOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutoUnstripStatusOutputBody + * @throws IOException if the JSON string is invalid with respect to AutoUnstripStatusOutputBody + */ + public static AutoUnstripStatusOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutoUnstripStatusOutputBody.class); + } + + /** + * Convert an instance of AutoUnstripStatusOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CanonicalName.java b/src/main/java/ai/reveng/model/CanonicalName.java new file mode 100644 index 0000000..3209963 --- /dev/null +++ b/src/main/java/ai/reveng/model/CanonicalName.java @@ -0,0 +1,237 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CanonicalName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CanonicalName { + public static final String SERIALIZED_NAME_CANONICAL_NAME = "canonical_name"; + @SerializedName(SERIALIZED_NAME_CANONICAL_NAME) + @javax.annotation.Nonnull + private String canonicalName; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public CanonicalName() { + } + + public CanonicalName canonicalName(@javax.annotation.Nonnull String canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + /** + * Canonical form of the name, or the input name itself when it has no canonical form. + * @return canonicalName + */ + @javax.annotation.Nonnull + public String getCanonicalName() { + return canonicalName; + } + + public void setCanonicalName(@javax.annotation.Nonnull String canonicalName) { + this.canonicalName = canonicalName; + } + + + public CanonicalName name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The input function name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CanonicalName canonicalName = (CanonicalName) o; + return Objects.equals(this.canonicalName, canonicalName.canonicalName) && + Objects.equals(this.name, canonicalName.name); + } + + @Override + public int hashCode() { + return Objects.hash(canonicalName, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CanonicalName {\n"); + sb.append(" canonicalName: ").append(toIndentedString(canonicalName)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("canonical_name", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("canonical_name", "name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CanonicalName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CanonicalName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CanonicalName is not found in the empty JSON string", CanonicalName.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CanonicalName.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CanonicalName` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CanonicalName.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("canonical_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `canonical_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("canonical_name").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CanonicalName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CanonicalName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CanonicalName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CanonicalName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CanonicalName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CanonicalName given an JSON string + * + * @param jsonString JSON string + * @return An instance of CanonicalName + * @throws IOException if the JSON string is invalid with respect to CanonicalName + */ + public static CanonicalName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CanonicalName.class); + } + + /** + * Convert an instance of CanonicalName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CanonicalizeNamesInputBody.java b/src/main/java/ai/reveng/model/CanonicalizeNamesInputBody.java new file mode 100644 index 0000000..45048d6 --- /dev/null +++ b/src/main/java/ai/reveng/model/CanonicalizeNamesInputBody.java @@ -0,0 +1,221 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CanonicalizeNamesInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CanonicalizeNamesInputBody { + public static final String SERIALIZED_NAME_NAMES = "names"; + @SerializedName(SERIALIZED_NAME_NAMES) + @javax.annotation.Nullable + private List names; + + public CanonicalizeNamesInputBody() { + } + + public CanonicalizeNamesInputBody names(@javax.annotation.Nullable List names) { + this.names = names; + return this; + } + + public CanonicalizeNamesInputBody addNamesItem(String namesItem) { + if (this.names == null) { + this.names = new ArrayList<>(); + } + this.names.add(namesItem); + return this; + } + + /** + * Function names to canonicalize. + * @return names + */ + @javax.annotation.Nullable + public List getNames() { + return names; + } + + public void setNames(@javax.annotation.Nullable List names) { + this.names = names; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CanonicalizeNamesInputBody canonicalizeNamesInputBody = (CanonicalizeNamesInputBody) o; + return Objects.equals(this.names, canonicalizeNamesInputBody.names); + } + + @Override + public int hashCode() { + return Objects.hash(names); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CanonicalizeNamesInputBody {\n"); + sb.append(" names: ").append(toIndentedString(names)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("names")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("names")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CanonicalizeNamesInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CanonicalizeNamesInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CanonicalizeNamesInputBody is not found in the empty JSON string", CanonicalizeNamesInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CanonicalizeNamesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CanonicalizeNamesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CanonicalizeNamesInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("names") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("names").isJsonArray() && !jsonObj.get("names").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `names` to be an array in the JSON string but got `%s`", jsonObj.get("names").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CanonicalizeNamesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CanonicalizeNamesInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CanonicalizeNamesInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CanonicalizeNamesInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CanonicalizeNamesInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CanonicalizeNamesInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of CanonicalizeNamesInputBody + * @throws IOException if the JSON string is invalid with respect to CanonicalizeNamesInputBody + */ + public static CanonicalizeNamesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CanonicalizeNamesInputBody.class); + } + + /** + * Convert an instance of CanonicalizeNamesInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CanonicalizeNamesOutputBody.java b/src/main/java/ai/reveng/model/CanonicalizeNamesOutputBody.java new file mode 100644 index 0000000..0be4331 --- /dev/null +++ b/src/main/java/ai/reveng/model/CanonicalizeNamesOutputBody.java @@ -0,0 +1,226 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.CanonicalName; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CanonicalizeNamesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CanonicalizeNamesOutputBody { + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public CanonicalizeNamesOutputBody() { + } + + public CanonicalizeNamesOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public CanonicalizeNamesOutputBody addResultsItem(CanonicalName resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Canonicalized names in the same order as the input. + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CanonicalizeNamesOutputBody canonicalizeNamesOutputBody = (CanonicalizeNamesOutputBody) o; + return Objects.equals(this.results, canonicalizeNamesOutputBody.results); + } + + @Override + public int hashCode() { + return Objects.hash(results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CanonicalizeNamesOutputBody {\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("results")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CanonicalizeNamesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CanonicalizeNamesOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CanonicalizeNamesOutputBody is not found in the empty JSON string", CanonicalizeNamesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CanonicalizeNamesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CanonicalizeNamesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CanonicalizeNamesOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull()) { + if (!jsonObj.get("results").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); + // validate the required field `results` (array) + for (int i = 0; i < jsonArrayresults.size(); i++) { + CanonicalName.validateJsonElement(jsonArrayresults.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CanonicalizeNamesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CanonicalizeNamesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CanonicalizeNamesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CanonicalizeNamesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CanonicalizeNamesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CanonicalizeNamesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of CanonicalizeNamesOutputBody + * @throws IOException if the JSON string is invalid with respect to CanonicalizeNamesOutputBody + */ + public static CanonicalizeNamesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CanonicalizeNamesOutputBody.class); + } + + /** + * Convert an instance of CanonicalizeNamesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/IndirectCallSite.java b/src/main/java/ai/reveng/model/IndirectCallSite.java new file mode 100644 index 0000000..29ecca1 --- /dev/null +++ b/src/main/java/ai/reveng/model/IndirectCallSite.java @@ -0,0 +1,312 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * IndirectCallSite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndirectCallSite { + public static final String SERIALIZED_NAME_CALLEE_FUNCTION_ID = "callee_function_id"; + @SerializedName(SERIALIZED_NAME_CALLEE_FUNCTION_ID) + @javax.annotation.Nullable + private Long calleeFunctionId; + + public static final String SERIALIZED_NAME_INST_VADDR = "inst_vaddr"; + @SerializedName(SERIALIZED_NAME_INST_VADDR) + @javax.annotation.Nonnull + private Long instVaddr; + + public static final String SERIALIZED_NAME_IS_EXTERNAL = "is_external"; + @SerializedName(SERIALIZED_NAME_IS_EXTERNAL) + @javax.annotation.Nonnull + private Boolean isExternal; + + public static final String SERIALIZED_NAME_TARGET_NAME = "target_name"; + @SerializedName(SERIALIZED_NAME_TARGET_NAME) + @javax.annotation.Nullable + private String targetName; + + public static final String SERIALIZED_NAME_TARGET_VADDR = "target_vaddr"; + @SerializedName(SERIALIZED_NAME_TARGET_VADDR) + @javax.annotation.Nonnull + private Long targetVaddr; + + public IndirectCallSite() { + } + + public IndirectCallSite calleeFunctionId(@javax.annotation.Nullable Long calleeFunctionId) { + this.calleeFunctionId = calleeFunctionId; + return this; + } + + /** + * Get calleeFunctionId + * @return calleeFunctionId + */ + @javax.annotation.Nullable + public Long getCalleeFunctionId() { + return calleeFunctionId; + } + + public void setCalleeFunctionId(@javax.annotation.Nullable Long calleeFunctionId) { + this.calleeFunctionId = calleeFunctionId; + } + + + public IndirectCallSite instVaddr(@javax.annotation.Nonnull Long instVaddr) { + this.instVaddr = instVaddr; + return this; + } + + /** + * Vaddr of the indirect call instruction. + * @return instVaddr + */ + @javax.annotation.Nonnull + public Long getInstVaddr() { + return instVaddr; + } + + public void setInstVaddr(@javax.annotation.Nonnull Long instVaddr) { + this.instVaddr = instVaddr; + } + + + public IndirectCallSite isExternal(@javax.annotation.Nonnull Boolean isExternal) { + this.isExternal = isExternal; + return this; + } + + /** + * Get isExternal + * @return isExternal + */ + @javax.annotation.Nonnull + public Boolean getIsExternal() { + return isExternal; + } + + public void setIsExternal(@javax.annotation.Nonnull Boolean isExternal) { + this.isExternal = isExternal; + } + + + public IndirectCallSite targetName(@javax.annotation.Nullable String targetName) { + this.targetName = targetName; + return this; + } + + /** + * Get targetName + * @return targetName + */ + @javax.annotation.Nullable + public String getTargetName() { + return targetName; + } + + public void setTargetName(@javax.annotation.Nullable String targetName) { + this.targetName = targetName; + } + + + public IndirectCallSite targetVaddr(@javax.annotation.Nonnull Long targetVaddr) { + this.targetVaddr = targetVaddr; + return this; + } + + /** + * Resolved call target vaddr. + * @return targetVaddr + */ + @javax.annotation.Nonnull + public Long getTargetVaddr() { + return targetVaddr; + } + + public void setTargetVaddr(@javax.annotation.Nonnull Long targetVaddr) { + this.targetVaddr = targetVaddr; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndirectCallSite indirectCallSite = (IndirectCallSite) o; + return Objects.equals(this.calleeFunctionId, indirectCallSite.calleeFunctionId) && + Objects.equals(this.instVaddr, indirectCallSite.instVaddr) && + Objects.equals(this.isExternal, indirectCallSite.isExternal) && + Objects.equals(this.targetName, indirectCallSite.targetName) && + Objects.equals(this.targetVaddr, indirectCallSite.targetVaddr); + } + + @Override + public int hashCode() { + return Objects.hash(calleeFunctionId, instVaddr, isExternal, targetName, targetVaddr); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndirectCallSite {\n"); + sb.append(" calleeFunctionId: ").append(toIndentedString(calleeFunctionId)).append("\n"); + sb.append(" instVaddr: ").append(toIndentedString(instVaddr)).append("\n"); + sb.append(" isExternal: ").append(toIndentedString(isExternal)).append("\n"); + sb.append(" targetName: ").append(toIndentedString(targetName)).append("\n"); + sb.append(" targetVaddr: ").append(toIndentedString(targetVaddr)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("callee_function_id", "inst_vaddr", "is_external", "target_name", "target_vaddr")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("inst_vaddr", "is_external", "target_vaddr")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndirectCallSite + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndirectCallSite.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in IndirectCallSite is not found in the empty JSON string", IndirectCallSite.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndirectCallSite.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `IndirectCallSite` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndirectCallSite.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("target_name") != null && !jsonObj.get("target_name").isJsonNull()) && !jsonObj.get("target_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `target_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndirectCallSite.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndirectCallSite' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndirectCallSite.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndirectCallSite value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndirectCallSite read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndirectCallSite given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndirectCallSite + * @throws IOException if the JSON string is invalid with respect to IndirectCallSite + */ + public static IndirectCallSite fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndirectCallSite.class); + } + + /** + * Convert an instance of IndirectCallSite to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/IndirectCallSitesOutputBody.java b/src/main/java/ai/reveng/model/IndirectCallSitesOutputBody.java new file mode 100644 index 0000000..eadd9c6 --- /dev/null +++ b/src/main/java/ai/reveng/model/IndirectCallSitesOutputBody.java @@ -0,0 +1,252 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.IndirectCallSite; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * IndirectCallSitesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndirectCallSitesOutputBody { + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Long functionId; + + public static final String SERIALIZED_NAME_SITES = "sites"; + @SerializedName(SERIALIZED_NAME_SITES) + @javax.annotation.Nullable + private List sites; + + public IndirectCallSitesOutputBody() { + } + + public IndirectCallSitesOutputBody functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nonnull + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + } + + + public IndirectCallSitesOutputBody sites(@javax.annotation.Nullable List sites) { + this.sites = sites; + return this; + } + + public IndirectCallSitesOutputBody addSitesItem(IndirectCallSite sitesItem) { + if (this.sites == null) { + this.sites = new ArrayList<>(); + } + this.sites.add(sitesItem); + return this; + } + + /** + * Get sites + * @return sites + */ + @javax.annotation.Nullable + public List getSites() { + return sites; + } + + public void setSites(@javax.annotation.Nullable List sites) { + this.sites = sites; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndirectCallSitesOutputBody indirectCallSitesOutputBody = (IndirectCallSitesOutputBody) o; + return Objects.equals(this.functionId, indirectCallSitesOutputBody.functionId) && + Objects.equals(this.sites, indirectCallSitesOutputBody.sites); + } + + @Override + public int hashCode() { + return Objects.hash(functionId, sites); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndirectCallSitesOutputBody {\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" sites: ").append(toIndentedString(sites)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("function_id", "sites")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_id", "sites")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndirectCallSitesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndirectCallSitesOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in IndirectCallSitesOutputBody is not found in the empty JSON string", IndirectCallSitesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndirectCallSitesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `IndirectCallSitesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndirectCallSitesOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("sites") != null && !jsonObj.get("sites").isJsonNull()) { + if (!jsonObj.get("sites").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sites` to be an array in the JSON string but got `%s`", jsonObj.get("sites").toString())); + } + JsonArray jsonArraysites = jsonObj.getAsJsonArray("sites"); + // validate the required field `sites` (array) + for (int i = 0; i < jsonArraysites.size(); i++) { + IndirectCallSite.validateJsonElement(jsonArraysites.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndirectCallSitesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndirectCallSitesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndirectCallSitesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndirectCallSitesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndirectCallSitesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndirectCallSitesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndirectCallSitesOutputBody + * @throws IOException if the JSON string is invalid with respect to IndirectCallSitesOutputBody + */ + public static IndirectCallSitesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndirectCallSitesOutputBody.class); + } + + /** + * Convert an instance of IndirectCallSitesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListAnalysesOutputBody.java b/src/main/java/ai/reveng/model/ListAnalysesOutputBody.java new file mode 100644 index 0000000..7f1a835 --- /dev/null +++ b/src/main/java/ai/reveng/model/ListAnalysesOutputBody.java @@ -0,0 +1,281 @@ +/* + * 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. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.AnalysisRecordBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ListAnalysesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListAnalysesOutputBody { + public static final String SERIALIZED_NAME_NEXT_PAGE_TOKEN = "next_page_token"; + @SerializedName(SERIALIZED_NAME_NEXT_PAGE_TOKEN) + @javax.annotation.Nullable + private String nextPageToken; + + public static final String SERIALIZED_NAME_PAGE_SIZE = "page_size"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nonnull + private Long pageSize; + + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public ListAnalysesOutputBody() { + } + + public ListAnalysesOutputBody nextPageToken(@javax.annotation.Nullable String nextPageToken) { + this.nextPageToken = nextPageToken; + return this; + } + + /** + * Opaque cursor to fetch the next page; empty on the last page + * @return nextPageToken + */ + @javax.annotation.Nullable + public String getNextPageToken() { + return nextPageToken; + } + + public void setNextPageToken(@javax.annotation.Nullable String nextPageToken) { + this.nextPageToken = nextPageToken; + } + + + public ListAnalysesOutputBody pageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Number of results in this page + * @return pageSize + */ + @javax.annotation.Nonnull + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + } + + + public ListAnalysesOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public ListAnalysesOutputBody addResultsItem(AnalysisRecordBody resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * The page of matching analyses + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAnalysesOutputBody listAnalysesOutputBody = (ListAnalysesOutputBody) o; + return Objects.equals(this.nextPageToken, listAnalysesOutputBody.nextPageToken) && + Objects.equals(this.pageSize, listAnalysesOutputBody.pageSize) && + Objects.equals(this.results, listAnalysesOutputBody.results); + } + + @Override + public int hashCode() { + return Objects.hash(nextPageToken, pageSize, results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListAnalysesOutputBody {\n"); + sb.append(" nextPageToken: ").append(toIndentedString(nextPageToken)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("next_page_token", "page_size", "results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("page_size", "results")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListAnalysesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListAnalysesOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ListAnalysesOutputBody is not found in the empty JSON string", ListAnalysesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListAnalysesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListAnalysesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListAnalysesOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("next_page_token") != null && !jsonObj.get("next_page_token").isJsonNull()) && !jsonObj.get("next_page_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `next_page_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next_page_token").toString())); + } + if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull()) { + if (!jsonObj.get("results").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); + // validate the required field `results` (array) + for (int i = 0; i < jsonArrayresults.size(); i++) { + AnalysisRecordBody.validateJsonElement(jsonArrayresults.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListAnalysesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListAnalysesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListAnalysesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListAnalysesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListAnalysesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListAnalysesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListAnalysesOutputBody + * @throws IOException if the JSON string is invalid with respect to ListAnalysesOutputBody + */ + public static ListAnalysesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListAnalysesOutputBody.class); + } + + /** + * Convert an instance of ListAnalysesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +