diff --git a/.sdk-version b/.sdk-version index 74fbdf9..498b115 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.107.0 +v3.110.0 diff --git a/README.md b/README.md index 178b9c0..122ed9c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.107.0 + 3.110.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.107.0" + implementation "ai.reveng:sdk:3.110.0" } ``` @@ -204,7 +204,9 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**getFunctionsCalleesCallers**](docs/FunctionsCoreApi.md#getFunctionsCalleesCallers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions *FunctionsCoreApi* | [**getFunctionsMatches**](docs/FunctionsCoreApi.md#getFunctionsMatches) | **GET** /v3/functions/matches | Get function-matching results for an explicit set of functions *FunctionsCoreApi* | [**getFunctionsMatchingStatus**](docs/FunctionsCoreApi.md#getFunctionsMatchingStatus) | **GET** /v3/functions/matches/status | Get function-matching status for an explicit set of functions +*FunctionsCoreApi* | [**getImportedFunction**](docs/FunctionsCoreApi.md#getImportedFunction) | **GET** /v3/analyses/{analysis_id}/imported-functions/{imported_function_id} | Get an imported function with its callers *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 *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 @@ -286,6 +288,7 @@ Class | Method | HTTP request | Description - [AppApiRestV2FunctionsResponsesFunction](docs/AppApiRestV2FunctionsResponsesFunction.md) - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) - [AppApiRestV2InfoTypesCapability](docs/AppApiRestV2InfoTypesCapability.md) + - [ArchiveContentEntry](docs/ArchiveContentEntry.md) - [Argument](docs/Argument.md) - [Artifact](docs/Artifact.md) - [AttemptFailedEvent](docs/AttemptFailedEvent.md) @@ -549,6 +552,9 @@ Class | Method | HTTP request | Description - [ISA](docs/ISA.md) - [IconModel](docs/IconModel.md) - [ImportModel](docs/ImportModel.md) + - [ImportedFunctionCallerEntry](docs/ImportedFunctionCallerEntry.md) + - [ImportedFunctionDetailOutputBody](docs/ImportedFunctionDetailOutputBody.md) + - [ImportedFunctionEntry](docs/ImportedFunctionEntry.md) - [InlineComment](docs/InlineComment.md) - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InviteUserInputBody](docs/InviteUserInputBody.md) @@ -556,11 +562,13 @@ Class | Method | HTTP request | Description - [ListAnalysisFunctionsDataTypesOutputBody](docs/ListAnalysisFunctionsDataTypesOutputBody.md) - [ListAnalysisFunctionsOutputBody](docs/ListAnalysisFunctionsOutputBody.md) - [ListAnalysisStringsOutputBody](docs/ListAnalysisStringsOutputBody.md) + - [ListArchiveContentsOutputBody](docs/ListArchiveContentsOutputBody.md) - [ListCollectionResults](docs/ListCollectionResults.md) - [ListCollectionsOutputBody](docs/ListCollectionsOutputBody.md) - [ListExampleAnalysesOutputBody](docs/ListExampleAnalysesOutputBody.md) - [ListFunctionStringsOutputBody](docs/ListFunctionStringsOutputBody.md) - [ListFunctionsDataTypesOutputBody](docs/ListFunctionsDataTypesOutputBody.md) + - [ListImportedFunctionsOutputBody](docs/ListImportedFunctionsOutputBody.md) - [ListTeamsOutputBody](docs/ListTeamsOutputBody.md) - [ListUsersOutputBody](docs/ListUsersOutputBody.md) - [LocationOutputBody](docs/LocationOutputBody.md) diff --git a/build.gradle b/build.gradle index ff2f479..2c8d568 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.107.0' +version = '3.110.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.107.0") + coordinates("ai.reveng", "sdk", "3.110.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 386462b..8b7bb83 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.107.0", + version := "3.110.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index a5d8bf2..28f8dd0 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -571,11 +571,11 @@ public class Example { # **getAnalysisFunctionMatches** -> GetMatchesOutputBody getAnalysisFunctionMatches(analysisId) +> GetMatchesOutputBody getAnalysisFunctionMatches(analysisId, matchId) Get function-matching results for an analysis -Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request ### Example ```java @@ -604,8 +604,9 @@ public class Example { AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); Long analysisId = 56L; // Long | Analysis ID + String matchId = "matchId_example"; // String | Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. try { - GetMatchesOutputBody result = apiInstance.getAnalysisFunctionMatches(analysisId); + GetMatchesOutputBody result = apiInstance.getAnalysisFunctionMatches(analysisId, matchId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnalysesCoreApi#getAnalysisFunctionMatches"); @@ -623,6 +624,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **analysisId** | **Long**| Analysis ID | | +| **matchId** | **String**| Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. | [optional] | ### Return type @@ -641,6 +643,7 @@ public class Example { | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | OK | - | +| **400** | Bad Request | - | | **403** | Forbidden | - | | **404** | Not Found | - | | **422** | Unprocessable Entity | - | @@ -648,11 +651,11 @@ public class Example { # **getAnalysisFunctionMatchingStatus** -> GetMatchesStatusOutputBody getAnalysisFunctionMatchingStatus(analysisId) +> GetMatchesStatusOutputBody getAnalysisFunctionMatchingStatus(analysisId, matchId) Get function-matching status for an analysis -Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request ### Example ```java @@ -681,8 +684,9 @@ public class Example { AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); Long analysisId = 56L; // Long | Analysis ID + String matchId = "matchId_example"; // String | Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. try { - GetMatchesStatusOutputBody result = apiInstance.getAnalysisFunctionMatchingStatus(analysisId); + GetMatchesStatusOutputBody result = apiInstance.getAnalysisFunctionMatchingStatus(analysisId, matchId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnalysesCoreApi#getAnalysisFunctionMatchingStatus"); @@ -700,6 +704,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **analysisId** | **Long**| Analysis ID | | +| **matchId** | **String**| Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. | [optional] | ### Return type @@ -718,6 +723,7 @@ public class Example { | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | OK | - | +| **400** | Bad Request | - | | **403** | Forbidden | - | | **404** | Not Found | - | | **422** | Unprocessable Entity | - | diff --git a/docs/ArchiveContentEntry.md b/docs/ArchiveContentEntry.md new file mode 100644 index 0000000..1d5cf8f --- /dev/null +++ b/docs/ArchiveContentEntry.md @@ -0,0 +1,15 @@ + + +# ArchiveContentEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**encrypted** | **Boolean** | Whether this entry is password-protected | | +|**path** | **String** | Path relative to the archive root | | +|**size** | **Long** | Uncompressed size in bytes | | + + + diff --git a/docs/BatchBinaryMatchResult.md b/docs/BatchBinaryMatchResult.md index b86fc2f..a319db1 100644 --- a/docs/BatchBinaryMatchResult.md +++ b/docs/BatchBinaryMatchResult.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**binaryId** | **Long** | Target binary | | |**errorMessage** | **String** | Error description when status=FAILED. | [optional] | +|**matchId** | **String** | Opaque token for this binary's matching run. Present on dispatch and when statuses were fetched by token. | [optional] | |**matchedFunctionCount** | **Long** | Number of source functions that received at least one candidate match. Only meaningful when status=COMPLETED. | | |**status** | [**StatusEnum**](#StatusEnum) | Per-binary workflow status | | diff --git a/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index b0b0aa6..98cbb69 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -28,7 +28,9 @@ All URIs are relative to *https://api.reveng.ai* | [**getFunctionsCalleesCallers**](FunctionsCoreApi.md#getFunctionsCalleesCallers) | **GET** /v3/functions/callees-callers | Get callees and callers for many functions | | [**getFunctionsMatches**](FunctionsCoreApi.md#getFunctionsMatches) | **GET** /v3/functions/matches | Get function-matching results for an explicit set of functions | | [**getFunctionsMatchingStatus**](FunctionsCoreApi.md#getFunctionsMatchingStatus) | **GET** /v3/functions/matches/status | Get function-matching status for an explicit set of functions | +| [**getImportedFunction**](FunctionsCoreApi.md#getImportedFunction) | **GET** /v3/analyses/{analysis_id}/imported-functions/{imported_function_id} | Get an imported function with its callers | | [**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 | @@ -1716,7 +1718,7 @@ public class Example { # **getFunctionsMatches** -> GetMatchesOutputBody getFunctionsMatches(functionIds) +> GetMatchesOutputBody getFunctionsMatches(matchId, functionIds) Get function-matching results for an explicit set of functions @@ -1748,9 +1750,10 @@ public class Example { bearerAuth.setBearerToken("BEARER TOKEN"); FunctionsCoreApi apiInstance = new FunctionsCoreApi(defaultClient); - List functionIds = Arrays.asList(); // List | Source function IDs whose matches to fetch. + String matchId = "matchId_example"; // String | Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. + List functionIds = Arrays.asList(); // List | Source function IDs whose matches to fetch. Required unless match_id is supplied. try { - GetMatchesOutputBody result = apiInstance.getFunctionsMatches(functionIds); + GetMatchesOutputBody result = apiInstance.getFunctionsMatches(matchId, functionIds); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FunctionsCoreApi#getFunctionsMatches"); @@ -1767,7 +1770,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **functionIds** | [**List<Long>**](Long.md)| Source function IDs whose matches to fetch. | | +| **matchId** | **String**| Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. | [optional] | +| **functionIds** | [**List<Long>**](Long.md)| Source function IDs whose matches to fetch. Required unless match_id is supplied. | [optional] | ### Return type @@ -1794,7 +1798,7 @@ public class Example { # **getFunctionsMatchingStatus** -> GetMatchesStatusOutputBody getFunctionsMatchingStatus(functionIds) +> GetMatchesStatusOutputBody getFunctionsMatchingStatus(matchId, functionIds) Get function-matching status for an explicit set of functions @@ -1826,9 +1830,10 @@ public class Example { bearerAuth.setBearerToken("BEARER TOKEN"); FunctionsCoreApi apiInstance = new FunctionsCoreApi(defaultClient); - List functionIds = Arrays.asList(); // List | Source function IDs whose matches to fetch. + String matchId = "matchId_example"; // String | Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. + List functionIds = Arrays.asList(); // List | Source function IDs whose matches to fetch. Required unless match_id is supplied. try { - GetMatchesStatusOutputBody result = apiInstance.getFunctionsMatchingStatus(functionIds); + GetMatchesStatusOutputBody result = apiInstance.getFunctionsMatchingStatus(matchId, functionIds); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FunctionsCoreApi#getFunctionsMatchingStatus"); @@ -1845,7 +1850,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **functionIds** | [**List<Long>**](Long.md)| Source function IDs whose matches to fetch. | | +| **matchId** | **String**| Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. | [optional] | +| **functionIds** | [**List<Long>**](Long.md)| Source function IDs whose matches to fetch. Required unless match_id is supplied. | [optional] | ### Return type @@ -1870,6 +1876,85 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **getImportedFunction** +> ImportedFunctionDetailOutputBody getImportedFunction(analysisId, importedFunctionId) + +Get an imported function with its callers + +Returns a single imported symbol plus the internal functions that call it, resolved via the import's PLT/stub addresses within the binary. Answers \"which functions call `free`?\" for binary navigation. **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 analysisId = 56L; // Long | Analysis ID + Long importedFunctionId = 56L; // Long | Imported function ID + try { + ImportedFunctionDetailOutputBody result = apiInstance.getImportedFunction(analysisId, importedFunctionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#getImportedFunction"); + 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 | | +| **importedFunctionId** | **Long**| Imported function ID | | + +### Return type + +[**ImportedFunctionDetailOutputBody**](ImportedFunctionDetailOutputBody.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 | - | + # **listAnalysisFunctions** > ListAnalysisFunctionsOutputBody listAnalysisFunctions(analysisId, offset, limit) @@ -1951,6 +2036,87 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **listImportedFunctions** +> ListImportedFunctionsOutputBody listImportedFunctions(analysisId, offset, limit) + +List imported functions in an analysis + +Returns a paginated list of external/imported symbols (e.g. libc's `free`) linked by the analysis's binary. These are display-only: they carry no embeddings, cannot be renamed, and never participate in match/diff. `total_count` is the full population size, ignoring pagination. **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 analysisId = 56L; // Long | Analysis ID + Long offset = 56L; // Long | Pagination offset. Defaults to 0. + Long limit = 56L; // Long | Page size. Defaults to 100. + try { + ListImportedFunctionsOutputBody result = apiInstance.listImportedFunctions(analysisId, offset, limit); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#listImportedFunctions"); + 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 | | +| **offset** | **Long**| Pagination offset. Defaults to 0. | [optional] | +| **limit** | **Long**| Page size. Defaults to 100. | [optional] | + +### Return type + +[**ListImportedFunctionsOutputBody**](ListImportedFunctionsOutputBody.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 | - | + # **startFunctionsMatching** > StartMatchingOutputBody startFunctionsMatching(startMatchingForFunctionsInputBody) diff --git a/docs/ImportedFunctionCallerEntry.md b/docs/ImportedFunctionCallerEntry.md new file mode 100644 index 0000000..7a7073e --- /dev/null +++ b/docs/ImportedFunctionCallerEntry.md @@ -0,0 +1,16 @@ + + +# ImportedFunctionCallerEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functionId** | **Long** | | | +|**functionName** | **String** | | | +|**functionVaddr** | **Long** | | | +|**stubVaddr** | **Long** | The PLT/stub address this caller targets. | | + + + diff --git a/docs/ImportedFunctionDetailOutputBody.md b/docs/ImportedFunctionDetailOutputBody.md new file mode 100644 index 0000000..f1463bd --- /dev/null +++ b/docs/ImportedFunctionDetailOutputBody.md @@ -0,0 +1,21 @@ + + +# ImportedFunctionDetailOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callers** | [**List<ImportedFunctionCallerEntry>**](ImportedFunctionCallerEntry.md) | Internal functions that call this import, resolved via its PLT/stub addresses. | | +|**importedFunctionId** | **Long** | | | +|**isFunction** | **Boolean** | False for imported data symbols. | | +|**libraryName** | **String** | Library the symbol is imported from. '<EXTERNAL>' for unattributed imports. | | +|**libraryVersion** | **String** | Versioned symbol tag, when the loader records one. | [optional] | +|**name** | **String** | | | +|**originalName** | **String** | Pre-demangling / pre-aliasing name, when it differs from name. | [optional] | +|**stubVaddrs** | **List<Long>** | PLT/stub addresses that resolve external call edges (function_call_edges.callee_vaddr) to this import. Use these to link a caller's external callee to this import. | | +|**vaddr** | **Long** | Virtual address of the import, when known. | [optional] | + + + diff --git a/docs/ImportedFunctionEntry.md b/docs/ImportedFunctionEntry.md new file mode 100644 index 0000000..1d39d97 --- /dev/null +++ b/docs/ImportedFunctionEntry.md @@ -0,0 +1,20 @@ + + +# ImportedFunctionEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**importedFunctionId** | **Long** | | | +|**isFunction** | **Boolean** | False for imported data symbols. | | +|**libraryName** | **String** | Library the symbol is imported from. '<EXTERNAL>' for unattributed imports. | | +|**libraryVersion** | **String** | Versioned symbol tag, when the loader records one. | [optional] | +|**name** | **String** | | | +|**originalName** | **String** | Pre-demangling / pre-aliasing name, when it differs from name. | [optional] | +|**stubVaddrs** | **List<Long>** | PLT/stub addresses that resolve external call edges (function_call_edges.callee_vaddr) to this import. Use these to link a caller's external callee to this import. | | +|**vaddr** | **Long** | Virtual address of the import, when known. | [optional] | + + + diff --git a/docs/ListArchiveContentsOutputBody.md b/docs/ListArchiveContentsOutputBody.md new file mode 100644 index 0000000..47cd52c --- /dev/null +++ b/docs/ListArchiveContentsOutputBody.md @@ -0,0 +1,17 @@ + + +# ListArchiveContentsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**entries** | [**List<ArchiveContentEntry>**](ArchiveContentEntry.md) | Files inside the archive, with paths relative to the archive root | | +|**hasNext** | **Boolean** | Whether a further page of entries follows this one. | | +|**page** | **Long** | Page number of this response (1-indexed). | | +|**pageSize** | **Long** | Number of entries per page. | | +|**totalCount** | **Long** | Total number of file entries in the archive, ignoring pagination. | | + + + diff --git a/docs/ListImportedFunctionsOutputBody.md b/docs/ListImportedFunctionsOutputBody.md new file mode 100644 index 0000000..3f942b2 --- /dev/null +++ b/docs/ListImportedFunctionsOutputBody.md @@ -0,0 +1,14 @@ + + +# ListImportedFunctionsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**importedFunctions** | [**List<ImportedFunctionEntry>**](ImportedFunctionEntry.md) | | | +|**totalCount** | **Long** | Total imported functions for the binary, ignoring pagination. | | + + + diff --git a/docs/StartMatchingForAnalysisInputBody.md b/docs/StartMatchingForAnalysisInputBody.md index 852cedc..5724ffa 100644 --- a/docs/StartMatchingForAnalysisInputBody.md +++ b/docs/StartMatchingForAnalysisInputBody.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**filters** | [**MatchFilters**](MatchFilters.md) | Narrow the candidate pool. | [optional] | |**minSimilarity** | **Double** | Similarity floor as a percentage. Defaults to 90. | [optional] | +|**noCache** | **Boolean** | By default a completed matching run for the same request is reused (response status=COMPLETED, no new run). Set true to force a fresh run. | [optional] | |**resultsPerFunction** | **Long** | Max matches returned per source function. Defaults to 1. | [optional] | diff --git a/docs/StartMatchingForFunctionsInputBody.md b/docs/StartMatchingForFunctionsInputBody.md index f933e30..8b68152 100644 --- a/docs/StartMatchingForFunctionsInputBody.md +++ b/docs/StartMatchingForFunctionsInputBody.md @@ -10,6 +10,7 @@ |**filters** | [**MatchFilters**](MatchFilters.md) | Narrow the candidate pool. | [optional] | |**functionIds** | **List<Long>** | Source function IDs to match against the rest of the corpus. | | |**minSimilarity** | **Double** | Similarity floor as a percentage. Defaults to 90. | [optional] | +|**noCache** | **Boolean** | By default a completed matching run for the same request is reused (response status=COMPLETED, no new run). Set true to force a fresh run. | [optional] | |**resultsPerFunction** | **Long** | Max matches returned per source function. Defaults to 1. | [optional] | |**useCanonicalNames** | **Boolean** | Collapse near-duplicate candidate names into canonical buckets and return per-name confidences (the response 'confidences' array). Adds a canonicalisation step; defaults to false. | [optional] | diff --git a/docs/StartMatchingOutputBody.md b/docs/StartMatchingOutputBody.md index 3e2f8fc..dc9b9e7 100644 --- a/docs/StartMatchingOutputBody.md +++ b/docs/StartMatchingOutputBody.md @@ -7,6 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**matchId** | **String** | Opaque token for this matching run. Pass it to the GET/status endpoints' match_id query parameter to fetch this exact run. | | |**messages** | [**List<ProgressMessage>**](ProgressMessage.md) | Log messages emitted during execution | | |**status** | [**StatusEnum**](#StatusEnum) | Current workflow status | | |**step** | **String** | Name of the current step | | diff --git a/docs/TriggerDynamicExecutionInputBody.md b/docs/TriggerDynamicExecutionInputBody.md index 740bba1..1feccc3 100644 --- a/docs/TriggerDynamicExecutionInputBody.md +++ b/docs/TriggerDynamicExecutionInputBody.md @@ -7,6 +7,9 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**archiveEntryPath** | **String** | Relative path of the entry inside the archive to execute | [optional] | +|**archivePassword** | **String** | Password for an encrypted archive | [optional] | +|**archiveSha256Hash** | **String** | SHA-256 of the archive object to send to the sandbox instead of the analysed binary | [optional] | |**commandLineArgs** | **String** | Command-line arguments passed to the sample when the sandbox launches it | [optional] | |**startMethod** | [**StartMethodEnum**](#StartMethodEnum) | How the sandbox launches the sample. Defaults to the sandbox's standard behaviour when omitted. | [optional] | |**timeout** | [**TimeoutEnum**](#TimeoutEnum) | Maximum sandbox execution time in seconds | [optional] | diff --git a/pom.xml b/pom.xml index 812812c..80b313e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.107.0 + 3.110.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 c10edb4..6212660 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -1117,6 +1117,7 @@ public okhttp3.Call getAnalysisFunctionMapAsync(@javax.annotation.Nonnull Intege /** * Build call for getAnalysisFunctionMatches * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1125,13 +1126,14 @@ public okhttp3.Call getAnalysisFunctionMapAsync(@javax.annotation.Nonnull Intege Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call getAnalysisFunctionMatchesCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAnalysisFunctionMatchesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -1157,6 +1159,10 @@ public okhttp3.Call getAnalysisFunctionMatchesCall(@javax.annotation.Nonnull Lon Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (matchId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("match_id", matchId)); + } + final String[] localVarAccepts = { "application/json" }; @@ -1177,20 +1183,21 @@ public okhttp3.Call getAnalysisFunctionMatchesCall(@javax.annotation.Nonnull Lon } @SuppressWarnings("rawtypes") - private okhttp3.Call getAnalysisFunctionMatchesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getAnalysisFunctionMatchesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, 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 getAnalysisFunctionMatches(Async)"); } - return getAnalysisFunctionMatchesCall(analysisId, _callback); + return getAnalysisFunctionMatchesCall(analysisId, matchId, _callback); } /** * Get function-matching results for an analysis - * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @return GetMatchesOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1198,21 +1205,23 @@ private okhttp3.Call getAnalysisFunctionMatchesValidateBeforeCall(@javax.annotat Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public GetMatchesOutputBody getAnalysisFunctionMatches(@javax.annotation.Nonnull Long analysisId) throws ApiException { - ApiResponse localVarResp = getAnalysisFunctionMatchesWithHttpInfo(analysisId); + public GetMatchesOutputBody getAnalysisFunctionMatches(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId) throws ApiException { + ApiResponse localVarResp = getAnalysisFunctionMatchesWithHttpInfo(analysisId, matchId); return localVarResp.getData(); } /** * Get function-matching results for an analysis - * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @return ApiResponse<GetMatchesOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1220,22 +1229,24 @@ public GetMatchesOutputBody getAnalysisFunctionMatches(@javax.annotation.Nonnull Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public ApiResponse getAnalysisFunctionMatchesWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { - okhttp3.Call localVarCall = getAnalysisFunctionMatchesValidateBeforeCall(analysisId, null); + public ApiResponse getAnalysisFunctionMatchesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId) throws ApiException { + okhttp3.Call localVarCall = getAnalysisFunctionMatchesValidateBeforeCall(analysisId, matchId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get function-matching results for an analysis (asynchronously) - * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @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 @@ -1244,15 +1255,16 @@ public ApiResponse getAnalysisFunctionMatchesWithHttpInfo( Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call getAnalysisFunctionMatchesAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAnalysisFunctionMatchesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getAnalysisFunctionMatchesValidateBeforeCall(analysisId, _callback); + okhttp3.Call localVarCall = getAnalysisFunctionMatchesValidateBeforeCall(analysisId, matchId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; @@ -1260,6 +1272,7 @@ public okhttp3.Call getAnalysisFunctionMatchesAsync(@javax.annotation.Nonnull Lo /** * Build call for getAnalysisFunctionMatchingStatus * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1268,13 +1281,14 @@ public okhttp3.Call getAnalysisFunctionMatchesAsync(@javax.annotation.Nonnull Lo Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call getAnalysisFunctionMatchingStatusCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAnalysisFunctionMatchingStatusCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -1300,6 +1314,10 @@ public okhttp3.Call getAnalysisFunctionMatchingStatusCall(@javax.annotation.Nonn Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (matchId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("match_id", matchId)); + } + final String[] localVarAccepts = { "application/json" }; @@ -1320,20 +1338,21 @@ public okhttp3.Call getAnalysisFunctionMatchingStatusCall(@javax.annotation.Nonn } @SuppressWarnings("rawtypes") - private okhttp3.Call getAnalysisFunctionMatchingStatusValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getAnalysisFunctionMatchingStatusValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, 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 getAnalysisFunctionMatchingStatus(Async)"); } - return getAnalysisFunctionMatchingStatusCall(analysisId, _callback); + return getAnalysisFunctionMatchingStatusCall(analysisId, matchId, _callback); } /** * Get function-matching status for an analysis - * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @return GetMatchesStatusOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1341,21 +1360,23 @@ private okhttp3.Call getAnalysisFunctionMatchingStatusValidateBeforeCall(@javax. Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public GetMatchesStatusOutputBody getAnalysisFunctionMatchingStatus(@javax.annotation.Nonnull Long analysisId) throws ApiException { - ApiResponse localVarResp = getAnalysisFunctionMatchingStatusWithHttpInfo(analysisId); + public GetMatchesStatusOutputBody getAnalysisFunctionMatchingStatus(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId) throws ApiException { + ApiResponse localVarResp = getAnalysisFunctionMatchingStatusWithHttpInfo(analysisId, matchId); return localVarResp.getData(); } /** * Get function-matching status for an analysis - * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @return ApiResponse<GetMatchesStatusOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1363,22 +1384,24 @@ public GetMatchesStatusOutputBody getAnalysisFunctionMatchingStatus(@javax.annot Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public ApiResponse getAnalysisFunctionMatchingStatusWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { - okhttp3.Call localVarCall = getAnalysisFunctionMatchingStatusValidateBeforeCall(analysisId, null); + public ApiResponse getAnalysisFunctionMatchingStatusWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId) throws ApiException { + okhttp3.Call localVarCall = getAnalysisFunctionMatchingStatusValidateBeforeCall(analysisId, matchId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get function-matching status for an analysis (asynchronously) - * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * Returns the matching workflow's current status. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param analysisId Analysis ID (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) * @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 @@ -1387,15 +1410,16 @@ public ApiResponse getAnalysisFunctionMatchingStatus Response Details Status Code Description Response Headers 200 OK - + 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call getAnalysisFunctionMatchingStatusAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAnalysisFunctionMatchingStatusAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable String matchId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getAnalysisFunctionMatchingStatusValidateBeforeCall(analysisId, _callback); + okhttp3.Call localVarCall = getAnalysisFunctionMatchingStatusValidateBeforeCall(analysisId, matchId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; diff --git a/src/main/java/ai/reveng/api/FunctionsCoreApi.java b/src/main/java/ai/reveng/api/FunctionsCoreApi.java index 35b97c0..08ec7f0 100644 --- a/src/main/java/ai/reveng/api/FunctionsCoreApi.java +++ b/src/main/java/ai/reveng/api/FunctionsCoreApi.java @@ -50,8 +50,10 @@ import ai.reveng.model.FunctionMatchingResponse; import ai.reveng.model.GetMatchesOutputBody; import ai.reveng.model.GetMatchesStatusOutputBody; +import ai.reveng.model.ImportedFunctionDetailOutputBody; import ai.reveng.model.ListAnalysisFunctionsOutputBody; import ai.reveng.model.ListFunctionStringsOutputBody; +import ai.reveng.model.ListImportedFunctionsOutputBody; import ai.reveng.model.StartMatchingForFunctionsInputBody; import ai.reveng.model.StartMatchingOutputBody; @@ -3372,7 +3374,8 @@ public okhttp3.Call getFunctionsCalleesCallersAsync(@javax.annotation.Nullable L } /** * Build call for getFunctionsMatches - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3388,7 +3391,7 @@ public okhttp3.Call getFunctionsCalleesCallersAsync(@javax.annotation.Nullable L 500 Internal Server Error - */ - public okhttp3.Call getFunctionsMatchesCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionsMatchesCall(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -3413,6 +3416,10 @@ public okhttp3.Call getFunctionsMatchesCall(@javax.annotation.Nullable List localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (matchId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("match_id", matchId)); + } + if (functionIds != null) { localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "function_ids", functionIds)); } @@ -3437,20 +3444,16 @@ public okhttp3.Call getFunctionsMatchesCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionIds' is set - if (functionIds == null) { - throw new ApiException("Missing the required parameter 'functionIds' when calling getFunctionsMatches(Async)"); - } - - return getFunctionsMatchesCall(functionIds, _callback); + private okhttp3.Call getFunctionsMatchesValidateBeforeCall(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + return getFunctionsMatchesCall(matchId, functionIds, _callback); } /** * Get function-matching results for an explicit set of functions * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @return GetMatchesOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3465,15 +3468,16 @@ private okhttp3.Call getFunctionsMatchesValidateBeforeCall(@javax.annotation.Nul 500 Internal Server Error - */ - public GetMatchesOutputBody getFunctionsMatches(@javax.annotation.Nullable List functionIds) throws ApiException { - ApiResponse localVarResp = getFunctionsMatchesWithHttpInfo(functionIds); + public GetMatchesOutputBody getFunctionsMatches(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds) throws ApiException { + ApiResponse localVarResp = getFunctionsMatchesWithHttpInfo(matchId, functionIds); return localVarResp.getData(); } /** * Get function-matching results for an explicit set of functions * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @return ApiResponse<GetMatchesOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3488,8 +3492,8 @@ public GetMatchesOutputBody getFunctionsMatches(@javax.annotation.Nullable List< 500 Internal Server Error - */ - public ApiResponse getFunctionsMatchesWithHttpInfo(@javax.annotation.Nullable List functionIds) throws ApiException { - okhttp3.Call localVarCall = getFunctionsMatchesValidateBeforeCall(functionIds, null); + public ApiResponse getFunctionsMatchesWithHttpInfo(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds) throws ApiException { + okhttp3.Call localVarCall = getFunctionsMatchesValidateBeforeCall(matchId, functionIds, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -3497,7 +3501,8 @@ public ApiResponse getFunctionsMatchesWithHttpInfo(@javax. /** * Get function-matching results for an explicit set of functions (asynchronously) * Returns the matches blob when the matching workflow has completed. While the workflow is in progress this endpoint returns the current status with no matches; use /matches/status to poll progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @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 @@ -3513,16 +3518,17 @@ public ApiResponse getFunctionsMatchesWithHttpInfo(@javax. 500 Internal Server Error - */ - public okhttp3.Call getFunctionsMatchesAsync(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionsMatchesAsync(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getFunctionsMatchesValidateBeforeCall(functionIds, _callback); + okhttp3.Call localVarCall = getFunctionsMatchesValidateBeforeCall(matchId, functionIds, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getFunctionsMatchingStatus - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3538,7 +3544,7 @@ public okhttp3.Call getFunctionsMatchesAsync(@javax.annotation.Nullable List 500 Internal Server Error - */ - public okhttp3.Call getFunctionsMatchingStatusCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionsMatchingStatusCall(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -3563,6 +3569,10 @@ public okhttp3.Call getFunctionsMatchingStatusCall(@javax.annotation.Nullable Li Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (matchId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("match_id", matchId)); + } + if (functionIds != null) { localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "function_ids", functionIds)); } @@ -3587,20 +3597,16 @@ public okhttp3.Call getFunctionsMatchingStatusCall(@javax.annotation.Nullable Li } @SuppressWarnings("rawtypes") - private okhttp3.Call getFunctionsMatchingStatusValidateBeforeCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionIds' is set - if (functionIds == null) { - throw new ApiException("Missing the required parameter 'functionIds' when calling getFunctionsMatchingStatus(Async)"); - } - - return getFunctionsMatchingStatusCall(functionIds, _callback); + private okhttp3.Call getFunctionsMatchingStatusValidateBeforeCall(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + return getFunctionsMatchingStatusCall(matchId, functionIds, _callback); } /** * Get function-matching status for an explicit set of functions * Returns the matching workflow's current status for the supplied function IDs. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @return GetMatchesStatusOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3615,15 +3621,16 @@ private okhttp3.Call getFunctionsMatchingStatusValidateBeforeCall(@javax.annotat 500 Internal Server Error - */ - public GetMatchesStatusOutputBody getFunctionsMatchingStatus(@javax.annotation.Nullable List functionIds) throws ApiException { - ApiResponse localVarResp = getFunctionsMatchingStatusWithHttpInfo(functionIds); + public GetMatchesStatusOutputBody getFunctionsMatchingStatus(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds) throws ApiException { + ApiResponse localVarResp = getFunctionsMatchingStatusWithHttpInfo(matchId, functionIds); return localVarResp.getData(); } /** * Get function-matching status for an explicit set of functions * Returns the matching workflow's current status for the supplied function IDs. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @return ApiResponse<GetMatchesStatusOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3638,8 +3645,8 @@ public GetMatchesStatusOutputBody getFunctionsMatchingStatus(@javax.annotation.N 500 Internal Server Error - */ - public ApiResponse getFunctionsMatchingStatusWithHttpInfo(@javax.annotation.Nullable List functionIds) throws ApiException { - okhttp3.Call localVarCall = getFunctionsMatchingStatusValidateBeforeCall(functionIds, null); + public ApiResponse getFunctionsMatchingStatusWithHttpInfo(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds) throws ApiException { + okhttp3.Call localVarCall = getFunctionsMatchingStatusValidateBeforeCall(matchId, functionIds, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -3647,7 +3654,8 @@ public ApiResponse getFunctionsMatchingStatusWithHtt /** * Get function-matching status for an explicit set of functions (asynchronously) * Returns the matching workflow's current status for the supplied function IDs. Does not include the matches blob — use GET /matches for that. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Source function IDs whose matches to fetch. (required) + * @param matchId Opaque token from a start-matching response. When supplied, returns that specific run instead of the latest. (optional) + * @param functionIds Source function IDs whose matches to fetch. Required unless match_id is supplied. (optional) * @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 @@ -3663,13 +3671,166 @@ public ApiResponse getFunctionsMatchingStatusWithHtt 500 Internal Server Error - */ - public okhttp3.Call getFunctionsMatchingStatusAsync(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionsMatchingStatusAsync(@javax.annotation.Nullable String matchId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getFunctionsMatchingStatusValidateBeforeCall(functionIds, _callback); + okhttp3.Call localVarCall = getFunctionsMatchingStatusValidateBeforeCall(matchId, functionIds, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for getImportedFunction + * @param analysisId Analysis ID (required) + * @param importedFunctionId Imported 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 getImportedFunctionCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long importedFunctionId, 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}/imported-functions/{imported_function_id}" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "imported_function_id" + "}", localVarApiClient.escapeString(importedFunctionId.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 getImportedFunctionValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long importedFunctionId, 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 getImportedFunction(Async)"); + } + + // verify the required parameter 'importedFunctionId' is set + if (importedFunctionId == null) { + throw new ApiException("Missing the required parameter 'importedFunctionId' when calling getImportedFunction(Async)"); + } + + return getImportedFunctionCall(analysisId, importedFunctionId, _callback); + + } + + /** + * Get an imported function with its callers + * Returns a single imported symbol plus the internal functions that call it, resolved via the import's PLT/stub addresses within the binary. Answers \"which functions call `free`?\" for binary navigation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param importedFunctionId Imported function ID (required) + * @return ImportedFunctionDetailOutputBody + * @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 ImportedFunctionDetailOutputBody getImportedFunction(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long importedFunctionId) throws ApiException { + ApiResponse localVarResp = getImportedFunctionWithHttpInfo(analysisId, importedFunctionId); + return localVarResp.getData(); + } + + /** + * Get an imported function with its callers + * Returns a single imported symbol plus the internal functions that call it, resolved via the import's PLT/stub addresses within the binary. Answers \"which functions call `free`?\" for binary navigation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param importedFunctionId Imported function ID (required) + * @return ApiResponse<ImportedFunctionDetailOutputBody> + * @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 getImportedFunctionWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long importedFunctionId) throws ApiException { + okhttp3.Call localVarCall = getImportedFunctionValidateBeforeCall(analysisId, importedFunctionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get an imported function with its callers (asynchronously) + * Returns a single imported symbol plus the internal functions that call it, resolved via the import's PLT/stub addresses within the binary. Answers \"which functions call `free`?\" for binary navigation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param importedFunctionId Imported 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 getImportedFunctionAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long importedFunctionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getImportedFunctionValidateBeforeCall(analysisId, importedFunctionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for listAnalysisFunctions * @param analysisId Analysis ID (required) @@ -3829,6 +3990,165 @@ public okhttp3.Call listAnalysisFunctionsAsync(@javax.annotation.Nonnull Long an localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for listImportedFunctions + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. Defaults to 0. (optional) + * @param limit Page size. Defaults to 100. (optional) + * @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 listImportedFunctionsCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, 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}/imported-functions" + .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(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + 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 listImportedFunctionsValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, 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 listImportedFunctions(Async)"); + } + + return listImportedFunctionsCall(analysisId, offset, limit, _callback); + + } + + /** + * List imported functions in an analysis + * Returns a paginated list of external/imported symbols (e.g. libc's `free`) linked by the analysis's binary. These are display-only: they carry no embeddings, cannot be renamed, and never participate in match/diff. `total_count` is the full population size, ignoring pagination. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. Defaults to 0. (optional) + * @param limit Page size. Defaults to 100. (optional) + * @return ListImportedFunctionsOutputBody + * @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 ListImportedFunctionsOutputBody listImportedFunctions(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit) throws ApiException { + ApiResponse localVarResp = listImportedFunctionsWithHttpInfo(analysisId, offset, limit); + return localVarResp.getData(); + } + + /** + * List imported functions in an analysis + * Returns a paginated list of external/imported symbols (e.g. libc's `free`) linked by the analysis's binary. These are display-only: they carry no embeddings, cannot be renamed, and never participate in match/diff. `total_count` is the full population size, ignoring pagination. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. Defaults to 0. (optional) + * @param limit Page size. Defaults to 100. (optional) + * @return ApiResponse<ListImportedFunctionsOutputBody> + * @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 listImportedFunctionsWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit) throws ApiException { + okhttp3.Call localVarCall = listImportedFunctionsValidateBeforeCall(analysisId, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List imported functions in an analysis (asynchronously) + * Returns a paginated list of external/imported symbols (e.g. libc's `free`) linked by the analysis's binary. These are display-only: they carry no embeddings, cannot be renamed, and never participate in match/diff. `total_count` is the full population size, ignoring pagination. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. Defaults to 0. (optional) + * @param limit Page size. Defaults to 100. (optional) + * @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 listImportedFunctionsAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listImportedFunctionsValidateBeforeCall(analysisId, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for startFunctionsMatching * @param startMatchingForFunctionsInputBody (required) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 1339167..a652a42 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.107.0/java"); + setUserAgent("OpenAPI-Generator/3.110.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 7d5205d..8e375f7 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.107.0"; + public static final String VERSION = "3.110.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 680312f..193d507 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -143,6 +143,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsResponsesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2InfoTypesCapability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ArchiveContentEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Argument.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Artifact.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AttemptFailedEvent.CustomTypeAdapterFactory()); @@ -398,6 +399,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IOC.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IconModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportModel.CustomTypeAdapterFactory()); + 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.InlineComment.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InviteUserInputBody.CustomTypeAdapterFactory()); @@ -405,11 +409,13 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisStringsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListArchiveContentsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionResults.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListExampleAnalysesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionStringsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListImportedFunctionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListTeamsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListUsersOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.LocationOutputBody.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/ArchiveContentEntry.java b/src/main/java/ai/reveng/model/ArchiveContentEntry.java new file mode 100644 index 0000000..bca5278 --- /dev/null +++ b/src/main/java/ai/reveng/model/ArchiveContentEntry.java @@ -0,0 +1,341 @@ +/* + * 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; + +/** + * ArchiveContentEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArchiveContentEntry { + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nonnull + private Boolean encrypted; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nonnull + private String path; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public ArchiveContentEntry() { + } + + public ArchiveContentEntry encrypted(@javax.annotation.Nonnull Boolean encrypted) { + this.encrypted = encrypted; + return this; + } + + /** + * Whether this entry is password-protected + * @return encrypted + */ + @javax.annotation.Nonnull + public Boolean getEncrypted() { + return encrypted; + } + + public void setEncrypted(@javax.annotation.Nonnull Boolean encrypted) { + this.encrypted = encrypted; + } + + + public ArchiveContentEntry path(@javax.annotation.Nonnull String path) { + this.path = path; + return this; + } + + /** + * Path relative to the archive root + * @return path + */ + @javax.annotation.Nonnull + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nonnull String path) { + this.path = path; + } + + + public ArchiveContentEntry size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Uncompressed size in bytes + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + /** + * 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 ArchiveContentEntry instance itself + */ + public ArchiveContentEntry 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; + } + ArchiveContentEntry archiveContentEntry = (ArchiveContentEntry) o; + return Objects.equals(this.encrypted, archiveContentEntry.encrypted) && + Objects.equals(this.path, archiveContentEntry.path) && + Objects.equals(this.size, archiveContentEntry.size)&& + Objects.equals(this.additionalProperties, archiveContentEntry.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(encrypted, path, size, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArchiveContentEntry {\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("encrypted", "path", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("encrypted", "path", "size")); + } + + /** + * 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 ArchiveContentEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArchiveContentEntry.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 ArchiveContentEntry is not found in the empty JSON string", ArchiveContentEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ArchiveContentEntry.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("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArchiveContentEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArchiveContentEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArchiveContentEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArchiveContentEntry 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 ArchiveContentEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArchiveContentEntry 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 ArchiveContentEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArchiveContentEntry + * @throws IOException if the JSON string is invalid with respect to ArchiveContentEntry + */ + public static ArchiveContentEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArchiveContentEntry.class); + } + + /** + * Convert an instance of ArchiveContentEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BatchBinaryMatchResult.java b/src/main/java/ai/reveng/model/BatchBinaryMatchResult.java index 2826711..4dd7b2d 100644 --- a/src/main/java/ai/reveng/model/BatchBinaryMatchResult.java +++ b/src/main/java/ai/reveng/model/BatchBinaryMatchResult.java @@ -59,6 +59,11 @@ public class BatchBinaryMatchResult { @javax.annotation.Nullable private String errorMessage; + public static final String SERIALIZED_NAME_MATCH_ID = "match_id"; + @SerializedName(SERIALIZED_NAME_MATCH_ID) + @javax.annotation.Nullable + private String matchId; + public static final String SERIALIZED_NAME_MATCHED_FUNCTION_COUNT = "matched_function_count"; @SerializedName(SERIALIZED_NAME_MATCHED_FUNCTION_COUNT) @javax.annotation.Nonnull @@ -170,6 +175,25 @@ public void setErrorMessage(@javax.annotation.Nullable String errorMessage) { } + public BatchBinaryMatchResult matchId(@javax.annotation.Nullable String matchId) { + this.matchId = matchId; + return this; + } + + /** + * Opaque token for this binary's matching run. Present on dispatch and when statuses were fetched by token. + * @return matchId + */ + @javax.annotation.Nullable + public String getMatchId() { + return matchId; + } + + public void setMatchId(@javax.annotation.Nullable String matchId) { + this.matchId = matchId; + } + + public BatchBinaryMatchResult matchedFunctionCount(@javax.annotation.Nonnull Long matchedFunctionCount) { this.matchedFunctionCount = matchedFunctionCount; return this; @@ -264,6 +288,7 @@ public boolean equals(Object o) { BatchBinaryMatchResult batchBinaryMatchResult = (BatchBinaryMatchResult) o; return Objects.equals(this.binaryId, batchBinaryMatchResult.binaryId) && Objects.equals(this.errorMessage, batchBinaryMatchResult.errorMessage) && + Objects.equals(this.matchId, batchBinaryMatchResult.matchId) && Objects.equals(this.matchedFunctionCount, batchBinaryMatchResult.matchedFunctionCount) && Objects.equals(this.status, batchBinaryMatchResult.status)&& Objects.equals(this.additionalProperties, batchBinaryMatchResult.additionalProperties); @@ -271,7 +296,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(binaryId, errorMessage, matchedFunctionCount, status, additionalProperties); + return Objects.hash(binaryId, errorMessage, matchId, matchedFunctionCount, status, additionalProperties); } @Override @@ -280,6 +305,7 @@ public String toString() { sb.append("class BatchBinaryMatchResult {\n"); sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" matchId: ").append(toIndentedString(matchId)).append("\n"); sb.append(" matchedFunctionCount: ").append(toIndentedString(matchedFunctionCount)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -301,7 +327,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("binary_id", "error_message", "matched_function_count", "status")); + openapiFields = new HashSet(Arrays.asList("binary_id", "error_message", "match_id", "matched_function_count", "status")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("binary_id", "matched_function_count", "status")); @@ -330,6 +356,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("error_message") != null && !jsonObj.get("error_message").isJsonNull()) && !jsonObj.get("error_message").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `error_message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_message").toString())); } + if ((jsonObj.get("match_id") != null && !jsonObj.get("match_id").isJsonNull()) && !jsonObj.get("match_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `match_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("match_id").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())); } diff --git a/src/main/java/ai/reveng/model/ImportedFunctionCallerEntry.java b/src/main/java/ai/reveng/model/ImportedFunctionCallerEntry.java new file mode 100644 index 0000000..f09c029 --- /dev/null +++ b/src/main/java/ai/reveng/model/ImportedFunctionCallerEntry.java @@ -0,0 +1,286 @@ +/* + * 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; + +/** + * ImportedFunctionCallerEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ImportedFunctionCallerEntry { + 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_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_FUNCTION_VADDR = "function_vaddr"; + @SerializedName(SERIALIZED_NAME_FUNCTION_VADDR) + @javax.annotation.Nonnull + private Long functionVaddr; + + public static final String SERIALIZED_NAME_STUB_VADDR = "stub_vaddr"; + @SerializedName(SERIALIZED_NAME_STUB_VADDR) + @javax.annotation.Nonnull + private Long stubVaddr; + + public ImportedFunctionCallerEntry() { + } + + public ImportedFunctionCallerEntry 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 ImportedFunctionCallerEntry functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get functionName + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public ImportedFunctionCallerEntry functionVaddr(@javax.annotation.Nonnull Long functionVaddr) { + this.functionVaddr = functionVaddr; + return this; + } + + /** + * Get functionVaddr + * @return functionVaddr + */ + @javax.annotation.Nonnull + public Long getFunctionVaddr() { + return functionVaddr; + } + + public void setFunctionVaddr(@javax.annotation.Nonnull Long functionVaddr) { + this.functionVaddr = functionVaddr; + } + + + public ImportedFunctionCallerEntry stubVaddr(@javax.annotation.Nonnull Long stubVaddr) { + this.stubVaddr = stubVaddr; + return this; + } + + /** + * The PLT/stub address this caller targets. + * @return stubVaddr + */ + @javax.annotation.Nonnull + public Long getStubVaddr() { + return stubVaddr; + } + + public void setStubVaddr(@javax.annotation.Nonnull Long stubVaddr) { + this.stubVaddr = stubVaddr; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImportedFunctionCallerEntry importedFunctionCallerEntry = (ImportedFunctionCallerEntry) o; + return Objects.equals(this.functionId, importedFunctionCallerEntry.functionId) && + Objects.equals(this.functionName, importedFunctionCallerEntry.functionName) && + Objects.equals(this.functionVaddr, importedFunctionCallerEntry.functionVaddr) && + Objects.equals(this.stubVaddr, importedFunctionCallerEntry.stubVaddr); + } + + @Override + public int hashCode() { + return Objects.hash(functionId, functionName, functionVaddr, stubVaddr); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImportedFunctionCallerEntry {\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" functionVaddr: ").append(toIndentedString(functionVaddr)).append("\n"); + sb.append(" stubVaddr: ").append(toIndentedString(stubVaddr)).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", "function_name", "function_vaddr", "stub_vaddr")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_id", "function_name", "function_vaddr", "stub_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 ImportedFunctionCallerEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImportedFunctionCallerEntry.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 ImportedFunctionCallerEntry is not found in the empty JSON string", ImportedFunctionCallerEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImportedFunctionCallerEntry.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 `ImportedFunctionCallerEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImportedFunctionCallerEntry.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("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImportedFunctionCallerEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImportedFunctionCallerEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImportedFunctionCallerEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImportedFunctionCallerEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImportedFunctionCallerEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImportedFunctionCallerEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImportedFunctionCallerEntry + * @throws IOException if the JSON string is invalid with respect to ImportedFunctionCallerEntry + */ + public static ImportedFunctionCallerEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImportedFunctionCallerEntry.class); + } + + /** + * Convert an instance of ImportedFunctionCallerEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ImportedFunctionDetailOutputBody.java b/src/main/java/ai/reveng/model/ImportedFunctionDetailOutputBody.java new file mode 100644 index 0000000..5464269 --- /dev/null +++ b/src/main/java/ai/reveng/model/ImportedFunctionDetailOutputBody.java @@ -0,0 +1,460 @@ +/* + * 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.ImportedFunctionCallerEntry; +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; + +/** + * ImportedFunctionDetailOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ImportedFunctionDetailOutputBody { + public static final String SERIALIZED_NAME_CALLERS = "callers"; + @SerializedName(SERIALIZED_NAME_CALLERS) + @javax.annotation.Nullable + private List callers; + + public static final String SERIALIZED_NAME_IMPORTED_FUNCTION_ID = "imported_function_id"; + @SerializedName(SERIALIZED_NAME_IMPORTED_FUNCTION_ID) + @javax.annotation.Nonnull + private Long importedFunctionId; + + public static final String SERIALIZED_NAME_IS_FUNCTION = "is_function"; + @SerializedName(SERIALIZED_NAME_IS_FUNCTION) + @javax.annotation.Nonnull + private Boolean isFunction; + + public static final String SERIALIZED_NAME_LIBRARY_NAME = "library_name"; + @SerializedName(SERIALIZED_NAME_LIBRARY_NAME) + @javax.annotation.Nonnull + private String libraryName; + + public static final String SERIALIZED_NAME_LIBRARY_VERSION = "library_version"; + @SerializedName(SERIALIZED_NAME_LIBRARY_VERSION) + @javax.annotation.Nullable + private String libraryVersion; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ORIGINAL_NAME = "original_name"; + @SerializedName(SERIALIZED_NAME_ORIGINAL_NAME) + @javax.annotation.Nullable + private String originalName; + + public static final String SERIALIZED_NAME_STUB_VADDRS = "stub_vaddrs"; + @SerializedName(SERIALIZED_NAME_STUB_VADDRS) + @javax.annotation.Nullable + private List stubVaddrs; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nullable + private Long vaddr; + + public ImportedFunctionDetailOutputBody() { + } + + public ImportedFunctionDetailOutputBody callers(@javax.annotation.Nullable List callers) { + this.callers = callers; + return this; + } + + public ImportedFunctionDetailOutputBody addCallersItem(ImportedFunctionCallerEntry callersItem) { + if (this.callers == null) { + this.callers = new ArrayList<>(); + } + this.callers.add(callersItem); + return this; + } + + /** + * Internal functions that call this import, resolved via its PLT/stub addresses. + * @return callers + */ + @javax.annotation.Nullable + public List getCallers() { + return callers; + } + + public void setCallers(@javax.annotation.Nullable List callers) { + this.callers = callers; + } + + + public ImportedFunctionDetailOutputBody importedFunctionId(@javax.annotation.Nonnull Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + return this; + } + + /** + * Get importedFunctionId + * @return importedFunctionId + */ + @javax.annotation.Nonnull + public Long getImportedFunctionId() { + return importedFunctionId; + } + + public void setImportedFunctionId(@javax.annotation.Nonnull Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + } + + + public ImportedFunctionDetailOutputBody isFunction(@javax.annotation.Nonnull Boolean isFunction) { + this.isFunction = isFunction; + return this; + } + + /** + * False for imported data symbols. + * @return isFunction + */ + @javax.annotation.Nonnull + public Boolean getIsFunction() { + return isFunction; + } + + public void setIsFunction(@javax.annotation.Nonnull Boolean isFunction) { + this.isFunction = isFunction; + } + + + public ImportedFunctionDetailOutputBody libraryName(@javax.annotation.Nonnull String libraryName) { + this.libraryName = libraryName; + return this; + } + + /** + * Library the symbol is imported from. '<EXTERNAL>' for unattributed imports. + * @return libraryName + */ + @javax.annotation.Nonnull + public String getLibraryName() { + return libraryName; + } + + public void setLibraryName(@javax.annotation.Nonnull String libraryName) { + this.libraryName = libraryName; + } + + + public ImportedFunctionDetailOutputBody libraryVersion(@javax.annotation.Nullable String libraryVersion) { + this.libraryVersion = libraryVersion; + return this; + } + + /** + * Versioned symbol tag, when the loader records one. + * @return libraryVersion + */ + @javax.annotation.Nullable + public String getLibraryVersion() { + return libraryVersion; + } + + public void setLibraryVersion(@javax.annotation.Nullable String libraryVersion) { + this.libraryVersion = libraryVersion; + } + + + public ImportedFunctionDetailOutputBody name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ImportedFunctionDetailOutputBody originalName(@javax.annotation.Nullable String originalName) { + this.originalName = originalName; + return this; + } + + /** + * Pre-demangling / pre-aliasing name, when it differs from name. + * @return originalName + */ + @javax.annotation.Nullable + public String getOriginalName() { + return originalName; + } + + public void setOriginalName(@javax.annotation.Nullable String originalName) { + this.originalName = originalName; + } + + + public ImportedFunctionDetailOutputBody stubVaddrs(@javax.annotation.Nullable List stubVaddrs) { + this.stubVaddrs = stubVaddrs; + return this; + } + + public ImportedFunctionDetailOutputBody addStubVaddrsItem(Long stubVaddrsItem) { + if (this.stubVaddrs == null) { + this.stubVaddrs = new ArrayList<>(); + } + this.stubVaddrs.add(stubVaddrsItem); + return this; + } + + /** + * PLT/stub addresses that resolve external call edges (function_call_edges.callee_vaddr) to this import. Use these to link a caller's external callee to this import. + * @return stubVaddrs + */ + @javax.annotation.Nullable + public List getStubVaddrs() { + return stubVaddrs; + } + + public void setStubVaddrs(@javax.annotation.Nullable List stubVaddrs) { + this.stubVaddrs = stubVaddrs; + } + + + public ImportedFunctionDetailOutputBody vaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * Virtual address of the import, when known. + * @return vaddr + */ + @javax.annotation.Nullable + public Long getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImportedFunctionDetailOutputBody importedFunctionDetailOutputBody = (ImportedFunctionDetailOutputBody) o; + return Objects.equals(this.callers, importedFunctionDetailOutputBody.callers) && + Objects.equals(this.importedFunctionId, importedFunctionDetailOutputBody.importedFunctionId) && + Objects.equals(this.isFunction, importedFunctionDetailOutputBody.isFunction) && + Objects.equals(this.libraryName, importedFunctionDetailOutputBody.libraryName) && + Objects.equals(this.libraryVersion, importedFunctionDetailOutputBody.libraryVersion) && + Objects.equals(this.name, importedFunctionDetailOutputBody.name) && + Objects.equals(this.originalName, importedFunctionDetailOutputBody.originalName) && + Objects.equals(this.stubVaddrs, importedFunctionDetailOutputBody.stubVaddrs) && + Objects.equals(this.vaddr, importedFunctionDetailOutputBody.vaddr); + } + + @Override + public int hashCode() { + return Objects.hash(callers, importedFunctionId, isFunction, libraryName, libraryVersion, name, originalName, stubVaddrs, vaddr); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImportedFunctionDetailOutputBody {\n"); + sb.append(" callers: ").append(toIndentedString(callers)).append("\n"); + sb.append(" importedFunctionId: ").append(toIndentedString(importedFunctionId)).append("\n"); + sb.append(" isFunction: ").append(toIndentedString(isFunction)).append("\n"); + sb.append(" libraryName: ").append(toIndentedString(libraryName)).append("\n"); + sb.append(" libraryVersion: ").append(toIndentedString(libraryVersion)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" originalName: ").append(toIndentedString(originalName)).append("\n"); + sb.append(" stubVaddrs: ").append(toIndentedString(stubVaddrs)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).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("callers", "imported_function_id", "is_function", "library_name", "library_version", "name", "original_name", "stub_vaddrs", "vaddr")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("callers", "imported_function_id", "is_function", "library_name", "name", "stub_vaddrs")); + } + + /** + * 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 ImportedFunctionDetailOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImportedFunctionDetailOutputBody.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 ImportedFunctionDetailOutputBody is not found in the empty JSON string", ImportedFunctionDetailOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImportedFunctionDetailOutputBody.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 `ImportedFunctionDetailOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImportedFunctionDetailOutputBody.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("callers") != null && !jsonObj.get("callers").isJsonNull()) { + if (!jsonObj.get("callers").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `callers` to be an array in the JSON string but got `%s`", jsonObj.get("callers").toString())); + } + JsonArray jsonArraycallers = jsonObj.getAsJsonArray("callers"); + // validate the required field `callers` (array) + for (int i = 0; i < jsonArraycallers.size(); i++) { + ImportedFunctionCallerEntry.validateJsonElement(jsonArraycallers.get(i)); + } + } + if (!jsonObj.get("library_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `library_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_name").toString())); + } + if ((jsonObj.get("library_version") != null && !jsonObj.get("library_version").isJsonNull()) && !jsonObj.get("library_version").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `library_version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_version").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())); + } + if ((jsonObj.get("original_name") != null && !jsonObj.get("original_name").isJsonNull()) && !jsonObj.get("original_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `original_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("original_name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("stub_vaddrs") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("stub_vaddrs").isJsonArray() && !jsonObj.get("stub_vaddrs").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `stub_vaddrs` to be an array in the JSON string but got `%s`", jsonObj.get("stub_vaddrs").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImportedFunctionDetailOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImportedFunctionDetailOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImportedFunctionDetailOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImportedFunctionDetailOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImportedFunctionDetailOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImportedFunctionDetailOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImportedFunctionDetailOutputBody + * @throws IOException if the JSON string is invalid with respect to ImportedFunctionDetailOutputBody + */ + public static ImportedFunctionDetailOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImportedFunctionDetailOutputBody.class); + } + + /** + * Convert an instance of ImportedFunctionDetailOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ImportedFunctionEntry.java b/src/main/java/ai/reveng/model/ImportedFunctionEntry.java new file mode 100644 index 0000000..bd7d72d --- /dev/null +++ b/src/main/java/ai/reveng/model/ImportedFunctionEntry.java @@ -0,0 +1,496 @@ +/* + * 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; + +/** + * ImportedFunctionEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ImportedFunctionEntry { + public static final String SERIALIZED_NAME_IMPORTED_FUNCTION_ID = "imported_function_id"; + @SerializedName(SERIALIZED_NAME_IMPORTED_FUNCTION_ID) + @javax.annotation.Nonnull + private Long importedFunctionId; + + public static final String SERIALIZED_NAME_IS_FUNCTION = "is_function"; + @SerializedName(SERIALIZED_NAME_IS_FUNCTION) + @javax.annotation.Nonnull + private Boolean isFunction; + + public static final String SERIALIZED_NAME_LIBRARY_NAME = "library_name"; + @SerializedName(SERIALIZED_NAME_LIBRARY_NAME) + @javax.annotation.Nonnull + private String libraryName; + + public static final String SERIALIZED_NAME_LIBRARY_VERSION = "library_version"; + @SerializedName(SERIALIZED_NAME_LIBRARY_VERSION) + @javax.annotation.Nullable + private String libraryVersion; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ORIGINAL_NAME = "original_name"; + @SerializedName(SERIALIZED_NAME_ORIGINAL_NAME) + @javax.annotation.Nullable + private String originalName; + + public static final String SERIALIZED_NAME_STUB_VADDRS = "stub_vaddrs"; + @SerializedName(SERIALIZED_NAME_STUB_VADDRS) + @javax.annotation.Nullable + private List stubVaddrs; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nullable + private Long vaddr; + + public ImportedFunctionEntry() { + } + + public ImportedFunctionEntry importedFunctionId(@javax.annotation.Nonnull Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + return this; + } + + /** + * Get importedFunctionId + * @return importedFunctionId + */ + @javax.annotation.Nonnull + public Long getImportedFunctionId() { + return importedFunctionId; + } + + public void setImportedFunctionId(@javax.annotation.Nonnull Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + } + + + public ImportedFunctionEntry isFunction(@javax.annotation.Nonnull Boolean isFunction) { + this.isFunction = isFunction; + return this; + } + + /** + * False for imported data symbols. + * @return isFunction + */ + @javax.annotation.Nonnull + public Boolean getIsFunction() { + return isFunction; + } + + public void setIsFunction(@javax.annotation.Nonnull Boolean isFunction) { + this.isFunction = isFunction; + } + + + public ImportedFunctionEntry libraryName(@javax.annotation.Nonnull String libraryName) { + this.libraryName = libraryName; + return this; + } + + /** + * Library the symbol is imported from. '<EXTERNAL>' for unattributed imports. + * @return libraryName + */ + @javax.annotation.Nonnull + public String getLibraryName() { + return libraryName; + } + + public void setLibraryName(@javax.annotation.Nonnull String libraryName) { + this.libraryName = libraryName; + } + + + public ImportedFunctionEntry libraryVersion(@javax.annotation.Nullable String libraryVersion) { + this.libraryVersion = libraryVersion; + return this; + } + + /** + * Versioned symbol tag, when the loader records one. + * @return libraryVersion + */ + @javax.annotation.Nullable + public String getLibraryVersion() { + return libraryVersion; + } + + public void setLibraryVersion(@javax.annotation.Nullable String libraryVersion) { + this.libraryVersion = libraryVersion; + } + + + public ImportedFunctionEntry name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ImportedFunctionEntry originalName(@javax.annotation.Nullable String originalName) { + this.originalName = originalName; + return this; + } + + /** + * Pre-demangling / pre-aliasing name, when it differs from name. + * @return originalName + */ + @javax.annotation.Nullable + public String getOriginalName() { + return originalName; + } + + public void setOriginalName(@javax.annotation.Nullable String originalName) { + this.originalName = originalName; + } + + + public ImportedFunctionEntry stubVaddrs(@javax.annotation.Nullable List stubVaddrs) { + this.stubVaddrs = stubVaddrs; + return this; + } + + public ImportedFunctionEntry addStubVaddrsItem(Long stubVaddrsItem) { + if (this.stubVaddrs == null) { + this.stubVaddrs = new ArrayList<>(); + } + this.stubVaddrs.add(stubVaddrsItem); + return this; + } + + /** + * PLT/stub addresses that resolve external call edges (function_call_edges.callee_vaddr) to this import. Use these to link a caller's external callee to this import. + * @return stubVaddrs + */ + @javax.annotation.Nullable + public List getStubVaddrs() { + return stubVaddrs; + } + + public void setStubVaddrs(@javax.annotation.Nullable List stubVaddrs) { + this.stubVaddrs = stubVaddrs; + } + + + public ImportedFunctionEntry vaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * Virtual address of the import, when known. + * @return vaddr + */ + @javax.annotation.Nullable + public Long getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + } + + /** + * 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 ImportedFunctionEntry instance itself + */ + public ImportedFunctionEntry 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; + } + ImportedFunctionEntry importedFunctionEntry = (ImportedFunctionEntry) o; + return Objects.equals(this.importedFunctionId, importedFunctionEntry.importedFunctionId) && + Objects.equals(this.isFunction, importedFunctionEntry.isFunction) && + Objects.equals(this.libraryName, importedFunctionEntry.libraryName) && + Objects.equals(this.libraryVersion, importedFunctionEntry.libraryVersion) && + Objects.equals(this.name, importedFunctionEntry.name) && + Objects.equals(this.originalName, importedFunctionEntry.originalName) && + Objects.equals(this.stubVaddrs, importedFunctionEntry.stubVaddrs) && + Objects.equals(this.vaddr, importedFunctionEntry.vaddr)&& + Objects.equals(this.additionalProperties, importedFunctionEntry.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(importedFunctionId, isFunction, libraryName, libraryVersion, name, originalName, stubVaddrs, vaddr, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImportedFunctionEntry {\n"); + sb.append(" importedFunctionId: ").append(toIndentedString(importedFunctionId)).append("\n"); + sb.append(" isFunction: ").append(toIndentedString(isFunction)).append("\n"); + sb.append(" libraryName: ").append(toIndentedString(libraryName)).append("\n"); + sb.append(" libraryVersion: ").append(toIndentedString(libraryVersion)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" originalName: ").append(toIndentedString(originalName)).append("\n"); + sb.append(" stubVaddrs: ").append(toIndentedString(stubVaddrs)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).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("imported_function_id", "is_function", "library_name", "library_version", "name", "original_name", "stub_vaddrs", "vaddr")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("imported_function_id", "is_function", "library_name", "name", "stub_vaddrs")); + } + + /** + * 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 ImportedFunctionEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImportedFunctionEntry.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 ImportedFunctionEntry is not found in the empty JSON string", ImportedFunctionEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImportedFunctionEntry.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("library_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `library_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_name").toString())); + } + if ((jsonObj.get("library_version") != null && !jsonObj.get("library_version").isJsonNull()) && !jsonObj.get("library_version").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `library_version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_version").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())); + } + if ((jsonObj.get("original_name") != null && !jsonObj.get("original_name").isJsonNull()) && !jsonObj.get("original_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `original_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("original_name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("stub_vaddrs") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("stub_vaddrs").isJsonArray() && !jsonObj.get("stub_vaddrs").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `stub_vaddrs` to be an array in the JSON string but got `%s`", jsonObj.get("stub_vaddrs").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImportedFunctionEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImportedFunctionEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImportedFunctionEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImportedFunctionEntry 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 ImportedFunctionEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImportedFunctionEntry 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 ImportedFunctionEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImportedFunctionEntry + * @throws IOException if the JSON string is invalid with respect to ImportedFunctionEntry + */ + public static ImportedFunctionEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImportedFunctionEntry.class); + } + + /** + * Convert an instance of ImportedFunctionEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListArchiveContentsOutputBody.java b/src/main/java/ai/reveng/model/ListArchiveContentsOutputBody.java new file mode 100644 index 0000000..29f7f2b --- /dev/null +++ b/src/main/java/ai/reveng/model/ListArchiveContentsOutputBody.java @@ -0,0 +1,411 @@ +/* + * 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.ArchiveContentEntry; +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; + +/** + * ListArchiveContentsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListArchiveContentsOutputBody { + public static final String SERIALIZED_NAME_ENTRIES = "entries"; + @SerializedName(SERIALIZED_NAME_ENTRIES) + @javax.annotation.Nullable + private List entries; + + public static final String SERIALIZED_NAME_HAS_NEXT = "has_next"; + @SerializedName(SERIALIZED_NAME_HAS_NEXT) + @javax.annotation.Nonnull + private Boolean hasNext; + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + @javax.annotation.Nonnull + private Long page; + + 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_TOTAL_COUNT = "total_count"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private Long totalCount; + + public ListArchiveContentsOutputBody() { + } + + public ListArchiveContentsOutputBody entries(@javax.annotation.Nullable List entries) { + this.entries = entries; + return this; + } + + public ListArchiveContentsOutputBody addEntriesItem(ArchiveContentEntry entriesItem) { + if (this.entries == null) { + this.entries = new ArrayList<>(); + } + this.entries.add(entriesItem); + return this; + } + + /** + * Files inside the archive, with paths relative to the archive root + * @return entries + */ + @javax.annotation.Nullable + public List getEntries() { + return entries; + } + + public void setEntries(@javax.annotation.Nullable List entries) { + this.entries = entries; + } + + + public ListArchiveContentsOutputBody hasNext(@javax.annotation.Nonnull Boolean hasNext) { + this.hasNext = hasNext; + return this; + } + + /** + * Whether a further page of entries follows this one. + * @return hasNext + */ + @javax.annotation.Nonnull + public Boolean getHasNext() { + return hasNext; + } + + public void setHasNext(@javax.annotation.Nonnull Boolean hasNext) { + this.hasNext = hasNext; + } + + + public ListArchiveContentsOutputBody page(@javax.annotation.Nonnull Long page) { + this.page = page; + return this; + } + + /** + * Page number of this response (1-indexed). + * @return page + */ + @javax.annotation.Nonnull + public Long getPage() { + return page; + } + + public void setPage(@javax.annotation.Nonnull Long page) { + this.page = page; + } + + + public ListArchiveContentsOutputBody pageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Number of entries per page. + * @return pageSize + */ + @javax.annotation.Nonnull + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + } + + + public ListArchiveContentsOutputBody totalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of file entries in the archive, ignoring pagination. + * @return totalCount + */ + @javax.annotation.Nonnull + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + } + + /** + * 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 ListArchiveContentsOutputBody instance itself + */ + public ListArchiveContentsOutputBody 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; + } + ListArchiveContentsOutputBody listArchiveContentsOutputBody = (ListArchiveContentsOutputBody) o; + return Objects.equals(this.entries, listArchiveContentsOutputBody.entries) && + Objects.equals(this.hasNext, listArchiveContentsOutputBody.hasNext) && + Objects.equals(this.page, listArchiveContentsOutputBody.page) && + Objects.equals(this.pageSize, listArchiveContentsOutputBody.pageSize) && + Objects.equals(this.totalCount, listArchiveContentsOutputBody.totalCount)&& + Objects.equals(this.additionalProperties, listArchiveContentsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(entries, hasNext, page, pageSize, totalCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListArchiveContentsOutputBody {\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append(" hasNext: ").append(toIndentedString(hasNext)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).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("entries", "has_next", "page", "page_size", "total_count")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("entries", "has_next", "page", "page_size", "total_count")); + } + + /** + * 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 ListArchiveContentsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListArchiveContentsOutputBody.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 ListArchiveContentsOutputBody is not found in the empty JSON string", ListArchiveContentsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListArchiveContentsOutputBody.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("entries") != null && !jsonObj.get("entries").isJsonNull()) { + if (!jsonObj.get("entries").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `entries` to be an array in the JSON string but got `%s`", jsonObj.get("entries").toString())); + } + JsonArray jsonArrayentries = jsonObj.getAsJsonArray("entries"); + // validate the required field `entries` (array) + for (int i = 0; i < jsonArrayentries.size(); i++) { + ArchiveContentEntry.validateJsonElement(jsonArrayentries.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListArchiveContentsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListArchiveContentsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListArchiveContentsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListArchiveContentsOutputBody 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 ListArchiveContentsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListArchiveContentsOutputBody 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 ListArchiveContentsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListArchiveContentsOutputBody + * @throws IOException if the JSON string is invalid with respect to ListArchiveContentsOutputBody + */ + public static ListArchiveContentsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListArchiveContentsOutputBody.class); + } + + /** + * Convert an instance of ListArchiveContentsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListImportedFunctionsOutputBody.java b/src/main/java/ai/reveng/model/ListImportedFunctionsOutputBody.java new file mode 100644 index 0000000..c565c36 --- /dev/null +++ b/src/main/java/ai/reveng/model/ListImportedFunctionsOutputBody.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.ImportedFunctionEntry; +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; + +/** + * ListImportedFunctionsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListImportedFunctionsOutputBody { + public static final String SERIALIZED_NAME_IMPORTED_FUNCTIONS = "imported_functions"; + @SerializedName(SERIALIZED_NAME_IMPORTED_FUNCTIONS) + @javax.annotation.Nullable + private List importedFunctions; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "total_count"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private Long totalCount; + + public ListImportedFunctionsOutputBody() { + } + + public ListImportedFunctionsOutputBody importedFunctions(@javax.annotation.Nullable List importedFunctions) { + this.importedFunctions = importedFunctions; + return this; + } + + public ListImportedFunctionsOutputBody addImportedFunctionsItem(ImportedFunctionEntry importedFunctionsItem) { + if (this.importedFunctions == null) { + this.importedFunctions = new ArrayList<>(); + } + this.importedFunctions.add(importedFunctionsItem); + return this; + } + + /** + * Get importedFunctions + * @return importedFunctions + */ + @javax.annotation.Nullable + public List getImportedFunctions() { + return importedFunctions; + } + + public void setImportedFunctions(@javax.annotation.Nullable List importedFunctions) { + this.importedFunctions = importedFunctions; + } + + + public ListImportedFunctionsOutputBody totalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total imported functions for the binary, ignoring pagination. + * @return totalCount + */ + @javax.annotation.Nonnull + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListImportedFunctionsOutputBody listImportedFunctionsOutputBody = (ListImportedFunctionsOutputBody) o; + return Objects.equals(this.importedFunctions, listImportedFunctionsOutputBody.importedFunctions) && + Objects.equals(this.totalCount, listImportedFunctionsOutputBody.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(importedFunctions, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListImportedFunctionsOutputBody {\n"); + sb.append(" importedFunctions: ").append(toIndentedString(importedFunctions)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).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("imported_functions", "total_count")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("imported_functions", "total_count")); + } + + /** + * 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 ListImportedFunctionsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListImportedFunctionsOutputBody.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 ListImportedFunctionsOutputBody is not found in the empty JSON string", ListImportedFunctionsOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListImportedFunctionsOutputBody.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 `ListImportedFunctionsOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListImportedFunctionsOutputBody.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("imported_functions") != null && !jsonObj.get("imported_functions").isJsonNull()) { + if (!jsonObj.get("imported_functions").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `imported_functions` to be an array in the JSON string but got `%s`", jsonObj.get("imported_functions").toString())); + } + JsonArray jsonArrayimportedFunctions = jsonObj.getAsJsonArray("imported_functions"); + // validate the required field `imported_functions` (array) + for (int i = 0; i < jsonArrayimportedFunctions.size(); i++) { + ImportedFunctionEntry.validateJsonElement(jsonArrayimportedFunctions.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListImportedFunctionsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListImportedFunctionsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListImportedFunctionsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListImportedFunctionsOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListImportedFunctionsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListImportedFunctionsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListImportedFunctionsOutputBody + * @throws IOException if the JSON string is invalid with respect to ListImportedFunctionsOutputBody + */ + public static ListImportedFunctionsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListImportedFunctionsOutputBody.class); + } + + /** + * Convert an instance of ListImportedFunctionsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StartMatchingForAnalysisInputBody.java b/src/main/java/ai/reveng/model/StartMatchingForAnalysisInputBody.java index bcd265d..5ed7774 100644 --- a/src/main/java/ai/reveng/model/StartMatchingForAnalysisInputBody.java +++ b/src/main/java/ai/reveng/model/StartMatchingForAnalysisInputBody.java @@ -60,6 +60,11 @@ public class StartMatchingForAnalysisInputBody { @javax.annotation.Nullable private Double minSimilarity; + public static final String SERIALIZED_NAME_NO_CACHE = "no_cache"; + @SerializedName(SERIALIZED_NAME_NO_CACHE) + @javax.annotation.Nullable + private Boolean noCache; + public static final String SERIALIZED_NAME_RESULTS_PER_FUNCTION = "results_per_function"; @SerializedName(SERIALIZED_NAME_RESULTS_PER_FUNCTION) @javax.annotation.Nullable @@ -108,6 +113,25 @@ public void setMinSimilarity(@javax.annotation.Nullable Double minSimilarity) { } + public StartMatchingForAnalysisInputBody noCache(@javax.annotation.Nullable Boolean noCache) { + this.noCache = noCache; + return this; + } + + /** + * By default a completed matching run for the same request is reused (response status=COMPLETED, no new run). Set true to force a fresh run. + * @return noCache + */ + @javax.annotation.Nullable + public Boolean getNoCache() { + return noCache; + } + + public void setNoCache(@javax.annotation.Nullable Boolean noCache) { + this.noCache = noCache; + } + + public StartMatchingForAnalysisInputBody resultsPerFunction(@javax.annotation.Nullable Long resultsPerFunction) { this.resultsPerFunction = resultsPerFunction; return this; @@ -128,6 +152,50 @@ public void setResultsPerFunction(@javax.annotation.Nullable Long resultsPerFunc this.resultsPerFunction = resultsPerFunction; } + /** + * 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 StartMatchingForAnalysisInputBody instance itself + */ + public StartMatchingForAnalysisInputBody 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 @@ -141,12 +209,14 @@ public boolean equals(Object o) { StartMatchingForAnalysisInputBody startMatchingForAnalysisInputBody = (StartMatchingForAnalysisInputBody) o; return Objects.equals(this.filters, startMatchingForAnalysisInputBody.filters) && Objects.equals(this.minSimilarity, startMatchingForAnalysisInputBody.minSimilarity) && - Objects.equals(this.resultsPerFunction, startMatchingForAnalysisInputBody.resultsPerFunction); + Objects.equals(this.noCache, startMatchingForAnalysisInputBody.noCache) && + Objects.equals(this.resultsPerFunction, startMatchingForAnalysisInputBody.resultsPerFunction)&& + Objects.equals(this.additionalProperties, startMatchingForAnalysisInputBody.additionalProperties); } @Override public int hashCode() { - return Objects.hash(filters, minSimilarity, resultsPerFunction); + return Objects.hash(filters, minSimilarity, noCache, resultsPerFunction, additionalProperties); } @Override @@ -155,7 +225,9 @@ public String toString() { sb.append("class StartMatchingForAnalysisInputBody {\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); sb.append(" minSimilarity: ").append(toIndentedString(minSimilarity)).append("\n"); + sb.append(" noCache: ").append(toIndentedString(noCache)).append("\n"); sb.append(" resultsPerFunction: ").append(toIndentedString(resultsPerFunction)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -174,7 +246,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("filters", "min_similarity", "results_per_function")); + openapiFields = new HashSet(Arrays.asList("filters", "min_similarity", "no_cache", "results_per_function")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -192,14 +264,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in StartMatchingForAnalysisInputBody is not found in the empty JSON string", StartMatchingForAnalysisInputBody.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!StartMatchingForAnalysisInputBody.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 `StartMatchingForAnalysisInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `filters` if (jsonObj.get("filters") != null && !jsonObj.get("filters").isJsonNull()) { @@ -222,6 +286,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, StartMatchingForAnalysisInputBody 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); } @@ -229,7 +315,28 @@ public void write(JsonWriter out, StartMatchingForAnalysisInputBody value) throw public StartMatchingForAnalysisInputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StartMatchingForAnalysisInputBody 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(); diff --git a/src/main/java/ai/reveng/model/StartMatchingForFunctionsInputBody.java b/src/main/java/ai/reveng/model/StartMatchingForFunctionsInputBody.java index 780f757..b354ee3 100644 --- a/src/main/java/ai/reveng/model/StartMatchingForFunctionsInputBody.java +++ b/src/main/java/ai/reveng/model/StartMatchingForFunctionsInputBody.java @@ -67,6 +67,11 @@ public class StartMatchingForFunctionsInputBody { @javax.annotation.Nullable private Double minSimilarity; + public static final String SERIALIZED_NAME_NO_CACHE = "no_cache"; + @SerializedName(SERIALIZED_NAME_NO_CACHE) + @javax.annotation.Nullable + private Boolean noCache; + public static final String SERIALIZED_NAME_RESULTS_PER_FUNCTION = "results_per_function"; @SerializedName(SERIALIZED_NAME_RESULTS_PER_FUNCTION) @javax.annotation.Nullable @@ -147,6 +152,25 @@ public void setMinSimilarity(@javax.annotation.Nullable Double minSimilarity) { } + public StartMatchingForFunctionsInputBody noCache(@javax.annotation.Nullable Boolean noCache) { + this.noCache = noCache; + return this; + } + + /** + * By default a completed matching run for the same request is reused (response status=COMPLETED, no new run). Set true to force a fresh run. + * @return noCache + */ + @javax.annotation.Nullable + public Boolean getNoCache() { + return noCache; + } + + public void setNoCache(@javax.annotation.Nullable Boolean noCache) { + this.noCache = noCache; + } + + public StartMatchingForFunctionsInputBody resultsPerFunction(@javax.annotation.Nullable Long resultsPerFunction) { this.resultsPerFunction = resultsPerFunction; return this; @@ -244,6 +268,7 @@ public boolean equals(Object o) { return Objects.equals(this.filters, startMatchingForFunctionsInputBody.filters) && Objects.equals(this.functionIds, startMatchingForFunctionsInputBody.functionIds) && Objects.equals(this.minSimilarity, startMatchingForFunctionsInputBody.minSimilarity) && + Objects.equals(this.noCache, startMatchingForFunctionsInputBody.noCache) && Objects.equals(this.resultsPerFunction, startMatchingForFunctionsInputBody.resultsPerFunction) && Objects.equals(this.useCanonicalNames, startMatchingForFunctionsInputBody.useCanonicalNames)&& Objects.equals(this.additionalProperties, startMatchingForFunctionsInputBody.additionalProperties); @@ -251,7 +276,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(filters, functionIds, minSimilarity, resultsPerFunction, useCanonicalNames, additionalProperties); + return Objects.hash(filters, functionIds, minSimilarity, noCache, resultsPerFunction, useCanonicalNames, additionalProperties); } @Override @@ -261,6 +286,7 @@ public String toString() { sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); sb.append(" functionIds: ").append(toIndentedString(functionIds)).append("\n"); sb.append(" minSimilarity: ").append(toIndentedString(minSimilarity)).append("\n"); + sb.append(" noCache: ").append(toIndentedString(noCache)).append("\n"); sb.append(" resultsPerFunction: ").append(toIndentedString(resultsPerFunction)).append("\n"); sb.append(" useCanonicalNames: ").append(toIndentedString(useCanonicalNames)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -282,7 +308,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("filters", "function_ids", "min_similarity", "results_per_function", "use_canonical_names")); + openapiFields = new HashSet(Arrays.asList("filters", "function_ids", "min_similarity", "no_cache", "results_per_function", "use_canonical_names")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("function_ids")); diff --git a/src/main/java/ai/reveng/model/StartMatchingOutputBody.java b/src/main/java/ai/reveng/model/StartMatchingOutputBody.java index 2b3730f..6a70827 100644 --- a/src/main/java/ai/reveng/model/StartMatchingOutputBody.java +++ b/src/main/java/ai/reveng/model/StartMatchingOutputBody.java @@ -52,6 +52,11 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class StartMatchingOutputBody { + public static final String SERIALIZED_NAME_MATCH_ID = "match_id"; + @SerializedName(SERIALIZED_NAME_MATCH_ID) + @javax.annotation.Nonnull + private String matchId; + public static final String SERIALIZED_NAME_MESSAGES = "messages"; @SerializedName(SERIALIZED_NAME_MESSAGES) @javax.annotation.Nullable @@ -140,6 +145,25 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public StartMatchingOutputBody() { } + public StartMatchingOutputBody matchId(@javax.annotation.Nonnull String matchId) { + this.matchId = matchId; + return this; + } + + /** + * Opaque token for this matching run. Pass it to the GET/status endpoints' match_id query parameter to fetch this exact run. + * @return matchId + */ + @javax.annotation.Nonnull + public String getMatchId() { + return matchId; + } + + public void setMatchId(@javax.annotation.Nonnull String matchId) { + this.matchId = matchId; + } + + public StartMatchingOutputBody messages(@javax.annotation.Nullable List messages) { this.messages = messages; return this; @@ -253,7 +277,8 @@ public boolean equals(Object o) { return false; } StartMatchingOutputBody startMatchingOutputBody = (StartMatchingOutputBody) o; - return Objects.equals(this.messages, startMatchingOutputBody.messages) && + return Objects.equals(this.matchId, startMatchingOutputBody.matchId) && + Objects.equals(this.messages, startMatchingOutputBody.messages) && Objects.equals(this.status, startMatchingOutputBody.status) && Objects.equals(this.step, startMatchingOutputBody.step) && Objects.equals(this.stepIndex, startMatchingOutputBody.stepIndex) && @@ -262,13 +287,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(messages, status, step, stepIndex, stepsTotal); + return Objects.hash(matchId, messages, status, step, stepIndex, stepsTotal); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class StartMatchingOutputBody {\n"); + sb.append(" matchId: ").append(toIndentedString(matchId)).append("\n"); sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" step: ").append(toIndentedString(step)).append("\n"); @@ -292,10 +318,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("messages", "status", "step", "step_index", "steps_total")); + openapiFields = new HashSet(Arrays.asList("match_id", "messages", "status", "step", "step_index", "steps_total")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("messages", "status", "step", "step_index", "steps_total")); + openapiRequiredFields = new HashSet(Arrays.asList("match_id", "messages", "status", "step", "step_index", "steps_total")); } /** @@ -326,6 +352,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("match_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `match_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("match_id").toString())); + } if (jsonObj.get("messages") != null && !jsonObj.get("messages").isJsonNull()) { if (!jsonObj.get("messages").isJsonArray()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); diff --git a/src/main/java/ai/reveng/model/TriggerDynamicExecutionInputBody.java b/src/main/java/ai/reveng/model/TriggerDynamicExecutionInputBody.java index 13c5735..798bd5d 100644 --- a/src/main/java/ai/reveng/model/TriggerDynamicExecutionInputBody.java +++ b/src/main/java/ai/reveng/model/TriggerDynamicExecutionInputBody.java @@ -49,6 +49,21 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TriggerDynamicExecutionInputBody { + public static final String SERIALIZED_NAME_ARCHIVE_ENTRY_PATH = "archive_entry_path"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_ENTRY_PATH) + @javax.annotation.Nullable + private String archiveEntryPath; + + public static final String SERIALIZED_NAME_ARCHIVE_PASSWORD = "archive_password"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_PASSWORD) + @javax.annotation.Nullable + private String archivePassword; + + public static final String SERIALIZED_NAME_ARCHIVE_SHA256_HASH = "archive_sha_256_hash"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_SHA256_HASH) + @javax.annotation.Nullable + private String archiveSha256Hash; + public static final String SERIALIZED_NAME_COMMAND_LINE_ARGS = "command_line_args"; @SerializedName(SERIALIZED_NAME_COMMAND_LINE_ARGS) @javax.annotation.Nullable @@ -179,6 +194,63 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public TriggerDynamicExecutionInputBody() { } + public TriggerDynamicExecutionInputBody archiveEntryPath(@javax.annotation.Nullable String archiveEntryPath) { + this.archiveEntryPath = archiveEntryPath; + return this; + } + + /** + * Relative path of the entry inside the archive to execute + * @return archiveEntryPath + */ + @javax.annotation.Nullable + public String getArchiveEntryPath() { + return archiveEntryPath; + } + + public void setArchiveEntryPath(@javax.annotation.Nullable String archiveEntryPath) { + this.archiveEntryPath = archiveEntryPath; + } + + + public TriggerDynamicExecutionInputBody archivePassword(@javax.annotation.Nullable String archivePassword) { + this.archivePassword = archivePassword; + return this; + } + + /** + * Password for an encrypted archive + * @return archivePassword + */ + @javax.annotation.Nullable + public String getArchivePassword() { + return archivePassword; + } + + public void setArchivePassword(@javax.annotation.Nullable String archivePassword) { + this.archivePassword = archivePassword; + } + + + public TriggerDynamicExecutionInputBody archiveSha256Hash(@javax.annotation.Nullable String archiveSha256Hash) { + this.archiveSha256Hash = archiveSha256Hash; + return this; + } + + /** + * SHA-256 of the archive object to send to the sandbox instead of the analysed binary + * @return archiveSha256Hash + */ + @javax.annotation.Nullable + public String getArchiveSha256Hash() { + return archiveSha256Hash; + } + + public void setArchiveSha256Hash(@javax.annotation.Nullable String archiveSha256Hash) { + this.archiveSha256Hash = archiveSha256Hash; + } + + public TriggerDynamicExecutionInputBody commandLineArgs(@javax.annotation.Nullable String commandLineArgs) { this.commandLineArgs = commandLineArgs; return this; @@ -290,7 +362,10 @@ public boolean equals(Object o) { return false; } TriggerDynamicExecutionInputBody triggerDynamicExecutionInputBody = (TriggerDynamicExecutionInputBody) o; - return Objects.equals(this.commandLineArgs, triggerDynamicExecutionInputBody.commandLineArgs) && + return Objects.equals(this.archiveEntryPath, triggerDynamicExecutionInputBody.archiveEntryPath) && + Objects.equals(this.archivePassword, triggerDynamicExecutionInputBody.archivePassword) && + Objects.equals(this.archiveSha256Hash, triggerDynamicExecutionInputBody.archiveSha256Hash) && + Objects.equals(this.commandLineArgs, triggerDynamicExecutionInputBody.commandLineArgs) && Objects.equals(this.startMethod, triggerDynamicExecutionInputBody.startMethod) && Objects.equals(this.timeout, triggerDynamicExecutionInputBody.timeout)&& Objects.equals(this.additionalProperties, triggerDynamicExecutionInputBody.additionalProperties); @@ -298,13 +373,16 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(commandLineArgs, startMethod, timeout, additionalProperties); + return Objects.hash(archiveEntryPath, archivePassword, archiveSha256Hash, commandLineArgs, startMethod, timeout, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TriggerDynamicExecutionInputBody {\n"); + sb.append(" archiveEntryPath: ").append(toIndentedString(archiveEntryPath)).append("\n"); + sb.append(" archivePassword: ").append(toIndentedString(archivePassword)).append("\n"); + sb.append(" archiveSha256Hash: ").append(toIndentedString(archiveSha256Hash)).append("\n"); sb.append(" commandLineArgs: ").append(toIndentedString(commandLineArgs)).append("\n"); sb.append(" startMethod: ").append(toIndentedString(startMethod)).append("\n"); sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); @@ -327,7 +405,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("command_line_args", "start_method", "timeout")); + openapiFields = new HashSet(Arrays.asList("archive_entry_path", "archive_password", "archive_sha_256_hash", "command_line_args", "start_method", "timeout")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -346,6 +424,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("archive_entry_path") != null && !jsonObj.get("archive_entry_path").isJsonNull()) && !jsonObj.get("archive_entry_path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `archive_entry_path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archive_entry_path").toString())); + } + if ((jsonObj.get("archive_password") != null && !jsonObj.get("archive_password").isJsonNull()) && !jsonObj.get("archive_password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `archive_password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archive_password").toString())); + } + if ((jsonObj.get("archive_sha_256_hash") != null && !jsonObj.get("archive_sha_256_hash").isJsonNull()) && !jsonObj.get("archive_sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `archive_sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archive_sha_256_hash").toString())); + } if ((jsonObj.get("command_line_args") != null && !jsonObj.get("command_line_args").isJsonNull()) && !jsonObj.get("command_line_args").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `command_line_args` to be a primitive type in the JSON string but got `%s`", jsonObj.get("command_line_args").toString())); }