From 1179bf81ff6d032ea0e08cfbd94b7ab802aa0610 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Aug 2026 07:16:38 +0000 Subject: [PATCH] Update SDK to version v4.5.0 - Generated from OpenAPI spec version v4.5.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 18 +- build.gradle | 4 +- build.sbt | 2 +- docs/AgentApi.md | 236 +++++++++ docs/EventNamesFinished.md | 25 + docs/ExtractedBinary.md | 15 + docs/InputBody.md | 13 + docs/NamesFinishedEvent.md | 16 + ...nSecurityScanMetadataSecurityScanResult.md | 17 + docs/OperationWorkflowProgressResultBody.md | 17 + docs/RenameInputBody.md | 1 - docs/ResultBody.md | 16 + docs/SecurityScanMetadata.md | 27 ++ docs/SecurityScanResult.md | 19 + docs/Status.md | 79 +++ docs/TriggerSecurityScanInputBody.md | 13 + pom.xml | 2 +- src/main/java/ai/reveng/api/AgentApi.java | 441 +++++++++++++++++ .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 11 + .../ai/reveng/model/EventNamesFinished.java | 424 ++++++++++++++++ .../java/ai/reveng/model/ExtractedBinary.java | 344 +++++++++++++ src/main/java/ai/reveng/model/InputBody.java | 282 +++++++++++ .../ai/reveng/model/NamesFinishedEvent.java | 286 +++++++++++ ...ecurityScanMetadataSecurityScanResult.java | 408 ++++++++++++++++ .../OperationWorkflowProgressResultBody.java | 408 ++++++++++++++++ .../java/ai/reveng/model/RenameInputBody.java | 32 +- src/main/java/ai/reveng/model/ResultBody.java | 395 +++++++++++++++ .../ai/reveng/model/SecurityScanMetadata.java | 322 ++++++++++++ .../ai/reveng/model/SecurityScanResult.java | 455 +++++++++++++++++ .../reveng/model/ServerSentEventsInner1.java | 58 ++- src/main/java/ai/reveng/model/Status.java | 457 ++++++++++++++++++ .../model/TriggerSecurityScanInputBody.java | 199 ++++++++ 35 files changed, 5003 insertions(+), 45 deletions(-) create mode 100644 docs/EventNamesFinished.md create mode 100644 docs/ExtractedBinary.md create mode 100644 docs/InputBody.md create mode 100644 docs/NamesFinishedEvent.md create mode 100644 docs/OperationSecurityScanMetadataSecurityScanResult.md create mode 100644 docs/OperationWorkflowProgressResultBody.md create mode 100644 docs/ResultBody.md create mode 100644 docs/SecurityScanMetadata.md create mode 100644 docs/SecurityScanResult.md create mode 100644 docs/Status.md create mode 100644 docs/TriggerSecurityScanInputBody.md create mode 100644 src/main/java/ai/reveng/model/EventNamesFinished.java create mode 100644 src/main/java/ai/reveng/model/ExtractedBinary.java create mode 100644 src/main/java/ai/reveng/model/InputBody.java create mode 100644 src/main/java/ai/reveng/model/NamesFinishedEvent.java create mode 100644 src/main/java/ai/reveng/model/OperationSecurityScanMetadataSecurityScanResult.java create mode 100644 src/main/java/ai/reveng/model/OperationWorkflowProgressResultBody.java create mode 100644 src/main/java/ai/reveng/model/ResultBody.java create mode 100644 src/main/java/ai/reveng/model/SecurityScanMetadata.java create mode 100644 src/main/java/ai/reveng/model/SecurityScanResult.java create mode 100644 src/main/java/ai/reveng/model/Status.java create mode 100644 src/main/java/ai/reveng/model/TriggerSecurityScanInputBody.java diff --git a/.sdk-version b/.sdk-version index 37c93bef..c2d2cb0b 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.4.0 +v4.5.0 diff --git a/README.md b/README.md index b049f7e7..8ceabe83 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 4.4.0 + 4.5.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:4.4.0" + implementation "ai.reveng:sdk:4.5.0" } ``` @@ -89,8 +89,11 @@ Class | Method | HTTP request | Description *AgentApi* | [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](docs/AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result *AgentApi* | [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](docs/AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result *AgentApi* | [**v3CancelRenameUnnamedFunctions**](docs/AgentApi.md#v3CancelRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. +*AgentApi* | [**v3CancelSecurityScanOperation**](docs/AgentApi.md#v3CancelSecurityScanOperation) | **POST** /v3/operations/security-scan/{analysis_id}:cancel | Cancel a security-scan operation. *AgentApi* | [**v3GetRenameUnnamedFunctionsResult**](docs/AgentApi.md#v3GetRenameUnnamedFunctionsResult) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. *AgentApi* | [**v3GetRenameUnnamedFunctionsStatus**](docs/AgentApi.md#v3GetRenameUnnamedFunctionsStatus) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. +*AgentApi* | [**v3GetSecurityScanOperation**](docs/AgentApi.md#v3GetSecurityScanOperation) | **GET** /v3/operations/security-scan/{analysis_id} | Get a security-scan operation. +*AgentApi* | [**v3RunSecurityScan**](docs/AgentApi.md#v3RunSecurityScan) | **POST** /v3/analyses/{analysis_id}/security-scan:run | Run the security-scan agent. *AgentApi* | [**v3TriggerRenameUnnamedFunctions**](docs/AgentApi.md#v3TriggerRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. *AnalysesBulkActionsApi* | [**bulkAddAnalysisTags**](docs/AnalysesBulkActionsApi.md#bulkAddAnalysisTags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags *AnalysesBulkActionsApi* | [**bulkDeleteAnalyses**](docs/AnalysesBulkActionsApi.md#bulkDeleteAnalyses) | **PATCH** /v2/analyses/delete | Bulk Delete Analyses @@ -492,6 +495,7 @@ Class | Method | HTTP request | Description - [EventCONTEXTCOMPACTED](docs/EventCONTEXTCOMPACTED.md) - [EventDecompFailed](docs/EventDecompFailed.md) - [EventDecompFinished](docs/EventDecompFinished.md) + - [EventNamesFinished](docs/EventNamesFinished.md) - [EventProse](docs/EventProse.md) - [EventRUNCANCELLED](docs/EventRUNCANCELLED.md) - [EventRUNERROR](docs/EventRUNERROR.md) @@ -516,6 +520,7 @@ Class | Method | HTTP request | Description - [Example](docs/Example.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) + - [ExtractedBinary](docs/ExtractedBinary.md) - [ExtractedURL](docs/ExtractedURL.md) - [FileActivityEntry](docs/FileActivityEntry.md) - [FileFormat](docs/FileFormat.md) @@ -579,6 +584,7 @@ Class | Method | HTTP request | Description - [IndirectCallSite](docs/IndirectCallSite.md) - [IndirectCallSitesOutputBody](docs/IndirectCallSitesOutputBody.md) - [InlineComment](docs/InlineComment.md) + - [InputBody](docs/InputBody.md) - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InviteUserInputBody](docs/InviteUserInputBody.md) - [IssuerAllowedDomain](docs/IssuerAllowedDomain.md) @@ -611,8 +617,11 @@ Class | Method | HTTP request | Description - [MutexEntry](docs/MutexEntry.md) - [NameConfidence](docs/NameConfidence.md) - [NameSourceType](docs/NameSourceType.md) + - [NamesFinishedEvent](docs/NamesFinishedEvent.md) - [NetworkActivity](docs/NetworkActivity.md) - [OIDCCallbackInputBody](docs/OIDCCallbackInputBody.md) + - [OperationSecurityScanMetadataSecurityScanResult](docs/OperationSecurityScanMetadataSecurityScanResult.md) + - [OperationWorkflowProgressResultBody](docs/OperationWorkflowProgressResultBody.md) - [Order](docs/Order.md) - [Organisation](docs/Organisation.md) - [OrganisationGroup](docs/OrganisationGroup.md) @@ -666,6 +675,7 @@ Class | Method | HTTP request | Description - [ReportInfo](docs/ReportInfo.md) - [ReportOptions](docs/ReportOptions.md) - [ResolvedEntity](docs/ResolvedEntity.md) + - [ResultBody](docs/ResultBody.md) - [RevokeBody](docs/RevokeBody.md) - [SSOProvider](docs/SSOProvider.md) - [SSOProvidersOutputBody](docs/SSOProvidersOutputBody.md) @@ -676,6 +686,8 @@ Class | Method | HTTP request | Description - [ScrapeThirdPartyConfig](docs/ScrapeThirdPartyConfig.md) - [SectionModel](docs/SectionModel.md) - [SecurityModel](docs/SecurityModel.md) + - [SecurityScanMetadata](docs/SecurityScanMetadata.md) + - [SecurityScanResult](docs/SecurityScanResult.md) - [SegmentInfo](docs/SegmentInfo.md) - [SendMessageRequest](docs/SendMessageRequest.md) - [ServerSentEventsInner](docs/ServerSentEventsInner.md) @@ -714,6 +726,7 @@ Class | Method | HTTP request | Description - [StartMatchingForFunctionsInputBody](docs/StartMatchingForFunctionsInputBody.md) - [StartMatchingOutputBody](docs/StartMatchingOutputBody.md) - [StartupInfo](docs/StartupInfo.md) + - [Status](docs/Status.md) - [StatusBody](docs/StatusBody.md) - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) @@ -745,6 +758,7 @@ Class | Method | HTTP request | Description - [TriageReportResponse](docs/TriageReportResponse.md) - [TriggerDynamicExecutionInputBody](docs/TriggerDynamicExecutionInputBody.md) - [TriggerRenameUnnamedFunctionsInputBody](docs/TriggerRenameUnnamedFunctionsInputBody.md) + - [TriggerSecurityScanInputBody](docs/TriggerSecurityScanInputBody.md) - [Ttp](docs/Ttp.md) - [TypedefDataType](docs/TypedefDataType.md) - [TypedefDefinition](docs/TypedefDefinition.md) diff --git a/build.gradle b/build.gradle index 89717108..47e4b517 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '4.4.0' +version = '4.5.0' @@ -174,7 +174,7 @@ mavenPublishing { // key, and signing without one fails the build. if (project.hasProperty("signingInMemoryKey")) signAllPublications() - coordinates("ai.reveng", "sdk", "4.4.0") + coordinates("ai.reveng", "sdk", "4.5.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 3b6200e1..5f548af9 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "4.4.0", + version := "4.5.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AgentApi.md b/docs/AgentApi.md index 6d604fba..fe51e67c 100644 --- a/docs/AgentApi.md +++ b/docs/AgentApi.md @@ -17,8 +17,11 @@ All URIs are relative to *https://api.reveng.ai* | [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result | | [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result | | [**v3CancelRenameUnnamedFunctions**](AgentApi.md#v3CancelRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. | +| [**v3CancelSecurityScanOperation**](AgentApi.md#v3CancelSecurityScanOperation) | **POST** /v3/operations/security-scan/{analysis_id}:cancel | Cancel a security-scan operation. | | [**v3GetRenameUnnamedFunctionsResult**](AgentApi.md#v3GetRenameUnnamedFunctionsResult) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. | | [**v3GetRenameUnnamedFunctionsStatus**](AgentApi.md#v3GetRenameUnnamedFunctionsStatus) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. | +| [**v3GetSecurityScanOperation**](AgentApi.md#v3GetSecurityScanOperation) | **GET** /v3/operations/security-scan/{analysis_id} | Get a security-scan operation. | +| [**v3RunSecurityScan**](AgentApi.md#v3RunSecurityScan) | **POST** /v3/analyses/{analysis_id}/security-scan:run | Run the security-scan agent. | | [**v3TriggerRenameUnnamedFunctions**](AgentApi.md#v3TriggerRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. | @@ -967,6 +970,82 @@ null (empty response body) | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3CancelSecurityScanOperation** +> v3CancelSecurityScanOperation(analysisId) + +Cancel a security-scan operation. + +Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + apiInstance.v3CancelSecurityScanOperation(analysisId); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3CancelSecurityScanOperation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| Analysis ID | | + +### Return type + +null (empty response body) + +### 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 | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3GetRenameUnnamedFunctionsResult** > RenameUnnamedFunctionsResult v3GetRenameUnnamedFunctionsResult(analysisId) @@ -1122,6 +1201,163 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3GetSecurityScanOperation** +> OperationSecurityScanMetadataSecurityScanResult v3GetSecurityScanOperation(analysisId) + +Get a security-scan operation. + +Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + OperationSecurityScanMetadataSecurityScanResult result = apiInstance.v3GetSecurityScanOperation(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3GetSecurityScanOperation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| Analysis ID | | + +### Return type + +[**OperationSecurityScanMetadataSecurityScanResult**](OperationSecurityScanMetadataSecurityScanResult.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 | - | + + +# **v3RunSecurityScan** +> OperationSecurityScanMetadataSecurityScanResult v3RunSecurityScan(analysisId, triggerSecurityScanInputBody) + +Run the security-scan agent. + +Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + TriggerSecurityScanInputBody triggerSecurityScanInputBody = new TriggerSecurityScanInputBody(); // TriggerSecurityScanInputBody | + try { + OperationSecurityScanMetadataSecurityScanResult result = apiInstance.v3RunSecurityScan(analysisId, triggerSecurityScanInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3RunSecurityScan"); + 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 | | +| **triggerSecurityScanInputBody** | [**TriggerSecurityScanInputBody**](TriggerSecurityScanInputBody.md)| | | + +### Return type + +[**OperationSecurityScanMetadataSecurityScanResult**](OperationSecurityScanMetadataSecurityScanResult.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3TriggerRenameUnnamedFunctions** > StatusBody v3TriggerRenameUnnamedFunctions(analysisId, triggerRenameUnnamedFunctionsInputBody) diff --git a/docs/EventNamesFinished.md b/docs/EventNamesFinished.md new file mode 100644 index 00000000..aa5aaacf --- /dev/null +++ b/docs/EventNamesFinished.md @@ -0,0 +1,25 @@ + + +# EventNamesFinished + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | [**NamesFinishedEvent**](NamesFinishedEvent.md) | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| NAMES_FINISHED | "names_finished" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ExtractedBinary.md b/docs/ExtractedBinary.md new file mode 100644 index 00000000..5007c162 --- /dev/null +++ b/docs/ExtractedBinary.md @@ -0,0 +1,15 @@ + + +# ExtractedBinary + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**filename** | **String** | Original filename inside the upload | | +|**sha256Hash** | **String** | Content hash of the recovered binary | | +|**size** | **Long** | File size (in bytes) | | + + + diff --git a/docs/InputBody.md b/docs/InputBody.md new file mode 100644 index 00000000..b7b87c7b --- /dev/null +++ b/docs/InputBody.md @@ -0,0 +1,13 @@ + + +# InputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**password** | **String** | Password to decrypt an encrypted archive. | [optional] | + + + diff --git a/docs/NamesFinishedEvent.md b/docs/NamesFinishedEvent.md new file mode 100644 index 00000000..7bd82e13 --- /dev/null +++ b/docs/NamesFinishedEvent.md @@ -0,0 +1,16 @@ + + +# NamesFinishedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**applied** | **Integer** | | | +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/OperationSecurityScanMetadataSecurityScanResult.md b/docs/OperationSecurityScanMetadataSecurityScanResult.md new file mode 100644 index 00000000..6e782da0 --- /dev/null +++ b/docs/OperationSecurityScanMetadataSecurityScanResult.md @@ -0,0 +1,17 @@ + + +# OperationSecurityScanMetadataSecurityScanResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**done** | **Boolean** | Whether the operation has reached a terminal state. | | +|**error** | [**Status**](Status.md) | Failure detail, populated only when done is true and the operation failed. | [optional] | +|**metadata** | [**SecurityScanMetadata**](SecurityScanMetadata.md) | In-flight information and details. | [optional] | +|**name** | **String** | API resource name. | | +|**response** | [**SecurityScanResult**](SecurityScanResult.md) | Result, set only when done is true and the operation succeeded. | [optional] | + + + diff --git a/docs/OperationWorkflowProgressResultBody.md b/docs/OperationWorkflowProgressResultBody.md new file mode 100644 index 00000000..aeaa9a42 --- /dev/null +++ b/docs/OperationWorkflowProgressResultBody.md @@ -0,0 +1,17 @@ + + +# OperationWorkflowProgressResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**done** | **Boolean** | Whether the operation has reached a terminal state. | | +|**error** | [**Status**](Status.md) | Failure detail, populated only when done is true and the operation failed. | [optional] | +|**metadata** | [**WorkflowProgress**](WorkflowProgress.md) | In-flight information and details. | [optional] | +|**name** | **String** | API resource name. | | +|**response** | [**ResultBody**](ResultBody.md) | Result, set only when done is true and the operation succeeded. | [optional] | + + + diff --git a/docs/RenameInputBody.md b/docs/RenameInputBody.md index a0b4358a..7c16cff4 100644 --- a/docs/RenameInputBody.md +++ b/docs/RenameInputBody.md @@ -9,7 +9,6 @@ |------------ | ------------- | ------------- | -------------| |**newMangledName** | **String** | New mangled function name | [optional] | |**newName** | **String** | New function name | | -|**preserveAiDecompilation** | **Boolean** | Keep the cached AI decompilation, summary and inline comments. Set when the new name comes from the model's own prediction (e.g. Transfer Name) so existing AI output is not discarded and regenerated. | [optional] | diff --git a/docs/ResultBody.md b/docs/ResultBody.md new file mode 100644 index 00000000..91e00221 --- /dev/null +++ b/docs/ResultBody.md @@ -0,0 +1,16 @@ + + +# ResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaries** | [**List<ExtractedBinary>**](ExtractedBinary.md) | Child binaries recovered from the extraction. | | +|**extractionDepth** | **Long** | Number of nested-archive extraction passes taken. | | +|**filenameToExtractionFailure** | **Map<String, String>** | Per-file extraction failures, keyed by filename. | | +|**skippedFiles** | **Long** | Files skipped because they were not recognised as binaries. | | + + + diff --git a/docs/SecurityScanMetadata.md b/docs/SecurityScanMetadata.md new file mode 100644 index 00000000..a77a2a5a --- /dev/null +++ b/docs/SecurityScanMetadata.md @@ -0,0 +1,27 @@ + + +# SecurityScanMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**logHistory** | **List<List<Object>>** | Progress messages the run recorded, oldest first. | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Run status. UNINITIALISED means the agent has never been triggered for this analysis. | | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| UNINITIALISED | "UNINITIALISED" | +| PENDING | "PENDING" | +| RUNNING | "RUNNING" | +| COMPLETED | "COMPLETED" | +| FAILED | "FAILED" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/SecurityScanResult.md b/docs/SecurityScanResult.md new file mode 100644 index 00000000..f5dea9a1 --- /dev/null +++ b/docs/SecurityScanResult.md @@ -0,0 +1,19 @@ + + +# SecurityScanResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | Analysis the run was performed against | | +|**cancelled** | **Boolean** | Whether the run was cancelled before it covered every function | | +|**decompiled** | **Long** | Functions successfully decompiled and scanned | | +|**failed** | **Long** | Functions whose decompilation or scan attempt errored | | +|**securityScan** | **Map<String, Object>** | Raw semgrep findings, keyed by the scanner's own result shape | [optional] | +|**source** | **String** | Decompiler that produced the source scanned | | +|**total** | **Long** | Functions the run considered | | + + + diff --git a/docs/Status.md b/docs/Status.md new file mode 100644 index 00000000..1589b1ab --- /dev/null +++ b/docs/Status.md @@ -0,0 +1,79 @@ + + +# Status + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | [**CodeEnum**](#CodeEnum) | Machine-readable error code, shared with synchronous API errors. | | +|**detail** | **String** | Additional context where helpful (quota numbers, validation specifics, etc.). | [optional] | +|**docUrl** | **String** | Link to documentation explaining this error and resolution steps. | | +|**message** | **String** | Brief description of the failure. | | + + + +## Enum: CodeEnum + +| Name | Value | +|---- | -----| +| ACCESS_DENIED | "ACCESS_DENIED" | +| AGENT_BUDGET_EXCEEDED | "AGENT_BUDGET_EXCEEDED" | +| AGENT_DEFINITION_NOT_FOUND | "AGENT_DEFINITION_NOT_FOUND" | +| AGENT_INVALID_STARTING_INPUT | "AGENT_INVALID_STARTING_INPUT" | +| AGENT_MEMORY_INVALID_SCOPE | "AGENT_MEMORY_INVALID_SCOPE" | +| AGENT_MEMORY_NOT_FOUND | "AGENT_MEMORY_NOT_FOUND" | +| AGENT_MEMORY_VERSION_CONFLICT | "AGENT_MEMORY_VERSION_CONFLICT" | +| AGENT_NO_PENDING_QUESTION | "AGENT_NO_PENDING_QUESTION" | +| AGENT_RUN_NOT_FOUND | "AGENT_RUN_NOT_FOUND" | +| ALREADY_EXISTS | "ALREADY_EXISTS" | +| ANALYSIS_NOT_READY | "ANALYSIS_NOT_READY" | +| BAD_REQUEST | "BAD_REQUEST" | +| CLIENT_CLOSED_REQUEST | "CLIENT_CLOSED_REQUEST" | +| CONFLICT | "CONFLICT" | +| CONVERSATION_NOT_FOUND | "CONVERSATION_NOT_FOUND" | +| DOMAIN_ALREADY_CLAIMED | "DOMAIN_ALREADY_CLAIMED" | +| DOMAIN_VERIFICATION_PENDING | "DOMAIN_VERIFICATION_PENDING" | +| DYNAMIC_EXECUTION_INCOMPLETE | "DYNAMIC_EXECUTION_INCOMPLETE" | +| EMAIL_NOT_VERIFIED | "EMAIL_NOT_VERIFIED" | +| EXTERNAL_USER | "EXTERNAL_USER" | +| FORBIDDEN | "FORBIDDEN" | +| GATEWAY_TIMEOUT | "GATEWAY_TIMEOUT" | +| GROUP_HAS_MEMBERS | "GROUP_HAS_MEMBERS" | +| INSUFFICIENT_CREDITS | "INSUFFICIENT_CREDITS" | +| INTERNAL_ERROR | "INTERNAL_ERROR" | +| INTERNAL_ISSUER | "INTERNAL_ISSUER" | +| INVALID_CONVERSATION_ID | "INVALID_CONVERSATION_ID" | +| INVALID_CREDENTIALS | "INVALID_CREDENTIALS" | +| INVALID_INVITE_CODE | "INVALID_INVITE_CODE" | +| INVALID_RESET_CODE | "INVALID_RESET_CODE" | +| LAST_ORG_OWNER | "LAST_ORG_OWNER" | +| LAST_TEAM_ADMIN | "LAST_TEAM_ADMIN" | +| LAST_TEAM_MEMBER | "LAST_TEAM_MEMBER" | +| LINKED_TO_ORG | "LINKED_TO_ORG" | +| METHOD_NOT_ALLOWED | "METHOD_NOT_ALLOWED" | +| NOT_ACCEPTABLE | "NOT_ACCEPTABLE" | +| NOT_FOUND | "NOT_FOUND" | +| NO_ACTIVE_RUN | "NO_ACTIVE_RUN" | +| NO_PENDING_CONFIRMATION | "NO_PENDING_CONFIRMATION" | +| OIDC_DISCOVERY_FAILED | "OIDC_DISCOVERY_FAILED" | +| PASSWORD_RESET_REQUIRED | "PASSWORD_RESET_REQUIRED" | +| PAYMENT_REQUIRED | "PAYMENT_REQUIRED" | +| REPORT_RENDER_FAILED | "REPORT_RENDER_FAILED" | +| REQUEST_ENTITY_TOO_LARGE | "REQUEST_ENTITY_TOO_LARGE" | +| RUN_ALREADY_ACTIVE | "RUN_ALREADY_ACTIVE" | +| SELF_DELETION_NOT_ALLOWED | "SELF_DELETION_NOT_ALLOWED" | +| SERVICE_UNAVAILABLE | "SERVICE_UNAVAILABLE" | +| TOKEN_EXPIRED | "TOKEN_EXPIRED" | +| TOKEN_REUSED | "TOKEN_REUSED" | +| TOO_MANY_REQUESTS | "TOO_MANY_REQUESTS" | +| UNAUTHORIZED | "UNAUTHORIZED" | +| UNSUPPORTED_MEDIA_TYPE | "UNSUPPORTED_MEDIA_TYPE" | +| VALIDATION_FAILED | "VALIDATION_FAILED" | +| VERIFICATION_EXPIRED | "VERIFICATION_EXPIRED" | +| VERIFICATION_NOT_FOUND | "VERIFICATION_NOT_FOUND" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/TriggerSecurityScanInputBody.md b/docs/TriggerSecurityScanInputBody.md new file mode 100644 index 00000000..4b555068 --- /dev/null +++ b/docs/TriggerSecurityScanInputBody.md @@ -0,0 +1,13 @@ + + +# TriggerSecurityScanInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**maxFunctionsToScan** | **Long** | Stop after decompiling and scanning this many functions. Omit to process every function in the analysis. | [optional] | + + + diff --git a/pom.xml b/pom.xml index 693e1d50..b8008d61 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 4.4.0 + 4.5.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AgentApi.java b/src/main/java/ai/reveng/api/AgentApi.java index 7b7d2214..16069719 100644 --- a/src/main/java/ai/reveng/api/AgentApi.java +++ b/src/main/java/ai/reveng/api/AgentApi.java @@ -34,11 +34,13 @@ import ai.reveng.model.BaseResponseReportAnalysisResponse; import ai.reveng.model.BaseResponseTriageReportResponse; import ai.reveng.model.ErrorModel; +import ai.reveng.model.OperationSecurityScanMetadataSecurityScanResult; import ai.reveng.model.QueuedWorkflowTaskResponse; import ai.reveng.model.RenameUnnamedFunctionsResult; import ai.reveng.model.StatusBody; import ai.reveng.model.TaskStatusResponse; import ai.reveng.model.TriggerRenameUnnamedFunctionsInputBody; +import ai.reveng.model.TriggerSecurityScanInputBody; import java.lang.reflect.Type; import java.util.ArrayList; @@ -1798,6 +1800,145 @@ public okhttp3.Call v3CancelRenameUnnamedFunctionsAsync(@javax.annotation.Nonnul localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + /** + * Build call for v3CancelSecurityScanOperation + * @param analysisId Analysis ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CancelSecurityScanOperationCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/operations/security-scan/{analysis_id}:cancel" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3CancelSecurityScanOperationValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3CancelSecurityScanOperation(Async)"); + } + + return v3CancelSecurityScanOperationCall(analysisId, _callback); + + } + + /** + * Cancel a security-scan operation. + * Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @param analysisId Analysis ID (required) + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3CancelSecurityScanOperation(@javax.annotation.Nonnull Long analysisId) throws ApiException { + v3CancelSecurityScanOperationWithHttpInfo(analysisId); + } + + /** + * Cancel a security-scan operation. + * Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @param analysisId Analysis ID (required) + * @return ApiResponse<Void> + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3CancelSecurityScanOperationWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3CancelSecurityScanOperationValidateBeforeCall(analysisId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Cancel a security-scan operation. (asynchronously) + * Requests cancellation of the currently running security-scan run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @param analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CancelSecurityScanOperationAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3CancelSecurityScanOperationValidateBeforeCall(analysisId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for v3GetRenameUnnamedFunctionsResult * @param analysisId Analysis ID (required) @@ -2088,6 +2229,306 @@ public okhttp3.Call v3GetRenameUnnamedFunctionsStatusAsync(@javax.annotation.Non localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetSecurityScanOperation + * @param analysisId Analysis ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetSecurityScanOperationCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/operations/security-scan/{analysis_id}" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetSecurityScanOperationValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3GetSecurityScanOperation(Async)"); + } + + return v3GetSecurityScanOperationCall(analysisId, _callback); + + } + + /** + * Get a security-scan operation. + * Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return OperationSecurityScanMetadataSecurityScanResult + * @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 OperationSecurityScanMetadataSecurityScanResult v3GetSecurityScanOperation(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetSecurityScanOperationWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get a security-scan operation. + * Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return ApiResponse<OperationSecurityScanMetadataSecurityScanResult> + * @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 v3GetSecurityScanOperationWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetSecurityScanOperationValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a security-scan operation. (asynchronously) + * Returns the current state of the security-scan run for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetSecurityScanOperationAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetSecurityScanOperationValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3RunSecurityScan + * @param analysisId Analysis ID (required) + * @param triggerSecurityScanInputBody (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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RunSecurityScanCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerSecurityScanInputBody triggerSecurityScanInputBody, 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 = triggerSecurityScanInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/security-scan:run" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3RunSecurityScanValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerSecurityScanInputBody triggerSecurityScanInputBody, 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 v3RunSecurityScan(Async)"); + } + + // verify the required parameter 'triggerSecurityScanInputBody' is set + if (triggerSecurityScanInputBody == null) { + throw new ApiException("Missing the required parameter 'triggerSecurityScanInputBody' when calling v3RunSecurityScan(Async)"); + } + + return v3RunSecurityScanCall(analysisId, triggerSecurityScanInputBody, _callback); + + } + + /** + * Run the security-scan agent. + * Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerSecurityScanInputBody (required) + * @return OperationSecurityScanMetadataSecurityScanResult + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public OperationSecurityScanMetadataSecurityScanResult v3RunSecurityScan(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerSecurityScanInputBody triggerSecurityScanInputBody) throws ApiException { + ApiResponse localVarResp = v3RunSecurityScanWithHttpInfo(analysisId, triggerSecurityScanInputBody); + return localVarResp.getData(); + } + + /** + * Run the security-scan agent. + * Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerSecurityScanInputBody (required) + * @return ApiResponse<OperationSecurityScanMetadataSecurityScanResult> + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3RunSecurityScanWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerSecurityScanInputBody triggerSecurityScanInputBody) throws ApiException { + okhttp3.Call localVarCall = v3RunSecurityScanValidateBeforeCall(analysisId, triggerSecurityScanInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Run the security-scan agent. (asynchronously) + * Starts an agent that decompiles the analysis' functions and runs a security scan over the decompiled source, and returns the operation to poll for its outcome. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `max_functions_to_scan` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerSecurityScanInputBody (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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RunSecurityScanAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerSecurityScanInputBody triggerSecurityScanInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3RunSecurityScanValidateBeforeCall(analysisId, triggerSecurityScanInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3TriggerRenameUnnamedFunctions * @param analysisId Analysis ID (required) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index c3069cef..6fc7afd3 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/4.4.0/java"); + setUserAgent("OpenAPI-Generator/4.5.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 f5dcf070..6e7906db 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 = "4.4.0"; + public static final String VERSION = "4.5.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 5ef87078..51922cf6 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -391,6 +391,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventCONTEXTCOMPACTED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventDecompFailed.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventDecompFinished.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventNamesFinished.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventProse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNCANCELLED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNERROR.CustomTypeAdapterFactory()); @@ -415,6 +416,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Example.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedBinary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedURL.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileActivityEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileHashes.CustomTypeAdapterFactory()); @@ -474,6 +476,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IndirectCallSite.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IndirectCallSitesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InlineComment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InviteUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IssuerAllowedDomain.CustomTypeAdapterFactory()); @@ -505,8 +508,11 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MutexEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NameConfidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NameSourceType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NamesFinishedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkActivity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OIDCCallbackInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationSecurityScanMetadataSecurityScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationWorkflowProgressResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Organisation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OrganisationGroup.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OrganisationIssuer.CustomTypeAdapterFactory()); @@ -558,6 +564,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportOptions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResolvedEntity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RevokeBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvider.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvidersOutputBody.CustomTypeAdapterFactory()); @@ -566,6 +573,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScrapeThirdPartyConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SectionModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecurityModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecurityScanMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecurityScanResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SegmentInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SendMessageRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ServerSentEventsInner.CustomTypeAdapterFactory()); @@ -604,6 +613,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartMatchingForFunctionsInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartMatchingOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartupInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Status.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusResponse.CustomTypeAdapterFactory()); @@ -632,6 +642,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageReportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriggerDynamicExecutionInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriggerRenameUnnamedFunctionsInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriggerSecurityScanInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Ttp.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDefinition.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/EventNamesFinished.java b/src/main/java/ai/reveng/model/EventNamesFinished.java new file mode 100644 index 00000000..6f431bdf --- /dev/null +++ b/src/main/java/ai/reveng/model/EventNamesFinished.java @@ -0,0 +1,424 @@ +/* + * 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.NamesFinishedEvent; +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; + +/** + * EventNamesFinished + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventNamesFinished { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private NamesFinishedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + NAMES_FINISHED("names_finished"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + EventEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EventEnum fromValue(String value) { + for (EventEnum b : EventEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EventEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EventEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EventEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EventEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_EVENT = "event"; + @SerializedName(SERIALIZED_NAME_EVENT) + @javax.annotation.Nonnull + private EventEnum event; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Integer id; + + public static final String SERIALIZED_NAME_RETRY = "retry"; + @SerializedName(SERIALIZED_NAME_RETRY) + @javax.annotation.Nullable + private Integer retry; + + public EventNamesFinished() { + } + + public EventNamesFinished data(@javax.annotation.Nonnull NamesFinishedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public NamesFinishedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull NamesFinishedEvent data) { + this.data = data; + } + + + public EventNamesFinished event(@javax.annotation.Nonnull EventEnum event) { + this.event = event; + return this; + } + + /** + * The event name. + * @return event + */ + @javax.annotation.Nonnull + public EventEnum getEvent() { + return event; + } + + public void setEvent(@javax.annotation.Nonnull EventEnum event) { + this.event = event; + } + + + public EventNamesFinished id(@javax.annotation.Nullable Integer id) { + this.id = id; + return this; + } + + /** + * The event ID. + * @return id + */ + @javax.annotation.Nullable + public Integer getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Integer id) { + this.id = id; + } + + + public EventNamesFinished retry(@javax.annotation.Nullable Integer retry) { + this.retry = retry; + return this; + } + + /** + * The retry time in milliseconds. + * @return retry + */ + @javax.annotation.Nullable + public Integer getRetry() { + return retry; + } + + public void setRetry(@javax.annotation.Nullable Integer retry) { + this.retry = retry; + } + + /** + * 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 EventNamesFinished instance itself + */ + public EventNamesFinished 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; + } + EventNamesFinished eventNamesFinished = (EventNamesFinished) o; + return Objects.equals(this.data, eventNamesFinished.data) && + Objects.equals(this.event, eventNamesFinished.event) && + Objects.equals(this.id, eventNamesFinished.id) && + Objects.equals(this.retry, eventNamesFinished.retry)&& + Objects.equals(this.additionalProperties, eventNamesFinished.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventNamesFinished {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" retry: ").append(toIndentedString(retry)).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("data", "event", "id", "retry")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data", "event")); + } + + /** + * 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 EventNamesFinished + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventNamesFinished.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 EventNamesFinished is not found in the empty JSON string", EventNamesFinished.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventNamesFinished.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(); + // validate the required field `data` + NamesFinishedEvent.validateJsonElement(jsonObj.get("data")); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `event` to be a primitive type in the JSON string but got `%s`", jsonObj.get("event").toString())); + } + // validate the required field `event` + EventEnum.validateJsonElement(jsonObj.get("event")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EventNamesFinished.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventNamesFinished' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventNamesFinished.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventNamesFinished 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 EventNamesFinished read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventNamesFinished 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 EventNamesFinished given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventNamesFinished + * @throws IOException if the JSON string is invalid with respect to EventNamesFinished + */ + public static EventNamesFinished fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventNamesFinished.class); + } + + /** + * Convert an instance of EventNamesFinished to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ExtractedBinary.java b/src/main/java/ai/reveng/model/ExtractedBinary.java new file mode 100644 index 00000000..c6ec2065 --- /dev/null +++ b/src/main/java/ai/reveng/model/ExtractedBinary.java @@ -0,0 +1,344 @@ +/* + * 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; + +/** + * ExtractedBinary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExtractedBinary { + public static final String SERIALIZED_NAME_FILENAME = "filename"; + @SerializedName(SERIALIZED_NAME_FILENAME) + @javax.annotation.Nonnull + private String filename; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public ExtractedBinary() { + } + + public ExtractedBinary filename(@javax.annotation.Nonnull String filename) { + this.filename = filename; + return this; + } + + /** + * Original filename inside the upload + * @return filename + */ + @javax.annotation.Nonnull + public String getFilename() { + return filename; + } + + public void setFilename(@javax.annotation.Nonnull String filename) { + this.filename = filename; + } + + + public ExtractedBinary sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * Content hash of the recovered binary + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public ExtractedBinary size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * File 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 ExtractedBinary instance itself + */ + public ExtractedBinary 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; + } + ExtractedBinary extractedBinary = (ExtractedBinary) o; + return Objects.equals(this.filename, extractedBinary.filename) && + Objects.equals(this.sha256Hash, extractedBinary.sha256Hash) && + Objects.equals(this.size, extractedBinary.size)&& + Objects.equals(this.additionalProperties, extractedBinary.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(filename, sha256Hash, size, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExtractedBinary {\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).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("filename", "sha_256_hash", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("filename", "sha_256_hash", "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 ExtractedBinary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExtractedBinary.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 ExtractedBinary is not found in the empty JSON string", ExtractedBinary.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExtractedBinary.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("filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("filename").toString())); + } + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExtractedBinary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExtractedBinary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExtractedBinary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExtractedBinary 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 ExtractedBinary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ExtractedBinary 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 ExtractedBinary given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExtractedBinary + * @throws IOException if the JSON string is invalid with respect to ExtractedBinary + */ + public static ExtractedBinary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExtractedBinary.class); + } + + /** + * Convert an instance of ExtractedBinary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/InputBody.java b/src/main/java/ai/reveng/model/InputBody.java new file mode 100644 index 00000000..926a3838 --- /dev/null +++ b/src/main/java/ai/reveng/model/InputBody.java @@ -0,0 +1,282 @@ +/* + * 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; + +/** + * InputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InputBody { + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public InputBody() { + } + + public InputBody password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Password to decrypt an encrypted archive. + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + /** + * 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 InputBody instance itself + */ + public InputBody 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; + } + InputBody inputBody = (InputBody) o; + return Objects.equals(this.password, inputBody.password)&& + Objects.equals(this.additionalProperties, inputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(password, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InputBody {\n"); + sb.append(" password: ").append(toIndentedString(password)).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("password")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 InputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InputBody.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 InputBody is not found in the empty JSON string", InputBody.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InputBody 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 InputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InputBody 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 InputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of InputBody + * @throws IOException if the JSON string is invalid with respect to InputBody + */ + public static InputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InputBody.class); + } + + /** + * Convert an instance of InputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/NamesFinishedEvent.java b/src/main/java/ai/reveng/model/NamesFinishedEvent.java new file mode 100644 index 00000000..5a232c8f --- /dev/null +++ b/src/main/java/ai/reveng/model/NamesFinishedEvent.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; + +/** + * NamesFinishedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NamesFinishedEvent { + public static final String SERIALIZED_NAME_APPLIED = "applied"; + @SerializedName(SERIALIZED_NAME_APPLIED) + @javax.annotation.Nonnull + private Integer applied; + + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public NamesFinishedEvent() { + } + + public NamesFinishedEvent applied(@javax.annotation.Nonnull Integer applied) { + this.applied = applied; + return this; + } + + /** + * Get applied + * @return applied + */ + @javax.annotation.Nonnull + public Integer getApplied() { + return applied; + } + + public void setApplied(@javax.annotation.Nonnull Integer applied) { + this.applied = applied; + } + + + public NamesFinishedEvent attempt(@javax.annotation.Nonnull Integer attempt) { + this.attempt = attempt; + return this; + } + + /** + * Get attempt + * @return attempt + */ + @javax.annotation.Nonnull + public Integer getAttempt() { + return attempt; + } + + public void setAttempt(@javax.annotation.Nonnull Integer attempt) { + this.attempt = attempt; + } + + + public NamesFinishedEvent seq(@javax.annotation.Nonnull Integer seq) { + this.seq = seq; + return this; + } + + /** + * Get seq + * @return seq + */ + @javax.annotation.Nonnull + public Integer getSeq() { + return seq; + } + + public void setSeq(@javax.annotation.Nonnull Integer seq) { + this.seq = seq; + } + + + public NamesFinishedEvent type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NamesFinishedEvent namesFinishedEvent = (NamesFinishedEvent) o; + return Objects.equals(this.applied, namesFinishedEvent.applied) && + Objects.equals(this.attempt, namesFinishedEvent.attempt) && + Objects.equals(this.seq, namesFinishedEvent.seq) && + Objects.equals(this.type, namesFinishedEvent.type); + } + + @Override + public int hashCode() { + return Objects.hash(applied, attempt, seq, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NamesFinishedEvent {\n"); + sb.append(" applied: ").append(toIndentedString(applied)).append("\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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("applied", "attempt", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("applied", "attempt", "seq", "type")); + } + + /** + * 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 NamesFinishedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NamesFinishedEvent.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 NamesFinishedEvent is not found in the empty JSON string", NamesFinishedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NamesFinishedEvent.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 `NamesFinishedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NamesFinishedEvent.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("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NamesFinishedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NamesFinishedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NamesFinishedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NamesFinishedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NamesFinishedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NamesFinishedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of NamesFinishedEvent + * @throws IOException if the JSON string is invalid with respect to NamesFinishedEvent + */ + public static NamesFinishedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NamesFinishedEvent.class); + } + + /** + * Convert an instance of NamesFinishedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/OperationSecurityScanMetadataSecurityScanResult.java b/src/main/java/ai/reveng/model/OperationSecurityScanMetadataSecurityScanResult.java new file mode 100644 index 00000000..36d27342 --- /dev/null +++ b/src/main/java/ai/reveng/model/OperationSecurityScanMetadataSecurityScanResult.java @@ -0,0 +1,408 @@ +/* + * 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.SecurityScanMetadata; +import ai.reveng.model.SecurityScanResult; +import ai.reveng.model.Status; +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; + +/** + * OperationSecurityScanMetadataSecurityScanResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OperationSecurityScanMetadataSecurityScanResult { + public static final String SERIALIZED_NAME_DONE = "done"; + @SerializedName(SERIALIZED_NAME_DONE) + @javax.annotation.Nonnull + private Boolean done; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private Status error; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private SecurityScanMetadata metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RESPONSE = "response"; + @SerializedName(SERIALIZED_NAME_RESPONSE) + @javax.annotation.Nullable + private SecurityScanResult response; + + public OperationSecurityScanMetadataSecurityScanResult() { + } + + public OperationSecurityScanMetadataSecurityScanResult done(@javax.annotation.Nonnull Boolean done) { + this.done = done; + return this; + } + + /** + * Whether the operation has reached a terminal state. + * @return done + */ + @javax.annotation.Nonnull + public Boolean getDone() { + return done; + } + + public void setDone(@javax.annotation.Nonnull Boolean done) { + this.done = done; + } + + + public OperationSecurityScanMetadataSecurityScanResult error(@javax.annotation.Nullable Status error) { + this.error = error; + return this; + } + + /** + * Failure detail, populated only when done is true and the operation failed. + * @return error + */ + @javax.annotation.Nullable + public Status getError() { + return error; + } + + public void setError(@javax.annotation.Nullable Status error) { + this.error = error; + } + + + public OperationSecurityScanMetadataSecurityScanResult metadata(@javax.annotation.Nullable SecurityScanMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * In-flight information and details. + * @return metadata + */ + @javax.annotation.Nullable + public SecurityScanMetadata getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable SecurityScanMetadata metadata) { + this.metadata = metadata; + } + + + public OperationSecurityScanMetadataSecurityScanResult name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * API resource name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OperationSecurityScanMetadataSecurityScanResult response(@javax.annotation.Nullable SecurityScanResult response) { + this.response = response; + return this; + } + + /** + * Result, set only when done is true and the operation succeeded. + * @return response + */ + @javax.annotation.Nullable + public SecurityScanResult getResponse() { + return response; + } + + public void setResponse(@javax.annotation.Nullable SecurityScanResult response) { + this.response = response; + } + + /** + * 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 OperationSecurityScanMetadataSecurityScanResult instance itself + */ + public OperationSecurityScanMetadataSecurityScanResult 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; + } + OperationSecurityScanMetadataSecurityScanResult operationSecurityScanMetadataSecurityScanResult = (OperationSecurityScanMetadataSecurityScanResult) o; + return Objects.equals(this.done, operationSecurityScanMetadataSecurityScanResult.done) && + Objects.equals(this.error, operationSecurityScanMetadataSecurityScanResult.error) && + Objects.equals(this.metadata, operationSecurityScanMetadataSecurityScanResult.metadata) && + Objects.equals(this.name, operationSecurityScanMetadataSecurityScanResult.name) && + Objects.equals(this.response, operationSecurityScanMetadataSecurityScanResult.response)&& + Objects.equals(this.additionalProperties, operationSecurityScanMetadataSecurityScanResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(done, error, metadata, name, response, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationSecurityScanMetadataSecurityScanResult {\n"); + sb.append(" done: ").append(toIndentedString(done)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).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("done", "error", "metadata", "name", "response")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("done", "name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OperationSecurityScanMetadataSecurityScanResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationSecurityScanMetadataSecurityScanResult.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 OperationSecurityScanMetadataSecurityScanResult is not found in the empty JSON string", OperationSecurityScanMetadataSecurityScanResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationSecurityScanMetadataSecurityScanResult.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(); + // validate the optional field `error` + if (jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) { + Status.validateJsonElement(jsonObj.get("error")); + } + // validate the optional field `metadata` + if (jsonObj.get("metadata") != null && !jsonObj.get("metadata").isJsonNull()) { + SecurityScanMetadata.validateJsonElement(jsonObj.get("metadata")); + } + 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())); + } + // validate the optional field `response` + if (jsonObj.get("response") != null && !jsonObj.get("response").isJsonNull()) { + SecurityScanResult.validateJsonElement(jsonObj.get("response")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationSecurityScanMetadataSecurityScanResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationSecurityScanMetadataSecurityScanResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationSecurityScanMetadataSecurityScanResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationSecurityScanMetadataSecurityScanResult 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 OperationSecurityScanMetadataSecurityScanResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OperationSecurityScanMetadataSecurityScanResult 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 OperationSecurityScanMetadataSecurityScanResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationSecurityScanMetadataSecurityScanResult + * @throws IOException if the JSON string is invalid with respect to OperationSecurityScanMetadataSecurityScanResult + */ + public static OperationSecurityScanMetadataSecurityScanResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationSecurityScanMetadataSecurityScanResult.class); + } + + /** + * Convert an instance of OperationSecurityScanMetadataSecurityScanResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/OperationWorkflowProgressResultBody.java b/src/main/java/ai/reveng/model/OperationWorkflowProgressResultBody.java new file mode 100644 index 00000000..d7518211 --- /dev/null +++ b/src/main/java/ai/reveng/model/OperationWorkflowProgressResultBody.java @@ -0,0 +1,408 @@ +/* + * 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.ResultBody; +import ai.reveng.model.Status; +import ai.reveng.model.WorkflowProgress; +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; + +/** + * OperationWorkflowProgressResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OperationWorkflowProgressResultBody { + public static final String SERIALIZED_NAME_DONE = "done"; + @SerializedName(SERIALIZED_NAME_DONE) + @javax.annotation.Nonnull + private Boolean done; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private Status error; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private WorkflowProgress metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RESPONSE = "response"; + @SerializedName(SERIALIZED_NAME_RESPONSE) + @javax.annotation.Nullable + private ResultBody response; + + public OperationWorkflowProgressResultBody() { + } + + public OperationWorkflowProgressResultBody done(@javax.annotation.Nonnull Boolean done) { + this.done = done; + return this; + } + + /** + * Whether the operation has reached a terminal state. + * @return done + */ + @javax.annotation.Nonnull + public Boolean getDone() { + return done; + } + + public void setDone(@javax.annotation.Nonnull Boolean done) { + this.done = done; + } + + + public OperationWorkflowProgressResultBody error(@javax.annotation.Nullable Status error) { + this.error = error; + return this; + } + + /** + * Failure detail, populated only when done is true and the operation failed. + * @return error + */ + @javax.annotation.Nullable + public Status getError() { + return error; + } + + public void setError(@javax.annotation.Nullable Status error) { + this.error = error; + } + + + public OperationWorkflowProgressResultBody metadata(@javax.annotation.Nullable WorkflowProgress metadata) { + this.metadata = metadata; + return this; + } + + /** + * In-flight information and details. + * @return metadata + */ + @javax.annotation.Nullable + public WorkflowProgress getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable WorkflowProgress metadata) { + this.metadata = metadata; + } + + + public OperationWorkflowProgressResultBody name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * API resource name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OperationWorkflowProgressResultBody response(@javax.annotation.Nullable ResultBody response) { + this.response = response; + return this; + } + + /** + * Result, set only when done is true and the operation succeeded. + * @return response + */ + @javax.annotation.Nullable + public ResultBody getResponse() { + return response; + } + + public void setResponse(@javax.annotation.Nullable ResultBody response) { + this.response = response; + } + + /** + * 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 OperationWorkflowProgressResultBody instance itself + */ + public OperationWorkflowProgressResultBody 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; + } + OperationWorkflowProgressResultBody operationWorkflowProgressResultBody = (OperationWorkflowProgressResultBody) o; + return Objects.equals(this.done, operationWorkflowProgressResultBody.done) && + Objects.equals(this.error, operationWorkflowProgressResultBody.error) && + Objects.equals(this.metadata, operationWorkflowProgressResultBody.metadata) && + Objects.equals(this.name, operationWorkflowProgressResultBody.name) && + Objects.equals(this.response, operationWorkflowProgressResultBody.response)&& + Objects.equals(this.additionalProperties, operationWorkflowProgressResultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(done, error, metadata, name, response, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationWorkflowProgressResultBody {\n"); + sb.append(" done: ").append(toIndentedString(done)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).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("done", "error", "metadata", "name", "response")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("done", "name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OperationWorkflowProgressResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationWorkflowProgressResultBody.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 OperationWorkflowProgressResultBody is not found in the empty JSON string", OperationWorkflowProgressResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationWorkflowProgressResultBody.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(); + // validate the optional field `error` + if (jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) { + Status.validateJsonElement(jsonObj.get("error")); + } + // validate the optional field `metadata` + if (jsonObj.get("metadata") != null && !jsonObj.get("metadata").isJsonNull()) { + WorkflowProgress.validateJsonElement(jsonObj.get("metadata")); + } + 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())); + } + // validate the optional field `response` + if (jsonObj.get("response") != null && !jsonObj.get("response").isJsonNull()) { + ResultBody.validateJsonElement(jsonObj.get("response")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationWorkflowProgressResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationWorkflowProgressResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationWorkflowProgressResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationWorkflowProgressResultBody 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 OperationWorkflowProgressResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OperationWorkflowProgressResultBody 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 OperationWorkflowProgressResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationWorkflowProgressResultBody + * @throws IOException if the JSON string is invalid with respect to OperationWorkflowProgressResultBody + */ + public static OperationWorkflowProgressResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationWorkflowProgressResultBody.class); + } + + /** + * Convert an instance of OperationWorkflowProgressResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RenameInputBody.java b/src/main/java/ai/reveng/model/RenameInputBody.java index 228fb626..dd7ca40c 100644 --- a/src/main/java/ai/reveng/model/RenameInputBody.java +++ b/src/main/java/ai/reveng/model/RenameInputBody.java @@ -59,11 +59,6 @@ public class RenameInputBody { @javax.annotation.Nonnull private String newName; - public static final String SERIALIZED_NAME_PRESERVE_AI_DECOMPILATION = "preserve_ai_decompilation"; - @SerializedName(SERIALIZED_NAME_PRESERVE_AI_DECOMPILATION) - @javax.annotation.Nullable - private Boolean preserveAiDecompilation; - public RenameInputBody() { } @@ -105,25 +100,6 @@ public void setNewName(@javax.annotation.Nonnull String newName) { } - public RenameInputBody preserveAiDecompilation(@javax.annotation.Nullable Boolean preserveAiDecompilation) { - this.preserveAiDecompilation = preserveAiDecompilation; - return this; - } - - /** - * Keep the cached AI decompilation, summary and inline comments. Set when the new name comes from the model's own prediction (e.g. Transfer Name) so existing AI output is not discarded and regenerated. - * @return preserveAiDecompilation - */ - @javax.annotation.Nullable - public Boolean getPreserveAiDecompilation() { - return preserveAiDecompilation; - } - - public void setPreserveAiDecompilation(@javax.annotation.Nullable Boolean preserveAiDecompilation) { - this.preserveAiDecompilation = preserveAiDecompilation; - } - - @Override public boolean equals(Object o) { @@ -135,13 +111,12 @@ public boolean equals(Object o) { } RenameInputBody renameInputBody = (RenameInputBody) o; return Objects.equals(this.newMangledName, renameInputBody.newMangledName) && - Objects.equals(this.newName, renameInputBody.newName) && - Objects.equals(this.preserveAiDecompilation, renameInputBody.preserveAiDecompilation); + Objects.equals(this.newName, renameInputBody.newName); } @Override public int hashCode() { - return Objects.hash(newMangledName, newName, preserveAiDecompilation); + return Objects.hash(newMangledName, newName); } @Override @@ -150,7 +125,6 @@ public String toString() { sb.append("class RenameInputBody {\n"); sb.append(" newMangledName: ").append(toIndentedString(newMangledName)).append("\n"); sb.append(" newName: ").append(toIndentedString(newName)).append("\n"); - sb.append(" preserveAiDecompilation: ").append(toIndentedString(preserveAiDecompilation)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,7 +143,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("new_mangled_name", "new_name", "preserve_ai_decompilation")); + openapiFields = new HashSet(Arrays.asList("new_mangled_name", "new_name")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("new_name")); diff --git a/src/main/java/ai/reveng/model/ResultBody.java b/src/main/java/ai/reveng/model/ResultBody.java new file mode 100644 index 00000000..95fc108a --- /dev/null +++ b/src/main/java/ai/reveng/model/ResultBody.java @@ -0,0 +1,395 @@ +/* + * 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.ExtractedBinary; +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.HashMap; +import java.util.List; +import java.util.Map; + +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; + +/** + * ResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ResultBody { + public static final String SERIALIZED_NAME_BINARIES = "binaries"; + @SerializedName(SERIALIZED_NAME_BINARIES) + @javax.annotation.Nullable + private List binaries; + + public static final String SERIALIZED_NAME_EXTRACTION_DEPTH = "extraction_depth"; + @SerializedName(SERIALIZED_NAME_EXTRACTION_DEPTH) + @javax.annotation.Nonnull + private Long extractionDepth; + + public static final String SERIALIZED_NAME_FILENAME_TO_EXTRACTION_FAILURE = "filename_to_extraction_failure"; + @SerializedName(SERIALIZED_NAME_FILENAME_TO_EXTRACTION_FAILURE) + @javax.annotation.Nonnull + private Map filenameToExtractionFailure = new HashMap<>(); + + public static final String SERIALIZED_NAME_SKIPPED_FILES = "skipped_files"; + @SerializedName(SERIALIZED_NAME_SKIPPED_FILES) + @javax.annotation.Nonnull + private Long skippedFiles; + + public ResultBody() { + } + + public ResultBody binaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + return this; + } + + public ResultBody addBinariesItem(ExtractedBinary binariesItem) { + if (this.binaries == null) { + this.binaries = new ArrayList<>(); + } + this.binaries.add(binariesItem); + return this; + } + + /** + * Child binaries recovered from the extraction. + * @return binaries + */ + @javax.annotation.Nullable + public List getBinaries() { + return binaries; + } + + public void setBinaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + } + + + public ResultBody extractionDepth(@javax.annotation.Nonnull Long extractionDepth) { + this.extractionDepth = extractionDepth; + return this; + } + + /** + * Number of nested-archive extraction passes taken. + * @return extractionDepth + */ + @javax.annotation.Nonnull + public Long getExtractionDepth() { + return extractionDepth; + } + + public void setExtractionDepth(@javax.annotation.Nonnull Long extractionDepth) { + this.extractionDepth = extractionDepth; + } + + + public ResultBody filenameToExtractionFailure(@javax.annotation.Nonnull Map filenameToExtractionFailure) { + this.filenameToExtractionFailure = filenameToExtractionFailure; + return this; + } + + public ResultBody putFilenameToExtractionFailureItem(String key, String filenameToExtractionFailureItem) { + if (this.filenameToExtractionFailure == null) { + this.filenameToExtractionFailure = new HashMap<>(); + } + this.filenameToExtractionFailure.put(key, filenameToExtractionFailureItem); + return this; + } + + /** + * Per-file extraction failures, keyed by filename. + * @return filenameToExtractionFailure + */ + @javax.annotation.Nonnull + public Map getFilenameToExtractionFailure() { + return filenameToExtractionFailure; + } + + public void setFilenameToExtractionFailure(@javax.annotation.Nonnull Map filenameToExtractionFailure) { + this.filenameToExtractionFailure = filenameToExtractionFailure; + } + + + public ResultBody skippedFiles(@javax.annotation.Nonnull Long skippedFiles) { + this.skippedFiles = skippedFiles; + return this; + } + + /** + * Files skipped because they were not recognised as binaries. + * @return skippedFiles + */ + @javax.annotation.Nonnull + public Long getSkippedFiles() { + return skippedFiles; + } + + public void setSkippedFiles(@javax.annotation.Nonnull Long skippedFiles) { + this.skippedFiles = skippedFiles; + } + + /** + * 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 ResultBody instance itself + */ + public ResultBody 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; + } + ResultBody resultBody = (ResultBody) o; + return Objects.equals(this.binaries, resultBody.binaries) && + Objects.equals(this.extractionDepth, resultBody.extractionDepth) && + Objects.equals(this.filenameToExtractionFailure, resultBody.filenameToExtractionFailure) && + Objects.equals(this.skippedFiles, resultBody.skippedFiles)&& + Objects.equals(this.additionalProperties, resultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(binaries, extractionDepth, filenameToExtractionFailure, skippedFiles, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResultBody {\n"); + sb.append(" binaries: ").append(toIndentedString(binaries)).append("\n"); + sb.append(" extractionDepth: ").append(toIndentedString(extractionDepth)).append("\n"); + sb.append(" filenameToExtractionFailure: ").append(toIndentedString(filenameToExtractionFailure)).append("\n"); + sb.append(" skippedFiles: ").append(toIndentedString(skippedFiles)).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("binaries", "extraction_depth", "filename_to_extraction_failure", "skipped_files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("binaries", "extraction_depth", "filename_to_extraction_failure", "skipped_files")); + } + + /** + * 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 ResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResultBody.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 ResultBody is not found in the empty JSON string", ResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResultBody.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("binaries") != null && !jsonObj.get("binaries").isJsonNull()) { + if (!jsonObj.get("binaries").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binaries` to be an array in the JSON string but got `%s`", jsonObj.get("binaries").toString())); + } + JsonArray jsonArraybinaries = jsonObj.getAsJsonArray("binaries"); + // validate the required field `binaries` (array) + for (int i = 0; i < jsonArraybinaries.size(); i++) { + ExtractedBinary.validateJsonElement(jsonArraybinaries.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResultBody 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 ResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResultBody 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 ResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResultBody + * @throws IOException if the JSON string is invalid with respect to ResultBody + */ + public static ResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResultBody.class); + } + + /** + * Convert an instance of ResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SecurityScanMetadata.java b/src/main/java/ai/reveng/model/SecurityScanMetadata.java new file mode 100644 index 00000000..fff8ea7d --- /dev/null +++ b/src/main/java/ai/reveng/model/SecurityScanMetadata.java @@ -0,0 +1,322 @@ +/* + * 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 org.openapitools.jackson.nullable.JsonNullable; + +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; + +/** + * SecurityScanMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SecurityScanMetadata { + public static final String SERIALIZED_NAME_LOG_HISTORY = "log_history"; + @SerializedName(SERIALIZED_NAME_LOG_HISTORY) + @javax.annotation.Nullable + private List> logHistory; + + /** + * Run status. UNINITIALISED means the agent has never been triggered for this analysis. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public SecurityScanMetadata() { + } + + public SecurityScanMetadata logHistory(@javax.annotation.Nullable List> logHistory) { + this.logHistory = logHistory; + return this; + } + + public SecurityScanMetadata addLogHistoryItem(List logHistoryItem) { + if (this.logHistory == null) { + this.logHistory = new ArrayList<>(); + } + this.logHistory.add(logHistoryItem); + return this; + } + + /** + * Progress messages the run recorded, oldest first. + * @return logHistory + */ + @javax.annotation.Nullable + public List> getLogHistory() { + return logHistory; + } + + public void setLogHistory(@javax.annotation.Nullable List> logHistory) { + this.logHistory = logHistory; + } + + + public SecurityScanMetadata status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Run status. UNINITIALISED means the agent has never been triggered for this analysis. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityScanMetadata securityScanMetadata = (SecurityScanMetadata) o; + return Objects.equals(this.logHistory, securityScanMetadata.logHistory) && + Objects.equals(this.status, securityScanMetadata.status); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(logHistory, status); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityScanMetadata {\n"); + sb.append(" logHistory: ").append(toIndentedString(logHistory)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("log_history", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SecurityScanMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityScanMetadata.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 SecurityScanMetadata is not found in the empty JSON string", SecurityScanMetadata.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SecurityScanMetadata.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 `SecurityScanMetadata` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityScanMetadata.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("log_history") != null && !jsonObj.get("log_history").isJsonNull() && !jsonObj.get("log_history").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `log_history` to be an array in the JSON string but got `%s`", jsonObj.get("log_history").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())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityScanMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityScanMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SecurityScanMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityScanMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SecurityScanMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SecurityScanMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityScanMetadata + * @throws IOException if the JSON string is invalid with respect to SecurityScanMetadata + */ + public static SecurityScanMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityScanMetadata.class); + } + + /** + * Convert an instance of SecurityScanMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SecurityScanResult.java b/src/main/java/ai/reveng/model/SecurityScanResult.java new file mode 100644 index 00000000..dfc72821 --- /dev/null +++ b/src/main/java/ai/reveng/model/SecurityScanResult.java @@ -0,0 +1,455 @@ +/* + * 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 java.util.HashMap; +import java.util.Map; + +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; + +/** + * SecurityScanResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SecurityScanResult { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_CANCELLED = "cancelled"; + @SerializedName(SERIALIZED_NAME_CANCELLED) + @javax.annotation.Nonnull + private Boolean cancelled; + + public static final String SERIALIZED_NAME_DECOMPILED = "decompiled"; + @SerializedName(SERIALIZED_NAME_DECOMPILED) + @javax.annotation.Nonnull + private Long decompiled; + + public static final String SERIALIZED_NAME_FAILED = "failed"; + @SerializedName(SERIALIZED_NAME_FAILED) + @javax.annotation.Nonnull + private Long failed; + + public static final String SERIALIZED_NAME_SECURITY_SCAN = "security_scan"; + @SerializedName(SERIALIZED_NAME_SECURITY_SCAN) + @javax.annotation.Nullable + private Map securityScan = new HashMap<>(); + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private String source; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public SecurityScanResult() { + } + + public SecurityScanResult analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Analysis the run was performed against + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public SecurityScanResult cancelled(@javax.annotation.Nonnull Boolean cancelled) { + this.cancelled = cancelled; + return this; + } + + /** + * Whether the run was cancelled before it covered every function + * @return cancelled + */ + @javax.annotation.Nonnull + public Boolean getCancelled() { + return cancelled; + } + + public void setCancelled(@javax.annotation.Nonnull Boolean cancelled) { + this.cancelled = cancelled; + } + + + public SecurityScanResult decompiled(@javax.annotation.Nonnull Long decompiled) { + this.decompiled = decompiled; + return this; + } + + /** + * Functions successfully decompiled and scanned + * @return decompiled + */ + @javax.annotation.Nonnull + public Long getDecompiled() { + return decompiled; + } + + public void setDecompiled(@javax.annotation.Nonnull Long decompiled) { + this.decompiled = decompiled; + } + + + public SecurityScanResult failed(@javax.annotation.Nonnull Long failed) { + this.failed = failed; + return this; + } + + /** + * Functions whose decompilation or scan attempt errored + * @return failed + */ + @javax.annotation.Nonnull + public Long getFailed() { + return failed; + } + + public void setFailed(@javax.annotation.Nonnull Long failed) { + this.failed = failed; + } + + + public SecurityScanResult securityScan(@javax.annotation.Nullable Map securityScan) { + this.securityScan = securityScan; + return this; + } + + public SecurityScanResult putSecurityScanItem(String key, Object securityScanItem) { + if (this.securityScan == null) { + this.securityScan = new HashMap<>(); + } + this.securityScan.put(key, securityScanItem); + return this; + } + + /** + * Raw semgrep findings, keyed by the scanner's own result shape + * @return securityScan + */ + @javax.annotation.Nullable + public Map getSecurityScan() { + return securityScan; + } + + public void setSecurityScan(@javax.annotation.Nullable Map securityScan) { + this.securityScan = securityScan; + } + + + public SecurityScanResult source(@javax.annotation.Nonnull String source) { + this.source = source; + return this; + } + + /** + * Decompiler that produced the source scanned + * @return source + */ + @javax.annotation.Nonnull + public String getSource() { + return source; + } + + public void setSource(@javax.annotation.Nonnull String source) { + this.source = source; + } + + + public SecurityScanResult total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Functions the run considered + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + /** + * 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 SecurityScanResult instance itself + */ + public SecurityScanResult 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; + } + SecurityScanResult securityScanResult = (SecurityScanResult) o; + return Objects.equals(this.analysisId, securityScanResult.analysisId) && + Objects.equals(this.cancelled, securityScanResult.cancelled) && + Objects.equals(this.decompiled, securityScanResult.decompiled) && + Objects.equals(this.failed, securityScanResult.failed) && + Objects.equals(this.securityScan, securityScanResult.securityScan) && + Objects.equals(this.source, securityScanResult.source) && + Objects.equals(this.total, securityScanResult.total)&& + Objects.equals(this.additionalProperties, securityScanResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, cancelled, decompiled, failed, securityScan, source, total, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityScanResult {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" cancelled: ").append(toIndentedString(cancelled)).append("\n"); + sb.append(" decompiled: ").append(toIndentedString(decompiled)).append("\n"); + sb.append(" failed: ").append(toIndentedString(failed)).append("\n"); + sb.append(" securityScan: ").append(toIndentedString(securityScan)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_id", "cancelled", "decompiled", "failed", "security_scan", "source", "total")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "cancelled", "decompiled", "failed", "source", "total")); + } + + /** + * 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 SecurityScanResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityScanResult.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 SecurityScanResult is not found in the empty JSON string", SecurityScanResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityScanResult.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("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityScanResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityScanResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SecurityScanResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityScanResult 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 SecurityScanResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityScanResult 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 SecurityScanResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityScanResult + * @throws IOException if the JSON string is invalid with respect to SecurityScanResult + */ + public static SecurityScanResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityScanResult.class); + } + + /** + * Convert an instance of SecurityScanResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ServerSentEventsInner1.java b/src/main/java/ai/reveng/model/ServerSentEventsInner1.java index 74f47afb..cc02fe36 100644 --- a/src/main/java/ai/reveng/model/ServerSentEventsInner1.java +++ b/src/main/java/ai/reveng/model/ServerSentEventsInner1.java @@ -17,6 +17,7 @@ import ai.reveng.model.EventAttemptStarted; import ai.reveng.model.EventDecompFailed; import ai.reveng.model.EventDecompFinished; +import ai.reveng.model.EventNamesFinished; import ai.reveng.model.EventProse; import ai.reveng.model.EventRenameApplied; import ai.reveng.model.EventSourceDelta; @@ -82,6 +83,7 @@ public TypeAdapter create(Gson gson, TypeToken type) { final TypeAdapter adapterEventAttemptStarted = gson.getDelegateAdapter(this, TypeToken.get(EventAttemptStarted.class)); final TypeAdapter adapterEventDecompFailed = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFailed.class)); final TypeAdapter adapterEventDecompFinished = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFinished.class)); + final TypeAdapter adapterEventNamesFinished = gson.getDelegateAdapter(this, TypeToken.get(EventNamesFinished.class)); final TypeAdapter adapterEventProse = gson.getDelegateAdapter(this, TypeToken.get(EventProse.class)); final TypeAdapter adapterEventRenameApplied = gson.getDelegateAdapter(this, TypeToken.get(EventRenameApplied.class)); final TypeAdapter adapterEventSourceDelta = gson.getDelegateAdapter(this, TypeToken.get(EventSourceDelta.class)); @@ -120,6 +122,12 @@ public void write(JsonWriter out, ServerSentEventsInner1 value) throws IOExcepti elementAdapter.write(out, element); return; } + // check if the actual instance is of the type `EventNamesFinished` + if (value.getActualInstance() instanceof EventNamesFinished) { + JsonElement element = adapterEventNamesFinished.toJsonTree((EventNamesFinished)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } // check if the actual instance is of the type `EventProse` if (value.getActualInstance() instanceof EventProse) { JsonElement element = adapterEventProse.toJsonTree((EventProse)value.getActualInstance()); @@ -150,7 +158,7 @@ public void write(JsonWriter out, ServerSentEventsInner1 value) throws IOExcepti elementAdapter.write(out, element); return; } - throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); } @Override @@ -210,6 +218,18 @@ public ServerSentEventsInner1 read(JsonReader in) throws IOException { errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventDecompFinished failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'EventDecompFinished'", e); } + // deserialize EventNamesFinished + try { + // validate the JSON object to see if any exception is thrown + EventNamesFinished.validateJsonElement(jsonElement); + actualAdapter = adapterEventNamesFinished; + match++; + log.log(Level.FINER, "Input data matches schema 'EventNamesFinished'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventNamesFinished failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventNamesFinished'", e); + } // deserialize EventProse try { // validate the JSON object to see if any exception is thrown @@ -300,6 +320,7 @@ public ServerSentEventsInner1(Object o) { schemas.put("EventAttemptStarted", EventAttemptStarted.class); schemas.put("EventDecompFailed", EventDecompFailed.class); schemas.put("EventDecompFinished", EventDecompFinished.class); + schemas.put("EventNamesFinished", EventNamesFinished.class); schemas.put("EventProse", EventProse.class); schemas.put("EventRenameApplied", EventRenameApplied.class); schemas.put("EventSourceDelta", EventSourceDelta.class); @@ -315,7 +336,7 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: - * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning + * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning * * It could be an instance of the 'oneOf' schemas. */ @@ -341,6 +362,11 @@ public void setActualInstance(Object instance) { return; } + if (instance instanceof EventNamesFinished) { + super.setActualInstance(instance); + return; + } + if (instance instanceof EventProse) { super.setActualInstance(instance); return; @@ -366,14 +392,14 @@ public void setActualInstance(Object instance) { return; } - throw new RuntimeException("Invalid instance type. Must be EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); + throw new RuntimeException("Invalid instance type. Must be EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); } /** * Get the actual instance, which can be the following: - * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning + * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning * - * @return The actual instance (EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning) + * @return The actual instance (EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning) */ @SuppressWarnings("unchecked") @Override @@ -429,6 +455,18 @@ public EventDecompFinished getEventDecompFinished() throws ClassCastException { return (EventDecompFinished)super.getActualInstance(); } + /** + * Get the actual instance of `EventNamesFinished`. If the actual instance is not `EventNamesFinished`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventNamesFinished` + * @throws ClassCastException if the instance is not `EventNamesFinished` + */ + @SuppressWarnings("unchecked") + public EventNamesFinished getEventNamesFinished() throws ClassCastException { + return (EventNamesFinished)super.getActualInstance(); + } + /** * Get the actual instance of `EventProse`. If the actual instance is not `EventProse`, * the ClassCastException will be thrown. @@ -531,6 +569,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventDecompFinished failed with `%s`.", e.getMessage())); // continue to the next one } + // validate the json string with EventNamesFinished + try { + EventNamesFinished.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventNamesFinished failed with `%s`.", e.getMessage())); + // continue to the next one + } // validate the json string with EventProse try { EventProse.validateJsonElement(jsonElement); @@ -572,7 +618,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // continue to the next one } if (validCount != 1) { - throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for ServerSentEventsInner1 with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for ServerSentEventsInner1 with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } diff --git a/src/main/java/ai/reveng/model/Status.java b/src/main/java/ai/reveng/model/Status.java new file mode 100644 index 00000000..0a62013c --- /dev/null +++ b/src/main/java/ai/reveng/model/Status.java @@ -0,0 +1,457 @@ +/* + * 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; + +/** + * Status + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Status { + /** + * Machine-readable error code, shared with synchronous API errors. + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + ACCESS_DENIED("ACCESS_DENIED"), + + AGENT_BUDGET_EXCEEDED("AGENT_BUDGET_EXCEEDED"), + + AGENT_DEFINITION_NOT_FOUND("AGENT_DEFINITION_NOT_FOUND"), + + AGENT_INVALID_STARTING_INPUT("AGENT_INVALID_STARTING_INPUT"), + + AGENT_MEMORY_INVALID_SCOPE("AGENT_MEMORY_INVALID_SCOPE"), + + AGENT_MEMORY_NOT_FOUND("AGENT_MEMORY_NOT_FOUND"), + + AGENT_MEMORY_VERSION_CONFLICT("AGENT_MEMORY_VERSION_CONFLICT"), + + AGENT_NO_PENDING_QUESTION("AGENT_NO_PENDING_QUESTION"), + + AGENT_RUN_NOT_FOUND("AGENT_RUN_NOT_FOUND"), + + ALREADY_EXISTS("ALREADY_EXISTS"), + + ANALYSIS_NOT_READY("ANALYSIS_NOT_READY"), + + BAD_REQUEST("BAD_REQUEST"), + + CLIENT_CLOSED_REQUEST("CLIENT_CLOSED_REQUEST"), + + CONFLICT("CONFLICT"), + + CONVERSATION_NOT_FOUND("CONVERSATION_NOT_FOUND"), + + DOMAIN_ALREADY_CLAIMED("DOMAIN_ALREADY_CLAIMED"), + + DOMAIN_VERIFICATION_PENDING("DOMAIN_VERIFICATION_PENDING"), + + DYNAMIC_EXECUTION_INCOMPLETE("DYNAMIC_EXECUTION_INCOMPLETE"), + + EMAIL_NOT_VERIFIED("EMAIL_NOT_VERIFIED"), + + EXTERNAL_USER("EXTERNAL_USER"), + + FORBIDDEN("FORBIDDEN"), + + GATEWAY_TIMEOUT("GATEWAY_TIMEOUT"), + + GROUP_HAS_MEMBERS("GROUP_HAS_MEMBERS"), + + INSUFFICIENT_CREDITS("INSUFFICIENT_CREDITS"), + + INTERNAL_ERROR("INTERNAL_ERROR"), + + INTERNAL_ISSUER("INTERNAL_ISSUER"), + + INVALID_CONVERSATION_ID("INVALID_CONVERSATION_ID"), + + INVALID_CREDENTIALS("INVALID_CREDENTIALS"), + + INVALID_INVITE_CODE("INVALID_INVITE_CODE"), + + INVALID_RESET_CODE("INVALID_RESET_CODE"), + + LAST_ORG_OWNER("LAST_ORG_OWNER"), + + LAST_TEAM_ADMIN("LAST_TEAM_ADMIN"), + + LAST_TEAM_MEMBER("LAST_TEAM_MEMBER"), + + LINKED_TO_ORG("LINKED_TO_ORG"), + + METHOD_NOT_ALLOWED("METHOD_NOT_ALLOWED"), + + NOT_ACCEPTABLE("NOT_ACCEPTABLE"), + + NOT_FOUND("NOT_FOUND"), + + NO_ACTIVE_RUN("NO_ACTIVE_RUN"), + + NO_PENDING_CONFIRMATION("NO_PENDING_CONFIRMATION"), + + OIDC_DISCOVERY_FAILED("OIDC_DISCOVERY_FAILED"), + + PASSWORD_RESET_REQUIRED("PASSWORD_RESET_REQUIRED"), + + PAYMENT_REQUIRED("PAYMENT_REQUIRED"), + + REPORT_RENDER_FAILED("REPORT_RENDER_FAILED"), + + REQUEST_ENTITY_TOO_LARGE("REQUEST_ENTITY_TOO_LARGE"), + + RUN_ALREADY_ACTIVE("RUN_ALREADY_ACTIVE"), + + SELF_DELETION_NOT_ALLOWED("SELF_DELETION_NOT_ALLOWED"), + + SERVICE_UNAVAILABLE("SERVICE_UNAVAILABLE"), + + TOKEN_EXPIRED("TOKEN_EXPIRED"), + + TOKEN_REUSED("TOKEN_REUSED"), + + TOO_MANY_REQUESTS("TOO_MANY_REQUESTS"), + + UNAUTHORIZED("UNAUTHORIZED"), + + UNSUPPORTED_MEDIA_TYPE("UNSUPPORTED_MEDIA_TYPE"), + + VALIDATION_FAILED("VALIDATION_FAILED"), + + VERIFICATION_EXPIRED("VERIFICATION_EXPIRED"), + + VERIFICATION_NOT_FOUND("VERIFICATION_NOT_FOUND"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private CodeEnum code; + + public static final String SERIALIZED_NAME_DETAIL = "detail"; + @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nullable + private String detail; + + public static final String SERIALIZED_NAME_DOC_URL = "doc_url"; + @SerializedName(SERIALIZED_NAME_DOC_URL) + @javax.annotation.Nonnull + private String docUrl; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public Status() { + } + + public Status code(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + return this; + } + + /** + * Machine-readable error code, shared with synchronous API errors. + * @return code + */ + @javax.annotation.Nonnull + public CodeEnum getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + } + + + public Status detail(@javax.annotation.Nullable String detail) { + this.detail = detail; + return this; + } + + /** + * Additional context where helpful (quota numbers, validation specifics, etc.). + * @return detail + */ + @javax.annotation.Nullable + public String getDetail() { + return detail; + } + + public void setDetail(@javax.annotation.Nullable String detail) { + this.detail = detail; + } + + + public Status docUrl(@javax.annotation.Nonnull String docUrl) { + this.docUrl = docUrl; + return this; + } + + /** + * Link to documentation explaining this error and resolution steps. + * @return docUrl + */ + @javax.annotation.Nonnull + public String getDocUrl() { + return docUrl; + } + + public void setDocUrl(@javax.annotation.Nonnull String docUrl) { + this.docUrl = docUrl; + } + + + public Status message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Brief description of the failure. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Status status = (Status) o; + return Objects.equals(this.code, status.code) && + Objects.equals(this.detail, status.detail) && + Objects.equals(this.docUrl, status.docUrl) && + Objects.equals(this.message, status.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, detail, docUrl, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Status {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" docUrl: ").append(toIndentedString(docUrl)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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("code", "detail", "doc_url", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "doc_url", "message")); + } + + /** + * 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 Status + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Status.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 Status is not found in the empty JSON string", Status.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Status.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 `Status` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Status.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("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // validate the required field `code` + CodeEnum.validateJsonElement(jsonObj.get("code")); + if ((jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) && !jsonObj.get("detail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detail").toString())); + } + if (!jsonObj.get("doc_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `doc_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("doc_url").toString())); + } + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Status.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Status' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Status.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Status value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Status read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Status given an JSON string + * + * @param jsonString JSON string + * @return An instance of Status + * @throws IOException if the JSON string is invalid with respect to Status + */ + public static Status fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Status.class); + } + + /** + * Convert an instance of Status to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TriggerSecurityScanInputBody.java b/src/main/java/ai/reveng/model/TriggerSecurityScanInputBody.java new file mode 100644 index 00000000..bf0cb2be --- /dev/null +++ b/src/main/java/ai/reveng/model/TriggerSecurityScanInputBody.java @@ -0,0 +1,199 @@ +/* + * 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; + +/** + * TriggerSecurityScanInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TriggerSecurityScanInputBody { + public static final String SERIALIZED_NAME_MAX_FUNCTIONS_TO_SCAN = "max_functions_to_scan"; + @SerializedName(SERIALIZED_NAME_MAX_FUNCTIONS_TO_SCAN) + @javax.annotation.Nullable + private Long maxFunctionsToScan; + + public TriggerSecurityScanInputBody() { + } + + public TriggerSecurityScanInputBody maxFunctionsToScan(@javax.annotation.Nullable Long maxFunctionsToScan) { + this.maxFunctionsToScan = maxFunctionsToScan; + return this; + } + + /** + * Stop after decompiling and scanning this many functions. Omit to process every function in the analysis. + * minimum: 1 + * @return maxFunctionsToScan + */ + @javax.annotation.Nullable + public Long getMaxFunctionsToScan() { + return maxFunctionsToScan; + } + + public void setMaxFunctionsToScan(@javax.annotation.Nullable Long maxFunctionsToScan) { + this.maxFunctionsToScan = maxFunctionsToScan; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TriggerSecurityScanInputBody triggerSecurityScanInputBody = (TriggerSecurityScanInputBody) o; + return Objects.equals(this.maxFunctionsToScan, triggerSecurityScanInputBody.maxFunctionsToScan); + } + + @Override + public int hashCode() { + return Objects.hash(maxFunctionsToScan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriggerSecurityScanInputBody {\n"); + sb.append(" maxFunctionsToScan: ").append(toIndentedString(maxFunctionsToScan)).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("max_functions_to_scan")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 TriggerSecurityScanInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TriggerSecurityScanInputBody.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 TriggerSecurityScanInputBody is not found in the empty JSON string", TriggerSecurityScanInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TriggerSecurityScanInputBody.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 `TriggerSecurityScanInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TriggerSecurityScanInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TriggerSecurityScanInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TriggerSecurityScanInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TriggerSecurityScanInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TriggerSecurityScanInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TriggerSecurityScanInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of TriggerSecurityScanInputBody + * @throws IOException if the JSON string is invalid with respect to TriggerSecurityScanInputBody + */ + public static TriggerSecurityScanInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TriggerSecurityScanInputBody.class); + } + + /** + * Convert an instance of TriggerSecurityScanInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +