From 67b5f0a873db418398304118b4c7b276399bf627 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Mar 2026 14:21:43 +0000 Subject: [PATCH] Update SDK to version v3.55.0 - Generated from OpenAPI spec version v3.55.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 8 +- build.gradle | 4 +- build.sbt | 2 +- docs/AnalysesCoreApi.md | 73 ++++ docs/AnalysisStringInput.md | 16 + docs/FunctionString.md | 1 + docs/FunctionsAiDecompilationApi.md | 4 +- docs/PutAnalysisStringsRequest.md | 13 + docs/StringFunctions.md | 1 + docs/StringSource.md | 15 + pom.xml | 2 +- .../java/ai/reveng/api/AnalysesCoreApi.java | 142 +++++++ .../api/FunctionsAiDecompilationApi.java | 8 +- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 2 + .../AnalysisFunctionMatchingRequest.java | 6 +- .../ai/reveng/model/AnalysisStringInput.java | 349 ++++++++++++++++++ .../ai/reveng/model/AutoUnstripRequest.java | 12 +- .../reveng/model/FunctionMatchingRequest.java | 6 +- .../java/ai/reveng/model/FunctionString.java | 37 +- .../java/ai/reveng/model/NameConfidence.java | 4 +- .../model/PutAnalysisStringsRequest.java | 312 ++++++++++++++++ .../java/ai/reveng/model/StringFunctions.java | 37 +- .../java/ai/reveng/model/StringSource.java | 81 ++++ 26 files changed, 1106 insertions(+), 35 deletions(-) create mode 100644 docs/AnalysisStringInput.md create mode 100644 docs/PutAnalysisStringsRequest.md create mode 100644 docs/StringSource.md create mode 100644 src/main/java/ai/reveng/model/AnalysisStringInput.java create mode 100644 src/main/java/ai/reveng/model/PutAnalysisStringsRequest.java create mode 100644 src/main/java/ai/reveng/model/StringSource.java diff --git a/.sdk-version b/.sdk-version index 100a28e..304e303 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.51.0 +v3.55.0 diff --git a/README.md b/README.md index 349dfac..fad1208 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.51.0 + 3.55.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.51.0" + implementation "ai.reveng:sdk:3.55.0" } ``` @@ -91,6 +91,7 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**insertAnalysisLog**](docs/AnalysesCoreApi.md#insertAnalysisLog) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis *AnalysesCoreApi* | [**listAnalyses**](docs/AnalysesCoreApi.md#listAnalyses) | **GET** /v2/analyses/list | Gets the most recent analyses *AnalysesCoreApi* | [**lookupBinaryId**](docs/AnalysesCoreApi.md#lookupBinaryId) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID +*AnalysesCoreApi* | [**putAnalysisStrings**](docs/AnalysesCoreApi.md#putAnalysisStrings) | **PUT** /v2/analyses/{analysis_id}/strings | Add strings to the analysis *AnalysesCoreApi* | [**requeueAnalysis**](docs/AnalysesCoreApi.md#requeueAnalysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis *AnalysesCoreApi* | [**updateAnalysis**](docs/AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis *AnalysesCoreApi* | [**updateAnalysisTags**](docs/AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags @@ -213,6 +214,7 @@ Class | Method | HTTP request | Description - [AnalysisStage](docs/AnalysisStage.md) - [AnalysisStageStatus](docs/AnalysisStageStatus.md) - [AnalysisStagesResponse](docs/AnalysisStagesResponse.md) + - [AnalysisStringInput](docs/AnalysisStringInput.md) - [AnalysisStringsResponse](docs/AnalysisStringsResponse.md) - [AnalysisStringsStatusResponse](docs/AnalysisStringsStatusResponse.md) - [AnalysisTags](docs/AnalysisTags.md) @@ -452,6 +454,7 @@ Class | Method | HTTP request | Description - [ProcessDumpsData](docs/ProcessDumpsData.md) - [ProcessRegistry](docs/ProcessRegistry.md) - [ProcessTree](docs/ProcessTree.md) + - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) - [QueuedSecurityChecksTaskResponse](docs/QueuedSecurityChecksTaskResponse.md) - [ReAnalysisForm](docs/ReAnalysisForm.md) - [Recent](docs/Recent.md) @@ -477,6 +480,7 @@ Class | Method | HTTP request | Description - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) - [StringFunctions](docs/StringFunctions.md) + - [StringSource](docs/StringSource.md) - [Structure](docs/Structure.md) - [StructureMember](docs/StructureMember.md) - [Symbols](docs/Symbols.md) diff --git a/build.gradle b/build.gradle index 9382fc1..8f4b502 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.51.0' +version = '3.55.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.51.0") + coordinates("ai.reveng", "sdk", "3.55.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 344cf63..35c733d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.51.0", + version := "3.55.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 4efd09e..97d800a 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -15,6 +15,7 @@ All URIs are relative to *https://api.reveng.ai* | [**insertAnalysisLog**](AnalysesCoreApi.md#insertAnalysisLog) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis | | [**listAnalyses**](AnalysesCoreApi.md#listAnalyses) | **GET** /v2/analyses/list | Gets the most recent analyses | | [**lookupBinaryId**](AnalysesCoreApi.md#lookupBinaryId) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID | +| [**putAnalysisStrings**](AnalysesCoreApi.md#putAnalysisStrings) | **PUT** /v2/analyses/{analysis_id}/strings | Add strings to the analysis | | [**requeueAnalysis**](AnalysesCoreApi.md#requeueAnalysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis | | [**updateAnalysis**](AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis | | [**updateAnalysisTags**](AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags | @@ -819,6 +820,78 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **putAnalysisStrings** +> BaseResponse putAnalysisStrings(analysisId, putAnalysisStringsRequest) + +Add strings to the analysis + +Add strings to the analysis. Rejects if any string already exists at the given vaddr. + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + Integer analysisId = 56; // Integer | + PutAnalysisStringsRequest putAnalysisStringsRequest = new PutAnalysisStringsRequest(); // PutAnalysisStringsRequest | + try { + BaseResponse result = apiInstance.putAnalysisStrings(analysisId, putAnalysisStringsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#putAnalysisStrings"); + 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** | **Integer**| | | +| **putAnalysisStringsRequest** | [**PutAnalysisStringsRequest**](PutAnalysisStringsRequest.md)| | | + +### Return type + +[**BaseResponse**](BaseResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Successful Response | - | +| **422** | Invalid request parameters | - | + # **requeueAnalysis** > BaseResponseCreated requeueAnalysis(analysisId, reAnalysisForm, xRevEngApplication) diff --git a/docs/AnalysisStringInput.md b/docs/AnalysisStringInput.md new file mode 100644 index 0000000..b87b8c1 --- /dev/null +++ b/docs/AnalysisStringInput.md @@ -0,0 +1,16 @@ + + +# AnalysisStringInput + +Input model for inserting a string into an analysis. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | **String** | The string literal value | | +|**vaddr** | **Integer** | The virtual address of the string | | +|**source** | **StringSource** | The source of the string | | + + + diff --git a/docs/FunctionString.md b/docs/FunctionString.md index 926f4f6..30fca47 100644 --- a/docs/FunctionString.md +++ b/docs/FunctionString.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**value** | **String** | The value of the string literal | | |**vaddr** | **Integer** | The vaddr of the string value | | +|**source** | **StringSource** | The source of the string | [optional] | diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index 78272e5..085d653 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -406,7 +406,7 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | The ID of the function being decompiled Boolean summarise = true; // Boolean | Generate a summary for the decompilation - Boolean generateInlineComments = true; // Boolean | Generate inline comments for the decompilation (only works if summarise is enabled) + Boolean generateInlineComments = true; // Boolean | Generate inline comments for the decompilation try { BaseResponseGetAiDecompilationTask result = apiInstance.getAiDecompilationTaskResult(functionId, summarise, generateInlineComments); System.out.println(result); @@ -427,7 +427,7 @@ public class Example { |------------- | ------------- | ------------- | -------------| | **functionId** | **Long**| The ID of the function being decompiled | | | **summarise** | **Boolean**| Generate a summary for the decompilation | [optional] [default to true] | -| **generateInlineComments** | **Boolean**| Generate inline comments for the decompilation (only works if summarise is enabled) | [optional] [default to true] | +| **generateInlineComments** | **Boolean**| Generate inline comments for the decompilation | [optional] [default to true] | ### Return type diff --git a/docs/PutAnalysisStringsRequest.md b/docs/PutAnalysisStringsRequest.md new file mode 100644 index 0000000..b9f2669 --- /dev/null +++ b/docs/PutAnalysisStringsRequest.md @@ -0,0 +1,13 @@ + + +# PutAnalysisStringsRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**strings** | [**List<AnalysisStringInput>**](AnalysisStringInput.md) | The strings to add to the analysis | | + + + diff --git a/docs/StringFunctions.md b/docs/StringFunctions.md index 768bb1b..dff7184 100644 --- a/docs/StringFunctions.md +++ b/docs/StringFunctions.md @@ -10,6 +10,7 @@ This is a string with the functions where the string is used. A function string |------------ | ------------- | ------------- | -------------| |**value** | **String** | The value of the string literal | | |**functions** | [**List<AppApiRestV2FunctionsResponsesFunction>**](AppApiRestV2FunctionsResponsesFunction.md) | The function ids the string literal was found within | | +|**source** | **StringSource** | The source of the string | [optional] | diff --git a/docs/StringSource.md b/docs/StringSource.md new file mode 100644 index 0000000..69db71a --- /dev/null +++ b/docs/StringSource.md @@ -0,0 +1,15 @@ + + +# StringSource + +## Enum + + +* `SYSTEM` (value: `"SYSTEM"`) + +* `USER` (value: `"USER"`) + +* `AI_AGENT` (value: `"AI_AGENT"`) + + + diff --git a/pom.xml b/pom.xml index 66de9db..63aed7c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.51.0 + 3.55.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index f73b838..cff6327 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -50,6 +50,7 @@ import ai.reveng.model.InsertAnalysisLogRequest; import ai.reveng.model.ModelName; import ai.reveng.model.Order; +import ai.reveng.model.PutAnalysisStringsRequest; import ai.reveng.model.ReAnalysisForm; import ai.reveng.model.StatusInput; import ai.reveng.model.UploadFileType; @@ -1652,6 +1653,147 @@ public okhttp3.Call lookupBinaryIdAsync(@javax.annotation.Nonnull Integer binary localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for putAnalysisStrings + * @param analysisId (required) + * @param putAnalysisStringsRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call putAnalysisStringsCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull PutAnalysisStringsRequest putAnalysisStringsRequest, 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 = putAnalysisStringsRequest; + + // create path and map variables + String localVarPath = "/v2/analyses/{analysis_id}/strings" + .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" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAnalysisStringsValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull PutAnalysisStringsRequest putAnalysisStringsRequest, 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 putAnalysisStrings(Async)"); + } + + // verify the required parameter 'putAnalysisStringsRequest' is set + if (putAnalysisStringsRequest == null) { + throw new ApiException("Missing the required parameter 'putAnalysisStringsRequest' when calling putAnalysisStrings(Async)"); + } + + return putAnalysisStringsCall(analysisId, putAnalysisStringsRequest, _callback); + + } + + /** + * Add strings to the analysis + * Add strings to the analysis. Rejects if any string already exists at the given vaddr. + * @param analysisId (required) + * @param putAnalysisStringsRequest (required) + * @return BaseResponse + * @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
201 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponse putAnalysisStrings(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull PutAnalysisStringsRequest putAnalysisStringsRequest) throws ApiException { + ApiResponse localVarResp = putAnalysisStringsWithHttpInfo(analysisId, putAnalysisStringsRequest); + return localVarResp.getData(); + } + + /** + * Add strings to the analysis + * Add strings to the analysis. Rejects if any string already exists at the given vaddr. + * @param analysisId (required) + * @param putAnalysisStringsRequest (required) + * @return ApiResponse<BaseResponse> + * @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
201 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse putAnalysisStringsWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull PutAnalysisStringsRequest putAnalysisStringsRequest) throws ApiException { + okhttp3.Call localVarCall = putAnalysisStringsValidateBeforeCall(analysisId, putAnalysisStringsRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add strings to the analysis (asynchronously) + * Add strings to the analysis. Rejects if any string already exists at the given vaddr. + * @param analysisId (required) + * @param putAnalysisStringsRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call putAnalysisStringsAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull PutAnalysisStringsRequest putAnalysisStringsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAnalysisStringsValidateBeforeCall(analysisId, putAnalysisStringsRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for requeueAnalysis * @param analysisId (required) diff --git a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java index 7b59eac..42aa01b 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -787,7 +787,7 @@ public okhttp3.Call getAiDecompilationRatingAsync(@javax.annotation.Nonnull Long * Build call for getAiDecompilationTaskResult * @param functionId The ID of the function being decompiled (required) * @param summarise Generate a summary for the decompilation (optional, default to true) - * @param generateInlineComments Generate inline comments for the decompilation (only works if summarise is enabled) (optional, default to true) + * @param generateInlineComments Generate inline comments for the decompilation (optional, default to true) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -869,7 +869,7 @@ private okhttp3.Call getAiDecompilationTaskResultValidateBeforeCall(@javax.annot * Polls the AI Decompilation Process * @param functionId The ID of the function being decompiled (required) * @param summarise Generate a summary for the decompilation (optional, default to true) - * @param generateInlineComments Generate inline comments for the decompilation (only works if summarise is enabled) (optional, default to true) + * @param generateInlineComments Generate inline comments for the decompilation (optional, default to true) * @return BaseResponseGetAiDecompilationTask * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -891,7 +891,7 @@ public BaseResponseGetAiDecompilationTask getAiDecompilationTaskResult(@javax.an * Polls the AI Decompilation Process * @param functionId The ID of the function being decompiled (required) * @param summarise Generate a summary for the decompilation (optional, default to true) - * @param generateInlineComments Generate inline comments for the decompilation (only works if summarise is enabled) (optional, default to true) + * @param generateInlineComments Generate inline comments for the decompilation (optional, default to true) * @return ApiResponse<BaseResponseGetAiDecompilationTask> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -914,7 +914,7 @@ public ApiResponse getAiDecompilationTaskRes * Polls the AI Decompilation Process * @param functionId The ID of the function being decompiled (required) * @param summarise Generate a summary for the decompilation (optional, default to true) - * @param generateInlineComments Generate inline comments for the decompilation (only works if summarise is enabled) (optional, default to true) + * @param generateInlineComments Generate inline comments for the decompilation (optional, default to true) * @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 diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 864b7bf..517beb4 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -146,7 +146,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.51.0/java"); + setUserAgent("OpenAPI-Generator/3.55.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 a07d2bd..b8b1385 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.51.0"; + public static final String VERSION = "3.55.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 e6e80f9..04c71dd 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -115,6 +115,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStagesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTags.CustomTypeAdapterFactory()); @@ -337,6 +338,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessDumpsData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessRegistry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessTree.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PutAnalysisStringsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuedSecurityChecksTaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReAnalysisForm.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Recent.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisFunctionMatchingRequest.java b/src/main/java/ai/reveng/model/AnalysisFunctionMatchingRequest.java index 846158b..c2d1fd5 100644 --- a/src/main/java/ai/reveng/model/AnalysisFunctionMatchingRequest.java +++ b/src/main/java/ai/reveng/model/AnalysisFunctionMatchingRequest.java @@ -57,7 +57,7 @@ public class AnalysisFunctionMatchingRequest { public static final String SERIALIZED_NAME_MIN_SIMILARITY = "min_similarity"; @SerializedName(SERIALIZED_NAME_MIN_SIMILARITY) @javax.annotation.Nullable - private BigDecimal minSimilarity = new BigDecimal("90.0"); + private BigDecimal minSimilarity = new BigDecimal("90"); public static final String SERIALIZED_NAME_FILTERS = "filters"; @SerializedName(SERIALIZED_NAME_FILTERS) @@ -107,8 +107,8 @@ public AnalysisFunctionMatchingRequest minSimilarity(@javax.annotation.Nullable /** * Minimum similarity expected for a match as a percentage, default is 90 - * minimum: 0.0 - * maximum: 100.0 + * minimum: 0 + * maximum: 100 * @return minSimilarity */ @javax.annotation.Nullable diff --git a/src/main/java/ai/reveng/model/AnalysisStringInput.java b/src/main/java/ai/reveng/model/AnalysisStringInput.java new file mode 100644 index 0000000..2d36b61 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisStringInput.java @@ -0,0 +1,349 @@ +/* + * 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 java.util.Locale; +import ai.reveng.model.StringSource; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * Input model for inserting a string into an analysis. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisStringInput { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nonnull + private Integer vaddr; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private StringSource source; + + public AnalysisStringInput() { + } + + public AnalysisStringInput value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * The string literal value + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + public AnalysisStringInput vaddr(@javax.annotation.Nonnull Integer vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * The virtual address of the string + * @return vaddr + */ + @javax.annotation.Nonnull + public Integer getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nonnull Integer vaddr) { + this.vaddr = vaddr; + } + + + public AnalysisStringInput source(@javax.annotation.Nonnull StringSource source) { + this.source = source; + return this; + } + + /** + * The source of the string + * @return source + */ + @javax.annotation.Nonnull + public StringSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nonnull StringSource source) { + this.source = source; + } + + /** + * 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 AnalysisStringInput instance itself + */ + public AnalysisStringInput 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; + } + AnalysisStringInput analysisStringInput = (AnalysisStringInput) o; + return Objects.equals(this.value, analysisStringInput.value) && + Objects.equals(this.vaddr, analysisStringInput.vaddr) && + Objects.equals(this.source, analysisStringInput.source)&& + Objects.equals(this.additionalProperties, analysisStringInput.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(value, vaddr, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisStringInput {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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) { + if (o == null) { + return "null"; + } + return 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("value", "vaddr", "source")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value", "vaddr", "source")); + } + + /** + * 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 AnalysisStringInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisStringInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AnalysisStringInput is not found in the empty JSON string", AnalysisStringInput.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisStringInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + // validate the required field `source` + StringSource.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisStringInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisStringInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisStringInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisStringInput 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 AnalysisStringInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisStringInput 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(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 AnalysisStringInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisStringInput + * @throws IOException if the JSON string is invalid with respect to AnalysisStringInput + */ + public static AnalysisStringInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisStringInput.class); + } + + /** + * Convert an instance of AnalysisStringInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AutoUnstripRequest.java b/src/main/java/ai/reveng/model/AutoUnstripRequest.java index c8e0dd3..51045f7 100644 --- a/src/main/java/ai/reveng/model/AutoUnstripRequest.java +++ b/src/main/java/ai/reveng/model/AutoUnstripRequest.java @@ -56,7 +56,7 @@ public class AutoUnstripRequest { @Deprecated @SerializedName(SERIALIZED_NAME_MIN_SIMILARITY) @javax.annotation.Nullable - private BigDecimal minSimilarity = new BigDecimal("90.0"); + private BigDecimal minSimilarity = new BigDecimal("90"); public static final String SERIALIZED_NAME_APPLY = "apply"; @Deprecated @@ -68,7 +68,7 @@ public class AutoUnstripRequest { @Deprecated @SerializedName(SERIALIZED_NAME_CONFIDENCE_THRESHOLD) @javax.annotation.Nullable - private BigDecimal confidenceThreshold = new BigDecimal("90.0"); + private BigDecimal confidenceThreshold = new BigDecimal("90"); public static final String SERIALIZED_NAME_MIN_GROUP_SIZE = "min_group_size"; @Deprecated @@ -104,8 +104,8 @@ public AutoUnstripRequest minSimilarity(@javax.annotation.Nullable BigDecimal mi /** * Minimum similarity expected for a match as a percentage, default is 90 - * minimum: 0.0 - * maximum: 100.0 + * minimum: 0 + * maximum: 100 * @return minSimilarity * @deprecated */ @@ -152,8 +152,8 @@ public AutoUnstripRequest confidenceThreshold(@javax.annotation.Nullable BigDeci /** * Confidence threshold for applying function names as a percentage, default is 90 - * minimum: 0.0 - * maximum: 100.0 + * minimum: 0 + * maximum: 100 * @return confidenceThreshold * @deprecated */ diff --git a/src/main/java/ai/reveng/model/FunctionMatchingRequest.java b/src/main/java/ai/reveng/model/FunctionMatchingRequest.java index 87f8297..cf77eb0 100644 --- a/src/main/java/ai/reveng/model/FunctionMatchingRequest.java +++ b/src/main/java/ai/reveng/model/FunctionMatchingRequest.java @@ -69,7 +69,7 @@ public class FunctionMatchingRequest { public static final String SERIALIZED_NAME_MIN_SIMILARITY = "min_similarity"; @SerializedName(SERIALIZED_NAME_MIN_SIMILARITY) @javax.annotation.Nullable - private BigDecimal minSimilarity = new BigDecimal("90.0"); + private BigDecimal minSimilarity = new BigDecimal("90"); public static final String SERIALIZED_NAME_FILTERS = "filters"; @SerializedName(SERIALIZED_NAME_FILTERS) @@ -165,8 +165,8 @@ public FunctionMatchingRequest minSimilarity(@javax.annotation.Nullable BigDecim /** * Minimum similarity expected for a match as a percentage, default is 90 - * minimum: 0.0 - * maximum: 100.0 + * minimum: 0 + * maximum: 100 * @return minSimilarity */ @javax.annotation.Nullable diff --git a/src/main/java/ai/reveng/model/FunctionString.java b/src/main/java/ai/reveng/model/FunctionString.java index e3b2640..34af80a 100644 --- a/src/main/java/ai/reveng/model/FunctionString.java +++ b/src/main/java/ai/reveng/model/FunctionString.java @@ -14,6 +14,7 @@ import java.util.Objects; import java.util.Locale; +import ai.reveng.model.StringSource; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -61,6 +62,11 @@ public class FunctionString { @javax.annotation.Nonnull private Integer vaddr; + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private StringSource source; + public FunctionString() { } @@ -101,6 +107,25 @@ public void setVaddr(@javax.annotation.Nonnull Integer vaddr) { this.vaddr = vaddr; } + + public FunctionString source(@javax.annotation.Nullable StringSource source) { + this.source = source; + return this; + } + + /** + * The source of the string + * @return source + */ + @javax.annotation.Nullable + public StringSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable StringSource source) { + this.source = source; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -157,13 +182,14 @@ public boolean equals(Object o) { } FunctionString functionString = (FunctionString) o; return Objects.equals(this.value, functionString.value) && - Objects.equals(this.vaddr, functionString.vaddr)&& + Objects.equals(this.vaddr, functionString.vaddr) && + Objects.equals(this.source, functionString.source)&& Objects.equals(this.additionalProperties, functionString.additionalProperties); } @Override public int hashCode() { - return Objects.hash(value, vaddr, additionalProperties); + return Objects.hash(value, vaddr, source, additionalProperties); } @Override @@ -172,6 +198,7 @@ public String toString() { sb.append("class FunctionString {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" vaddr: ").append(toIndentedString(vaddr)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -194,7 +221,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("value", "vaddr")); + openapiFields = new HashSet(Arrays.asList("value", "vaddr", "source")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("value", "vaddr")); @@ -223,6 +250,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("value").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + StringSource.validateJsonElement(jsonObj.get("source")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/ai/reveng/model/NameConfidence.java b/src/main/java/ai/reveng/model/NameConfidence.java index 0479c19..860db1e 100644 --- a/src/main/java/ai/reveng/model/NameConfidence.java +++ b/src/main/java/ai/reveng/model/NameConfidence.java @@ -91,8 +91,8 @@ public NameConfidence confidence(@javax.annotation.Nonnull BigDecimal confidence /** * Confidence score as a percentage - * minimum: 0.0 - * maximum: 100.0 + * minimum: 0 + * maximum: 100 * @return confidence */ @javax.annotation.Nonnull diff --git a/src/main/java/ai/reveng/model/PutAnalysisStringsRequest.java b/src/main/java/ai/reveng/model/PutAnalysisStringsRequest.java new file mode 100644 index 0000000..89d21b3 --- /dev/null +++ b/src/main/java/ai/reveng/model/PutAnalysisStringsRequest.java @@ -0,0 +1,312 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AnalysisStringInput; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * PutAnalysisStringsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PutAnalysisStringsRequest { + public static final String SERIALIZED_NAME_STRINGS = "strings"; + @SerializedName(SERIALIZED_NAME_STRINGS) + @javax.annotation.Nonnull + private List strings = new ArrayList<>(); + + public PutAnalysisStringsRequest() { + } + + public PutAnalysisStringsRequest strings(@javax.annotation.Nonnull List strings) { + this.strings = strings; + return this; + } + + public PutAnalysisStringsRequest addStringsItem(AnalysisStringInput stringsItem) { + if (this.strings == null) { + this.strings = new ArrayList<>(); + } + this.strings.add(stringsItem); + return this; + } + + /** + * The strings to add to the analysis + * @return strings + */ + @javax.annotation.Nonnull + public List getStrings() { + return strings; + } + + public void setStrings(@javax.annotation.Nonnull List strings) { + this.strings = strings; + } + + /** + * 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 PutAnalysisStringsRequest instance itself + */ + public PutAnalysisStringsRequest 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; + } + PutAnalysisStringsRequest putAnalysisStringsRequest = (PutAnalysisStringsRequest) o; + return Objects.equals(this.strings, putAnalysisStringsRequest.strings)&& + Objects.equals(this.additionalProperties, putAnalysisStringsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(strings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PutAnalysisStringsRequest {\n"); + sb.append(" strings: ").append(toIndentedString(strings)).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) { + if (o == null) { + return "null"; + } + return 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("strings")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("strings")); + } + + /** + * 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 PutAnalysisStringsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PutAnalysisStringsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PutAnalysisStringsRequest is not found in the empty JSON string", PutAnalysisStringsRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PutAnalysisStringsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("strings").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `strings` to be an array in the JSON string but got `%s`", jsonObj.get("strings").toString())); + } + + JsonArray jsonArraystrings = jsonObj.getAsJsonArray("strings"); + // validate the required field `strings` (array) + for (int i = 0; i < jsonArraystrings.size(); i++) { + AnalysisStringInput.validateJsonElement(jsonArraystrings.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PutAnalysisStringsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PutAnalysisStringsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PutAnalysisStringsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PutAnalysisStringsRequest 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 PutAnalysisStringsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PutAnalysisStringsRequest 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(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 PutAnalysisStringsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PutAnalysisStringsRequest + * @throws IOException if the JSON string is invalid with respect to PutAnalysisStringsRequest + */ + public static PutAnalysisStringsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PutAnalysisStringsRequest.class); + } + + /** + * Convert an instance of PutAnalysisStringsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StringFunctions.java b/src/main/java/ai/reveng/model/StringFunctions.java index 84a777d..c855cca 100644 --- a/src/main/java/ai/reveng/model/StringFunctions.java +++ b/src/main/java/ai/reveng/model/StringFunctions.java @@ -15,6 +15,7 @@ import java.util.Objects; import java.util.Locale; import ai.reveng.model.AppApiRestV2FunctionsResponsesFunction; +import ai.reveng.model.StringSource; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -64,6 +65,11 @@ public class StringFunctions { @javax.annotation.Nonnull private List functions = new ArrayList<>(); + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private StringSource source; + public StringFunctions() { } @@ -112,6 +118,25 @@ public void setFunctions(@javax.annotation.Nonnull List(Arrays.asList("value", "functions")); + openapiFields = new HashSet(Arrays.asList("value", "functions", "source")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("value", "functions")); @@ -244,6 +271,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti for (int i = 0; i < jsonArrayfunctions.size(); i++) { AppApiRestV2FunctionsResponsesFunction.validateJsonElement(jsonArrayfunctions.get(i)); }; + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + StringSource.validateJsonElement(jsonObj.get("source")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/ai/reveng/model/StringSource.java b/src/main/java/ai/reveng/model/StringSource.java new file mode 100644 index 0000000..ca93af6 --- /dev/null +++ b/src/main/java/ai/reveng/model/StringSource.java @@ -0,0 +1,81 @@ +/* + * 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 java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets StringSource + */ +@JsonAdapter(StringSource.Adapter.class) +public enum StringSource { + + SYSTEM("SYSTEM"), + + USER("USER"), + + AI_AGENT("AI_AGENT"); + + private String value; + + StringSource(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StringSource fromValue(String value) { + for (StringSource b : StringSource.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StringSource enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StringSource read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StringSource.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StringSource.fromValue(value); + } +} +