diff --git a/.sdk-version b/.sdk-version index 3afcf99..bb761d2 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.131.0 +v3.131.1 diff --git a/README.md b/README.md index 3773bac..ec72cce 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.131.0 + 3.131.1 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.131.0" + implementation "ai.reveng:sdk:3.131.1" } ``` @@ -125,9 +125,7 @@ Class | Method | HTTP request | Description *AnalysesResultsMetadataApi* | [**getAnalysisFunctionsPaginated**](docs/AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**getCapabilities**](docs/AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis *AnalysesResultsMetadataApi* | [**getFunctionsList**](docs/AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis -*AnalysesResultsMetadataApi* | [**getSbom**](docs/AnalysesResultsMetadataApi.md#getSbom) | **GET** /v2/analyses/{analysis_id}/sbom | Gets the software-bill-of-materials (SBOM) found in the analysis *AnalysesResultsMetadataApi* | [**getTags**](docs/AnalysesResultsMetadataApi.md#getTags) | **GET** /v2/analyses/{analysis_id}/tags | Get function tags with maliciousness score -*AnalysesResultsMetadataApi* | [**getVulnerabilities**](docs/AnalysesResultsMetadataApi.md#getVulnerabilities) | **GET** /v2/analyses/{analysis_id}/vulnerabilities | Gets the vulnerabilities found in the analysis *AnalysesXRefsApi* | [**getXrefByVaddr**](docs/AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up xrefs by virtual address *AuthenticationUsersApi* | [**getUser**](docs/AuthenticationUsersApi.md#getUser) | **GET** /v2/users/{user_id} | Get a user's public information *AuthenticationUsersApi* | [**getUserActivity**](docs/AuthenticationUsersApi.md#getUserActivity) | **GET** /v2/users/activity | Get auth user activity @@ -346,7 +344,6 @@ Class | Method | HTTP request | Description - [BaseResponseListCommentResponse](docs/BaseResponseListCommentResponse.md) - [BaseResponseListDieMatch](docs/BaseResponseListDieMatch.md) - [BaseResponseListFunctionNameHistory](docs/BaseResponseListFunctionNameHistory.md) - - [BaseResponseListSBOM](docs/BaseResponseListSBOM.md) - [BaseResponseListUserActivityResponse](docs/BaseResponseListUserActivityResponse.md) - [BaseResponseLogs](docs/BaseResponseLogs.md) - [BaseResponseModelsResponse](docs/BaseResponseModelsResponse.md) @@ -363,7 +360,6 @@ Class | Method | HTTP request | Description - [BaseResponseTriageReportResponse](docs/BaseResponseTriageReportResponse.md) - [BaseResponseUnionGetAiDecompilationRatingResponseNoneType](docs/BaseResponseUnionGetAiDecompilationRatingResponseNoneType.md) - [BaseResponseUploadResponse](docs/BaseResponseUploadResponse.md) - - [BaseResponseVulnerabilities](docs/BaseResponseVulnerabilities.md) - [BaseResponseXrefResponse](docs/BaseResponseXrefResponse.md) - [Basic](docs/Basic.md) - [BatchBinaryMatchResult](docs/BatchBinaryMatchResult.md) @@ -645,8 +641,6 @@ Class | Method | HTTP request | Description - [ReportInfo](docs/ReportInfo.md) - [ReportOptions](docs/ReportOptions.md) - [RevokeBody](docs/RevokeBody.md) - - [SBOM](docs/SBOM.md) - - [SBOMPackage](docs/SBOMPackage.md) - [SSOProvider](docs/SSOProvider.md) - [SSOProvidersOutputBody](docs/SSOProvidersOutputBody.md) - [SandboxOptions](docs/SandboxOptions.md) @@ -744,8 +738,6 @@ Class | Method | HTTP request | Description - [V2FunctionHeader](docs/V2FunctionHeader.md) - [V2FunctionInfo](docs/V2FunctionInfo.md) - [V2FunctionType](docs/V2FunctionType.md) - - [Vulnerabilities](docs/Vulnerabilities.md) - - [Vulnerability](docs/Vulnerability.md) - [WarningEvent](docs/WarningEvent.md) - [WorkflowProgress](docs/WorkflowProgress.md) - [Workspace](docs/Workspace.md) diff --git a/build.gradle b/build.gradle index aa34c1b..1f85130 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.131.0' +version = '3.131.1' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.131.0") + coordinates("ai.reveng", "sdk", "3.131.1") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index d4e644f..cdfcbac 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.131.0", + version := "3.131.1", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesResultsMetadataApi.md b/docs/AnalysesResultsMetadataApi.md index 74fdb77..ddf157f 100644 --- a/docs/AnalysesResultsMetadataApi.md +++ b/docs/AnalysesResultsMetadataApi.md @@ -7,9 +7,7 @@ All URIs are relative to *https://api.reveng.ai* | [**getAnalysisFunctionsPaginated**](AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis | | [**getCapabilities**](AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis | | [**getFunctionsList**](AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis | -| [**getSbom**](AnalysesResultsMetadataApi.md#getSbom) | **GET** /v2/analyses/{analysis_id}/sbom | Gets the software-bill-of-materials (SBOM) found in the analysis | | [**getTags**](AnalysesResultsMetadataApi.md#getTags) | **GET** /v2/analyses/{analysis_id}/tags | Get function tags with maliciousness score | -| [**getVulnerabilities**](AnalysesResultsMetadataApi.md#getVulnerabilities) | **GET** /v2/analyses/{analysis_id}/vulnerabilities | Gets the vulnerabilities found in the analysis | @@ -248,78 +246,6 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | - -# **getSbom** -> BaseResponseListSBOM getSbom(analysisId) - -Gets the software-bill-of-materials (SBOM) found in the analysis - -### 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.AnalysesResultsMetadataApi; - -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"); - - AnalysesResultsMetadataApi apiInstance = new AnalysesResultsMetadataApi(defaultClient); - Integer analysisId = 56; // Integer | - try { - BaseResponseListSBOM result = apiInstance.getSbom(analysisId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AnalysesResultsMetadataApi#getSbom"); - 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**| | | - -### Return type - -[**BaseResponseListSBOM**](BaseResponseListSBOM.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - # **getTags** > BaseResponseAnalysisTags getTags(analysisId) @@ -392,75 +318,3 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | - -# **getVulnerabilities** -> BaseResponseVulnerabilities getVulnerabilities(analysisId) - -Gets the vulnerabilities found in the analysis - -### 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.AnalysesResultsMetadataApi; - -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"); - - AnalysesResultsMetadataApi apiInstance = new AnalysesResultsMetadataApi(defaultClient); - Integer analysisId = 56; // Integer | - try { - BaseResponseVulnerabilities result = apiInstance.getVulnerabilities(analysisId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AnalysesResultsMetadataApi#getVulnerabilities"); - 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**| | | - -### Return type - -[**BaseResponseVulnerabilities**](BaseResponseVulnerabilities.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - diff --git a/docs/AnalysisConfig.md b/docs/AnalysisConfig.md index 7ad2fef..1631b67 100644 --- a/docs/AnalysisConfig.md +++ b/docs/AnalysisConfig.md @@ -8,8 +8,6 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**scrapeThirdPartyConfig** | [**ScrapeThirdPartyConfig**](ScrapeThirdPartyConfig.md) | Settings to scrape third party sources | [optional] | -|**generateCves** | **Boolean** | A configuration option for fetching CVEs data. | [optional] | -|**generateSbom** | **Boolean** | A configuration option for generating software bill of materials data. | [optional] | |**generateCapabilities** | **Boolean** | A configuration option for generating capabilities of a binary | [optional] | |**noCache** | **Boolean** | When enabled, skips using cached data within the processing. | [optional] | |**advancedAnalysis** | **Boolean** | Enables an advanced security analysis. | [optional] | diff --git a/docs/AnalysisDetailResponse.md b/docs/AnalysisDetailResponse.md index cd68a11..2036dea 100644 --- a/docs/AnalysisDetailResponse.md +++ b/docs/AnalysisDetailResponse.md @@ -20,7 +20,6 @@ |**dashboardUrl** | **String** | URL to view this analysis in the dashboard | | |**debug** | **Boolean** | | | |**modelName** | **String** | | | -|**sbom** | **Map<String, Object>** | | [optional] | |**sha256Hash** | **String** | | | |**autoRunAgents** | [**AutoRunAgents**](AutoRunAgents.md) | | | |**requestedConfig** | [**AnalysisConfigSnapshot**](AnalysisConfigSnapshot.md) | Snapshot of the configuration the analysis was submitted with. | | diff --git a/docs/BaseResponseListSBOM.md b/docs/BaseResponseListSBOM.md deleted file mode 100644 index a6464db..0000000 --- a/docs/BaseResponseListSBOM.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseListSBOM - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**List<SBOM>**](SBOM.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/BaseResponseVulnerabilities.md b/docs/BaseResponseVulnerabilities.md deleted file mode 100644 index 8024972..0000000 --- a/docs/BaseResponseVulnerabilities.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseVulnerabilities - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**Vulnerabilities**](Vulnerabilities.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/ReAnalysisForm.md b/docs/ReAnalysisForm.md index 894a06a..03b5a02 100644 --- a/docs/ReAnalysisForm.md +++ b/docs/ReAnalysisForm.md @@ -11,7 +11,7 @@ Form Model for receiving the analysis request |**tags** | **List<String>** | Tags associated with the analysis | [optional] | |**commandLineArgs** | **String** | Command line arguments for dynamic execution | [optional] | |**priority** | **Integer** | Priority of the analysis | [optional] | -|**essential** | **Boolean** | Only runs essential parts of the analysis, skips tags/sbom/cves etc. | [optional] | +|**essential** | **Boolean** | Only runs essential parts of the analysis, skips tags etc. | [optional] | |**modelName** | **String** | Model name allows reprocessing using a different model | [optional] | |**noCache** | **Boolean** | When enabled, skips using cached data within the processing. | [optional] | diff --git a/docs/SBOM.md b/docs/SBOM.md deleted file mode 100644 index e3c41a4..0000000 --- a/docs/SBOM.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# SBOM - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**packages** | [**List<SBOMPackage>**](SBOMPackage.md) | The packages found | | -|**importedLibs** | **List<String>** | The import libraries found | | - - - diff --git a/docs/SBOMPackage.md b/docs/SBOMPackage.md deleted file mode 100644 index 304e783..0000000 --- a/docs/SBOMPackage.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# SBOMPackage - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**name** | **String** | The name of the package | | -|**version** | **String** | The version of the package | | - - - diff --git a/docs/Vulnerabilities.md b/docs/Vulnerabilities.md deleted file mode 100644 index 5ae407b..0000000 --- a/docs/Vulnerabilities.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# Vulnerabilities - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**vulnerabilities** | [**List<Vulnerability>**](Vulnerability.md) | | | - - - diff --git a/docs/Vulnerability.md b/docs/Vulnerability.md deleted file mode 100644 index 99be091..0000000 --- a/docs/Vulnerability.md +++ /dev/null @@ -1,36 +0,0 @@ - - -# Vulnerability - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**vendor** | **String** | | | -|**product** | **String** | | | -|**version** | **String** | | | -|**cveNumber** | **String** | | | -|**severity** | [**SeverityEnum**](#SeverityEnum) | | | -|**source** | **String** | | | -|**cvssVersion** | **String** | | | -|**cvssVector** | **String** | | | -|**remarks** | **String** | | | -|**score** | **BigDecimal** | | | -|**isUnknown** | **Boolean** | | [optional] | - - - -## Enum: SeverityEnum - -| Name | Value | -|---- | -----| -| CRITICAL | "CRITICAL" | -| HIGH | "HIGH" | -| MEDIUM | "MEDIUM" | -| LOW | "LOW" | -| UNKNOWN | "UNKNOWN" | -| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | - - - diff --git a/pom.xml b/pom.xml index 714f7e0..74d48e0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.131.0 + 3.131.1 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java index 8fce41a..dab657f 100644 --- a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java +++ b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java @@ -31,8 +31,6 @@ import ai.reveng.model.BaseResponseAnalysisFunctionsList; import ai.reveng.model.BaseResponseAnalysisTags; import ai.reveng.model.BaseResponseCapabilities; -import ai.reveng.model.BaseResponseListSBOM; -import ai.reveng.model.BaseResponseVulnerabilities; import java.lang.reflect.Type; import java.util.ArrayList; @@ -552,137 +550,6 @@ public okhttp3.Call getFunctionsListAsync(@javax.annotation.Nonnull Integer anal localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for getSbom - * @param analysisId (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 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call getSbomCall(@javax.annotation.Nonnull Integer 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 = "/v2/analyses/{analysis_id}/sbom" - .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 getSbomValidateBeforeCall(@javax.annotation.Nonnull Integer 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 getSbom(Async)"); - } - - return getSbomCall(analysisId, _callback); - - } - - /** - * Gets the software-bill-of-materials (SBOM) found in the analysis - * - * @param analysisId (required) - * @return BaseResponseListSBOM - * @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 Successful Response -
422 Invalid request parameters -
- */ - public BaseResponseListSBOM getSbom(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - ApiResponse localVarResp = getSbomWithHttpInfo(analysisId); - return localVarResp.getData(); - } - - /** - * Gets the software-bill-of-materials (SBOM) found in the analysis - * - * @param analysisId (required) - * @return ApiResponse<BaseResponseListSBOM> - * @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 Successful Response -
422 Invalid request parameters -
- */ - public ApiResponse getSbomWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - okhttp3.Call localVarCall = getSbomValidateBeforeCall(analysisId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Gets the software-bill-of-materials (SBOM) found in the analysis (asynchronously) - * - * @param analysisId (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 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call getSbomAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getSbomValidateBeforeCall(analysisId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for getTags * @param analysisId (required) @@ -814,135 +681,4 @@ public okhttp3.Call getTagsAsync(@javax.annotation.Nonnull Integer analysisId, f localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for getVulnerabilities - * @param analysisId (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 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call getVulnerabilitiesCall(@javax.annotation.Nonnull Integer 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 = "/v2/analyses/{analysis_id}/vulnerabilities" - .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 getVulnerabilitiesValidateBeforeCall(@javax.annotation.Nonnull Integer 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 getVulnerabilities(Async)"); - } - - return getVulnerabilitiesCall(analysisId, _callback); - - } - - /** - * Gets the vulnerabilities found in the analysis - * - * @param analysisId (required) - * @return BaseResponseVulnerabilities - * @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 Successful Response -
422 Invalid request parameters -
- */ - public BaseResponseVulnerabilities getVulnerabilities(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - ApiResponse localVarResp = getVulnerabilitiesWithHttpInfo(analysisId); - return localVarResp.getData(); - } - - /** - * Gets the vulnerabilities found in the analysis - * - * @param analysisId (required) - * @return ApiResponse<BaseResponseVulnerabilities> - * @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 Successful Response -
422 Invalid request parameters -
- */ - public ApiResponse getVulnerabilitiesWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - okhttp3.Call localVarCall = getVulnerabilitiesValidateBeforeCall(analysisId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Gets the vulnerabilities found in the analysis (asynchronously) - * - * @param analysisId (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 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call getVulnerabilitiesAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getVulnerabilitiesValidateBeforeCall(analysisId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } } diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index c676fb5..181f221 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.131.0/java"); + setUserAgent("OpenAPI-Generator/3.131.1/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 94fbd6d..1f50b5c 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.131.0"; + public static final String VERSION = "3.131.1"; 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 f772f1f..3e161fd 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -198,7 +198,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListCommentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListDieMatch.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListFunctionNameHistory.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListSBOM.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListUserActivityResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseLogs.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseModelsResponse.CustomTypeAdapterFactory()); @@ -215,7 +214,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTriageReportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseUnionGetAiDecompilationRatingResponseNoneType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseUploadResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseVulnerabilities.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseXrefResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Basic.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchBinaryMatchResult.CustomTypeAdapterFactory()); @@ -486,8 +484,6 @@ 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.RevokeBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOM.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOMPackage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvider.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvidersOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SandboxOptions.CustomTypeAdapterFactory()); @@ -579,8 +575,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.V2FunctionHeader.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.V2FunctionInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.V2FunctionType.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerabilities.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WarningEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WorkflowProgress.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromResponse.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisConfig.java b/src/main/java/ai/reveng/model/AnalysisConfig.java index f01d593..2f00f81 100644 --- a/src/main/java/ai/reveng/model/AnalysisConfig.java +++ b/src/main/java/ai/reveng/model/AnalysisConfig.java @@ -56,16 +56,6 @@ public class AnalysisConfig { @javax.annotation.Nullable private ScrapeThirdPartyConfig scrapeThirdPartyConfig; - public static final String SERIALIZED_NAME_GENERATE_CVES = "generate_cves"; - @SerializedName(SERIALIZED_NAME_GENERATE_CVES) - @javax.annotation.Nullable - private Boolean generateCves = false; - - public static final String SERIALIZED_NAME_GENERATE_SBOM = "generate_sbom"; - @SerializedName(SERIALIZED_NAME_GENERATE_SBOM) - @javax.annotation.Nullable - private Boolean generateSbom = false; - public static final String SERIALIZED_NAME_GENERATE_CAPABILITIES = "generate_capabilities"; @SerializedName(SERIALIZED_NAME_GENERATE_CAPABILITIES) @javax.annotation.Nullable @@ -108,44 +98,6 @@ public void setScrapeThirdPartyConfig(@javax.annotation.Nullable ScrapeThirdPart } - public AnalysisConfig generateCves(@javax.annotation.Nullable Boolean generateCves) { - this.generateCves = generateCves; - return this; - } - - /** - * A configuration option for fetching CVEs data. - * @return generateCves - */ - @javax.annotation.Nullable - public Boolean getGenerateCves() { - return generateCves; - } - - public void setGenerateCves(@javax.annotation.Nullable Boolean generateCves) { - this.generateCves = generateCves; - } - - - public AnalysisConfig generateSbom(@javax.annotation.Nullable Boolean generateSbom) { - this.generateSbom = generateSbom; - return this; - } - - /** - * A configuration option for generating software bill of materials data. - * @return generateSbom - */ - @javax.annotation.Nullable - public Boolean getGenerateSbom() { - return generateSbom; - } - - public void setGenerateSbom(@javax.annotation.Nullable Boolean generateSbom) { - this.generateSbom = generateSbom; - } - - public AnalysisConfig generateCapabilities(@javax.annotation.Nullable Boolean generateCapabilities) { this.generateCapabilities = generateCapabilities; return this; @@ -277,8 +229,6 @@ public boolean equals(Object o) { } AnalysisConfig analysisConfig = (AnalysisConfig) o; return Objects.equals(this.scrapeThirdPartyConfig, analysisConfig.scrapeThirdPartyConfig) && - Objects.equals(this.generateCves, analysisConfig.generateCves) && - Objects.equals(this.generateSbom, analysisConfig.generateSbom) && Objects.equals(this.generateCapabilities, analysisConfig.generateCapabilities) && Objects.equals(this.noCache, analysisConfig.noCache) && Objects.equals(this.advancedAnalysis, analysisConfig.advancedAnalysis) && @@ -288,7 +238,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(scrapeThirdPartyConfig, generateCves, generateSbom, generateCapabilities, noCache, advancedAnalysis, sandboxConfig, additionalProperties); + return Objects.hash(scrapeThirdPartyConfig, generateCapabilities, noCache, advancedAnalysis, sandboxConfig, additionalProperties); } @Override @@ -296,8 +246,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AnalysisConfig {\n"); sb.append(" scrapeThirdPartyConfig: ").append(toIndentedString(scrapeThirdPartyConfig)).append("\n"); - sb.append(" generateCves: ").append(toIndentedString(generateCves)).append("\n"); - sb.append(" generateSbom: ").append(toIndentedString(generateSbom)).append("\n"); sb.append(" generateCapabilities: ").append(toIndentedString(generateCapabilities)).append("\n"); sb.append(" noCache: ").append(toIndentedString(noCache)).append("\n"); sb.append(" advancedAnalysis: ").append(toIndentedString(advancedAnalysis)).append("\n"); @@ -321,7 +269,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("scrape_third_party_config", "generate_cves", "generate_sbom", "generate_capabilities", "no_cache", "advanced_analysis", "sandbox_config")); + openapiFields = new HashSet(Arrays.asList("scrape_third_party_config", "generate_capabilities", "no_cache", "advanced_analysis", "sandbox_config")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); diff --git a/src/main/java/ai/reveng/model/AnalysisDetailResponse.java b/src/main/java/ai/reveng/model/AnalysisDetailResponse.java index c0baba1..5367269 100644 --- a/src/main/java/ai/reveng/model/AnalysisDetailResponse.java +++ b/src/main/java/ai/reveng/model/AnalysisDetailResponse.java @@ -23,9 +23,6 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -120,11 +117,6 @@ public class AnalysisDetailResponse { @javax.annotation.Nonnull private String modelName; - public static final String SERIALIZED_NAME_SBOM = "sbom"; - @SerializedName(SERIALIZED_NAME_SBOM) - @javax.annotation.Nullable - private Map sbom; - public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; @SerializedName(SERIALIZED_NAME_SHA256_HASH) @javax.annotation.Nonnull @@ -390,33 +382,6 @@ public void setModelName(@javax.annotation.Nonnull String modelName) { } - public AnalysisDetailResponse sbom(@javax.annotation.Nullable Map sbom) { - this.sbom = sbom; - return this; - } - - public AnalysisDetailResponse putSbomItem(String key, Object sbomItem) { - if (this.sbom == null) { - this.sbom = new HashMap<>(); - } - this.sbom.put(key, sbomItem); - return this; - } - - /** - * Get sbom - * @return sbom - */ - @javax.annotation.Nullable - public Map getSbom() { - return sbom; - } - - public void setSbom(@javax.annotation.Nullable Map sbom) { - this.sbom = sbom; - } - - public AnalysisDetailResponse sha256Hash(@javax.annotation.Nonnull String sha256Hash) { this.sha256Hash = sha256Hash; return this; @@ -541,27 +506,15 @@ public boolean equals(Object o) { Objects.equals(this.dashboardUrl, analysisDetailResponse.dashboardUrl) && Objects.equals(this.debug, analysisDetailResponse.debug) && Objects.equals(this.modelName, analysisDetailResponse.modelName) && - Objects.equals(this.sbom, analysisDetailResponse.sbom) && Objects.equals(this.sha256Hash, analysisDetailResponse.sha256Hash) && Objects.equals(this.autoRunAgents, analysisDetailResponse.autoRunAgents) && Objects.equals(this.requestedConfig, analysisDetailResponse.requestedConfig)&& Objects.equals(this.additionalProperties, analysisDetailResponse.additionalProperties); } - 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(access, analysisId, analysisScope, architecture, binaryDynamic, binaryFormat, binaryName, binarySize, binaryType, creation, dashboardUrl, debug, modelName, sbom, sha256Hash, autoRunAgents, requestedConfig, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(access, analysisId, analysisScope, architecture, binaryDynamic, binaryFormat, binaryName, binarySize, binaryType, creation, dashboardUrl, debug, modelName, sha256Hash, autoRunAgents, requestedConfig, additionalProperties); } @Override @@ -581,7 +534,6 @@ public String toString() { sb.append(" dashboardUrl: ").append(toIndentedString(dashboardUrl)).append("\n"); sb.append(" debug: ").append(toIndentedString(debug)).append("\n"); sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); - sb.append(" sbom: ").append(toIndentedString(sbom)).append("\n"); sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); sb.append(" autoRunAgents: ").append(toIndentedString(autoRunAgents)).append("\n"); sb.append(" requestedConfig: ").append(toIndentedString(requestedConfig)).append("\n"); @@ -604,7 +556,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("access", "analysis_id", "analysis_scope", "architecture", "binary_dynamic", "binary_format", "binary_name", "binary_size", "binary_type", "creation", "dashboard_url", "debug", "model_name", "sbom", "sha_256_hash", "auto_run_agents", "requested_config")); + openapiFields = new HashSet(Arrays.asList("access", "analysis_id", "analysis_scope", "architecture", "binary_dynamic", "binary_format", "binary_name", "binary_size", "binary_type", "creation", "dashboard_url", "debug", "model_name", "sha_256_hash", "auto_run_agents", "requested_config")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("access", "analysis_id", "analysis_scope", "architecture", "binary_dynamic", "binary_format", "binary_name", "binary_size", "binary_type", "creation", "dashboard_url", "debug", "model_name", "sha_256_hash", "auto_run_agents", "requested_config")); diff --git a/src/main/java/ai/reveng/model/BaseResponseListSBOM.java b/src/main/java/ai/reveng/model/BaseResponseListSBOM.java deleted file mode 100644 index 795074f..0000000 --- a/src/main/java/ai/reveng/model/BaseResponseListSBOM.java +++ /dev/null @@ -1,451 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.MetaModel; -import ai.reveng.model.SBOM; -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; - -/** - * BaseResponseListSBOM - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseListSBOM { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private List data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseListSBOM() { - } - - public BaseResponseListSBOM status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseListSBOM data(@javax.annotation.Nullable List data) { - this.data = data; - return this; - } - - public BaseResponseListSBOM addDataItem(SBOM dataItem) { - if (this.data == null) { - this.data = new ArrayList<>(); - } - this.data.add(dataItem); - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public List getData() { - return data; - } - - public void setData(@javax.annotation.Nullable List data) { - this.data = data; - } - - - public BaseResponseListSBOM message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseListSBOM errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseListSBOM addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseListSBOM meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseListSBOM instance itself - */ - public BaseResponseListSBOM 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; - } - BaseResponseListSBOM baseResponseListSBOM = (BaseResponseListSBOM) o; - return Objects.equals(this.status, baseResponseListSBOM.status) && - Objects.equals(this.data, baseResponseListSBOM.data) && - Objects.equals(this.message, baseResponseListSBOM.message) && - Objects.equals(this.errors, baseResponseListSBOM.errors) && - Objects.equals(this.meta, baseResponseListSBOM.meta)&& - Objects.equals(this.additionalProperties, baseResponseListSBOM.additionalProperties); - } - - 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(status, data, message, errors, meta, additionalProperties); - } - - 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 BaseResponseListSBOM {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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("status", "data", "message", "errors", "meta")); - - // 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 BaseResponseListSBOM - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseListSBOM.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 BaseResponseListSBOM is not found in the empty JSON string", BaseResponseListSBOM.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); - if (jsonArraydata != null) { - // ensure the json data is an array - if (!jsonObj.get("data").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); - } - - // validate the optional field `data` (array) - for (int i = 0; i < jsonArraydata.size(); i++) { - SBOM.validateJsonElement(jsonArraydata.get(i)); - }; - } - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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())); - } - if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseListSBOM.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseListSBOM' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseListSBOM.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseListSBOM 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 BaseResponseListSBOM read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseListSBOM 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 BaseResponseListSBOM given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseListSBOM - * @throws IOException if the JSON string is invalid with respect to BaseResponseListSBOM - */ - public static BaseResponseListSBOM fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseListSBOM.class); - } - - /** - * Convert an instance of BaseResponseListSBOM to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BaseResponseVulnerabilities.java b/src/main/java/ai/reveng/model/BaseResponseVulnerabilities.java deleted file mode 100644 index 9a55b1f..0000000 --- a/src/main/java/ai/reveng/model/BaseResponseVulnerabilities.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.MetaModel; -import ai.reveng.model.Vulnerabilities; -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; - -/** - * BaseResponseVulnerabilities - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseVulnerabilities { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private Vulnerabilities data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseVulnerabilities() { - } - - public BaseResponseVulnerabilities status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseVulnerabilities data(@javax.annotation.Nullable Vulnerabilities data) { - this.data = data; - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public Vulnerabilities getData() { - return data; - } - - public void setData(@javax.annotation.Nullable Vulnerabilities data) { - this.data = data; - } - - - public BaseResponseVulnerabilities message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseVulnerabilities errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseVulnerabilities addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseVulnerabilities meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseVulnerabilities instance itself - */ - public BaseResponseVulnerabilities 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; - } - BaseResponseVulnerabilities baseResponseVulnerabilities = (BaseResponseVulnerabilities) o; - return Objects.equals(this.status, baseResponseVulnerabilities.status) && - Objects.equals(this.data, baseResponseVulnerabilities.data) && - Objects.equals(this.message, baseResponseVulnerabilities.message) && - Objects.equals(this.errors, baseResponseVulnerabilities.errors) && - Objects.equals(this.meta, baseResponseVulnerabilities.meta)&& - Objects.equals(this.additionalProperties, baseResponseVulnerabilities.additionalProperties); - } - - 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(status, data, message, errors, meta, additionalProperties); - } - - 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 BaseResponseVulnerabilities {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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("status", "data", "message", "errors", "meta")); - - // 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 BaseResponseVulnerabilities - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseVulnerabilities.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 BaseResponseVulnerabilities is not found in the empty JSON string", BaseResponseVulnerabilities.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - Vulnerabilities.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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())); - } - if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseVulnerabilities.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseVulnerabilities' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseVulnerabilities.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseVulnerabilities 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 BaseResponseVulnerabilities read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseVulnerabilities 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 BaseResponseVulnerabilities given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseVulnerabilities - * @throws IOException if the JSON string is invalid with respect to BaseResponseVulnerabilities - */ - public static BaseResponseVulnerabilities fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseVulnerabilities.class); - } - - /** - * Convert an instance of BaseResponseVulnerabilities to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/ReAnalysisForm.java b/src/main/java/ai/reveng/model/ReAnalysisForm.java index 66dad14..8cef901 100644 --- a/src/main/java/ai/reveng/model/ReAnalysisForm.java +++ b/src/main/java/ai/reveng/model/ReAnalysisForm.java @@ -161,7 +161,7 @@ public ReAnalysisForm essential(@javax.annotation.Nullable Boolean essential) { } /** - * Only runs essential parts of the analysis, skips tags/sbom/cves etc. + * Only runs essential parts of the analysis, skips tags etc. * @return essential */ @javax.annotation.Nullable diff --git a/src/main/java/ai/reveng/model/SBOM.java b/src/main/java/ai/reveng/model/SBOM.java deleted file mode 100644 index 3de5aca..0000000 --- a/src/main/java/ai/reveng/model/SBOM.java +++ /dev/null @@ -1,347 +0,0 @@ -/* - * 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.SBOMPackage; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * SBOM - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class SBOM { - public static final String SERIALIZED_NAME_PACKAGES = "packages"; - @SerializedName(SERIALIZED_NAME_PACKAGES) - @javax.annotation.Nonnull - private List packages = new ArrayList<>(); - - public static final String SERIALIZED_NAME_IMPORTED_LIBS = "imported_libs"; - @SerializedName(SERIALIZED_NAME_IMPORTED_LIBS) - @javax.annotation.Nonnull - private List importedLibs = new ArrayList<>(); - - public SBOM() { - } - - public SBOM packages(@javax.annotation.Nonnull List packages) { - this.packages = packages; - return this; - } - - public SBOM addPackagesItem(SBOMPackage packagesItem) { - if (this.packages == null) { - this.packages = new ArrayList<>(); - } - this.packages.add(packagesItem); - return this; - } - - /** - * The packages found - * @return packages - */ - @javax.annotation.Nonnull - public List getPackages() { - return packages; - } - - public void setPackages(@javax.annotation.Nonnull List packages) { - this.packages = packages; - } - - - public SBOM importedLibs(@javax.annotation.Nonnull List importedLibs) { - this.importedLibs = importedLibs; - return this; - } - - public SBOM addImportedLibsItem(String importedLibsItem) { - if (this.importedLibs == null) { - this.importedLibs = new ArrayList<>(); - } - this.importedLibs.add(importedLibsItem); - return this; - } - - /** - * The import libraries found - * @return importedLibs - */ - @javax.annotation.Nonnull - public List getImportedLibs() { - return importedLibs; - } - - public void setImportedLibs(@javax.annotation.Nonnull List importedLibs) { - this.importedLibs = importedLibs; - } - - /** - * 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 SBOM instance itself - */ - public SBOM 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; - } - SBOM SBOM = (SBOM) o; - return Objects.equals(this.packages, SBOM.packages) && - Objects.equals(this.importedLibs, SBOM.importedLibs)&& - Objects.equals(this.additionalProperties, SBOM.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(packages, importedLibs, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SBOM {\n"); - sb.append(" packages: ").append(toIndentedString(packages)).append("\n"); - sb.append(" importedLibs: ").append(toIndentedString(importedLibs)).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("packages", "imported_libs")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("packages", "imported_libs")); - } - - /** - * 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 SBOM - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SBOM.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 SBOM is not found in the empty JSON string", SBOM.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SBOM.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("packages") != null) { - if (!jsonObj.get("packages").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `packages` to be an array in the JSON string but got `%s`", jsonObj.get("packages").toString())); - } - JsonArray jsonArraypackages = jsonObj.getAsJsonArray("packages"); - // validate the required field `packages` (array) - for (int i = 0; i < jsonArraypackages.size(); i++) { - SBOMPackage.validateJsonElement(jsonArraypackages.get(i)); - } - } - // ensure the required json array is present - if (jsonObj.get("imported_libs") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("imported_libs").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `imported_libs` to be an array in the JSON string but got `%s`", jsonObj.get("imported_libs").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SBOM.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SBOM' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SBOM.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SBOM 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 SBOM read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - SBOM 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 SBOM given an JSON string - * - * @param jsonString JSON string - * @return An instance of SBOM - * @throws IOException if the JSON string is invalid with respect to SBOM - */ - public static SBOM fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SBOM.class); - } - - /** - * Convert an instance of SBOM to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/SBOMPackage.java b/src/main/java/ai/reveng/model/SBOMPackage.java deleted file mode 100644 index d0b3fe3..0000000 --- a/src/main/java/ai/reveng/model/SBOMPackage.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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; - -/** - * SBOMPackage - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class SBOMPackage { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - @javax.annotation.Nonnull - private String version; - - public SBOMPackage() { - } - - public SBOMPackage name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * The name of the package - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public SBOMPackage version(@javax.annotation.Nonnull String version) { - this.version = version; - return this; - } - - /** - * The version of the package - * @return version - */ - @javax.annotation.Nonnull - public String getVersion() { - return version; - } - - public void setVersion(@javax.annotation.Nonnull String version) { - this.version = version; - } - - /** - * 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 SBOMPackage instance itself - */ - public SBOMPackage 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; - } - SBOMPackage sbOMPackage = (SBOMPackage) o; - return Objects.equals(this.name, sbOMPackage.name) && - Objects.equals(this.version, sbOMPackage.version)&& - Objects.equals(this.additionalProperties, sbOMPackage.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(name, version, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SBOMPackage {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).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("name", "version")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "version")); - } - - /** - * 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 SBOMPackage - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SBOMPackage.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 SBOMPackage is not found in the empty JSON string", SBOMPackage.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SBOMPackage.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - if (!jsonObj.get("version").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("version").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SBOMPackage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SBOMPackage' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SBOMPackage.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SBOMPackage 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 SBOMPackage read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - SBOMPackage 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 SBOMPackage given an JSON string - * - * @param jsonString JSON string - * @return An instance of SBOMPackage - * @throws IOException if the JSON string is invalid with respect to SBOMPackage - */ - public static SBOMPackage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SBOMPackage.class); - } - - /** - * Convert an instance of SBOMPackage to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/Vulnerabilities.java b/src/main/java/ai/reveng/model/Vulnerabilities.java deleted file mode 100644 index 6e2086f..0000000 --- a/src/main/java/ai/reveng/model/Vulnerabilities.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * 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.Vulnerability; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * Vulnerabilities - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Vulnerabilities { - public static final String SERIALIZED_NAME_VULNERABILITIES = "vulnerabilities"; - @SerializedName(SERIALIZED_NAME_VULNERABILITIES) - @javax.annotation.Nonnull - private List vulnerabilities = new ArrayList<>(); - - public Vulnerabilities() { - } - - public Vulnerabilities vulnerabilities(@javax.annotation.Nonnull List vulnerabilities) { - this.vulnerabilities = vulnerabilities; - return this; - } - - public Vulnerabilities addVulnerabilitiesItem(Vulnerability vulnerabilitiesItem) { - if (this.vulnerabilities == null) { - this.vulnerabilities = new ArrayList<>(); - } - this.vulnerabilities.add(vulnerabilitiesItem); - return this; - } - - /** - * Get vulnerabilities - * @return vulnerabilities - */ - @javax.annotation.Nonnull - public List getVulnerabilities() { - return vulnerabilities; - } - - public void setVulnerabilities(@javax.annotation.Nonnull List vulnerabilities) { - this.vulnerabilities = vulnerabilities; - } - - /** - * 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 Vulnerabilities instance itself - */ - public Vulnerabilities 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; - } - Vulnerabilities vulnerabilities = (Vulnerabilities) o; - return Objects.equals(this.vulnerabilities, vulnerabilities.vulnerabilities)&& - Objects.equals(this.additionalProperties, vulnerabilities.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(vulnerabilities, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Vulnerabilities {\n"); - sb.append(" vulnerabilities: ").append(toIndentedString(vulnerabilities)).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("vulnerabilities")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("vulnerabilities")); - } - - /** - * 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 Vulnerabilities - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Vulnerabilities.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 Vulnerabilities is not found in the empty JSON string", Vulnerabilities.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Vulnerabilities.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("vulnerabilities") != null) { - if (!jsonObj.get("vulnerabilities").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `vulnerabilities` to be an array in the JSON string but got `%s`", jsonObj.get("vulnerabilities").toString())); - } - JsonArray jsonArrayvulnerabilities = jsonObj.getAsJsonArray("vulnerabilities"); - // validate the required field `vulnerabilities` (array) - for (int i = 0; i < jsonArrayvulnerabilities.size(); i++) { - Vulnerability.validateJsonElement(jsonArrayvulnerabilities.get(i)); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Vulnerabilities.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Vulnerabilities' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Vulnerabilities.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Vulnerabilities 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 Vulnerabilities read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Vulnerabilities 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 Vulnerabilities given an JSON string - * - * @param jsonString JSON string - * @return An instance of Vulnerabilities - * @throws IOException if the JSON string is invalid with respect to Vulnerabilities - */ - public static Vulnerabilities fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Vulnerabilities.class); - } - - /** - * Convert an instance of Vulnerabilities to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/Vulnerability.java b/src/main/java/ai/reveng/model/Vulnerability.java deleted file mode 100644 index 9a540ba..0000000 --- a/src/main/java/ai/reveng/model/Vulnerability.java +++ /dev/null @@ -1,636 +0,0 @@ -/* - * 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.math.BigDecimal; -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; - -/** - * Vulnerability - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Vulnerability { - public static final String SERIALIZED_NAME_VENDOR = "vendor"; - @SerializedName(SERIALIZED_NAME_VENDOR) - @javax.annotation.Nonnull - private String vendor; - - public static final String SERIALIZED_NAME_PRODUCT = "product"; - @SerializedName(SERIALIZED_NAME_PRODUCT) - @javax.annotation.Nonnull - private String product; - - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - @javax.annotation.Nonnull - private String version; - - public static final String SERIALIZED_NAME_CVE_NUMBER = "cve_number"; - @SerializedName(SERIALIZED_NAME_CVE_NUMBER) - @javax.annotation.Nonnull - private String cveNumber; - - /** - * Gets or Sets severity - */ - @JsonAdapter(SeverityEnum.Adapter.class) - public enum SeverityEnum { - CRITICAL("CRITICAL"), - - HIGH("HIGH"), - - MEDIUM("MEDIUM"), - - LOW("LOW"), - - UNKNOWN("UNKNOWN"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - SeverityEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static SeverityEnum fromValue(String value) { - for (SeverityEnum b : SeverityEnum.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 SeverityEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SeverityEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SeverityEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - SeverityEnum.fromValue(value); - } - } - - public static final String SERIALIZED_NAME_SEVERITY = "severity"; - @SerializedName(SERIALIZED_NAME_SEVERITY) - @javax.annotation.Nonnull - private SeverityEnum severity; - - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - @javax.annotation.Nonnull - private String source; - - public static final String SERIALIZED_NAME_CVSS_VERSION = "cvss_version"; - @SerializedName(SERIALIZED_NAME_CVSS_VERSION) - @javax.annotation.Nonnull - private String cvssVersion; - - public static final String SERIALIZED_NAME_CVSS_VECTOR = "cvss_vector"; - @SerializedName(SERIALIZED_NAME_CVSS_VECTOR) - @javax.annotation.Nonnull - private String cvssVector; - - public static final String SERIALIZED_NAME_REMARKS = "remarks"; - @SerializedName(SERIALIZED_NAME_REMARKS) - @javax.annotation.Nonnull - private String remarks; - - public static final String SERIALIZED_NAME_SCORE = "score"; - @SerializedName(SERIALIZED_NAME_SCORE) - @javax.annotation.Nonnull - private BigDecimal score; - - public static final String SERIALIZED_NAME_IS_UNKNOWN = "is_unknown"; - @SerializedName(SERIALIZED_NAME_IS_UNKNOWN) - @javax.annotation.Nullable - private Boolean isUnknown = false; - - public Vulnerability() { - } - - public Vulnerability vendor(@javax.annotation.Nonnull String vendor) { - this.vendor = vendor; - return this; - } - - /** - * Get vendor - * @return vendor - */ - @javax.annotation.Nonnull - public String getVendor() { - return vendor; - } - - public void setVendor(@javax.annotation.Nonnull String vendor) { - this.vendor = vendor; - } - - - public Vulnerability product(@javax.annotation.Nonnull String product) { - this.product = product; - return this; - } - - /** - * Get product - * @return product - */ - @javax.annotation.Nonnull - public String getProduct() { - return product; - } - - public void setProduct(@javax.annotation.Nonnull String product) { - this.product = product; - } - - - public Vulnerability version(@javax.annotation.Nonnull String version) { - this.version = version; - return this; - } - - /** - * Get version - * @return version - */ - @javax.annotation.Nonnull - public String getVersion() { - return version; - } - - public void setVersion(@javax.annotation.Nonnull String version) { - this.version = version; - } - - - public Vulnerability cveNumber(@javax.annotation.Nonnull String cveNumber) { - this.cveNumber = cveNumber; - return this; - } - - /** - * Get cveNumber - * @return cveNumber - */ - @javax.annotation.Nonnull - public String getCveNumber() { - return cveNumber; - } - - public void setCveNumber(@javax.annotation.Nonnull String cveNumber) { - this.cveNumber = cveNumber; - } - - - public Vulnerability severity(@javax.annotation.Nonnull SeverityEnum severity) { - this.severity = severity; - return this; - } - - /** - * Get severity - * @return severity - */ - @javax.annotation.Nonnull - public SeverityEnum getSeverity() { - return severity; - } - - public void setSeverity(@javax.annotation.Nonnull SeverityEnum severity) { - this.severity = severity; - } - - - public Vulnerability source(@javax.annotation.Nonnull String source) { - this.source = source; - return this; - } - - /** - * Get source - * @return source - */ - @javax.annotation.Nonnull - public String getSource() { - return source; - } - - public void setSource(@javax.annotation.Nonnull String source) { - this.source = source; - } - - - public Vulnerability cvssVersion(@javax.annotation.Nonnull String cvssVersion) { - this.cvssVersion = cvssVersion; - return this; - } - - /** - * Get cvssVersion - * @return cvssVersion - */ - @javax.annotation.Nonnull - public String getCvssVersion() { - return cvssVersion; - } - - public void setCvssVersion(@javax.annotation.Nonnull String cvssVersion) { - this.cvssVersion = cvssVersion; - } - - - public Vulnerability cvssVector(@javax.annotation.Nonnull String cvssVector) { - this.cvssVector = cvssVector; - return this; - } - - /** - * Get cvssVector - * @return cvssVector - */ - @javax.annotation.Nonnull - public String getCvssVector() { - return cvssVector; - } - - public void setCvssVector(@javax.annotation.Nonnull String cvssVector) { - this.cvssVector = cvssVector; - } - - - public Vulnerability remarks(@javax.annotation.Nonnull String remarks) { - this.remarks = remarks; - return this; - } - - /** - * Get remarks - * @return remarks - */ - @javax.annotation.Nonnull - public String getRemarks() { - return remarks; - } - - public void setRemarks(@javax.annotation.Nonnull String remarks) { - this.remarks = remarks; - } - - - public Vulnerability score(@javax.annotation.Nonnull BigDecimal score) { - this.score = score; - return this; - } - - /** - * Get score - * @return score - */ - @javax.annotation.Nonnull - public BigDecimal getScore() { - return score; - } - - public void setScore(@javax.annotation.Nonnull BigDecimal score) { - this.score = score; - } - - - public Vulnerability isUnknown(@javax.annotation.Nullable Boolean isUnknown) { - this.isUnknown = isUnknown; - return this; - } - - /** - * Get isUnknown - * @return isUnknown - */ - @javax.annotation.Nullable - public Boolean getIsUnknown() { - return isUnknown; - } - - public void setIsUnknown(@javax.annotation.Nullable Boolean isUnknown) { - this.isUnknown = isUnknown; - } - - /** - * 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 Vulnerability instance itself - */ - public Vulnerability 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; - } - Vulnerability vulnerability = (Vulnerability) o; - return Objects.equals(this.vendor, vulnerability.vendor) && - Objects.equals(this.product, vulnerability.product) && - Objects.equals(this.version, vulnerability.version) && - Objects.equals(this.cveNumber, vulnerability.cveNumber) && - Objects.equals(this.severity, vulnerability.severity) && - Objects.equals(this.source, vulnerability.source) && - Objects.equals(this.cvssVersion, vulnerability.cvssVersion) && - Objects.equals(this.cvssVector, vulnerability.cvssVector) && - Objects.equals(this.remarks, vulnerability.remarks) && - Objects.equals(this.score, vulnerability.score) && - Objects.equals(this.isUnknown, vulnerability.isUnknown)&& - Objects.equals(this.additionalProperties, vulnerability.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(vendor, product, version, cveNumber, severity, source, cvssVersion, cvssVector, remarks, score, isUnknown, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Vulnerability {\n"); - sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" cveNumber: ").append(toIndentedString(cveNumber)).append("\n"); - sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append(" cvssVersion: ").append(toIndentedString(cvssVersion)).append("\n"); - sb.append(" cvssVector: ").append(toIndentedString(cvssVector)).append("\n"); - sb.append(" remarks: ").append(toIndentedString(remarks)).append("\n"); - sb.append(" score: ").append(toIndentedString(score)).append("\n"); - sb.append(" isUnknown: ").append(toIndentedString(isUnknown)).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("vendor", "product", "version", "cve_number", "severity", "source", "cvss_version", "cvss_vector", "remarks", "score", "is_unknown")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("vendor", "product", "version", "cve_number", "severity", "source", "cvss_version", "cvss_vector", "remarks", "score")); - } - - /** - * 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 Vulnerability - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Vulnerability.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 Vulnerability is not found in the empty JSON string", Vulnerability.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Vulnerability.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("vendor").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `vendor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vendor").toString())); - } - if (!jsonObj.get("product").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `product` to be a primitive type in the JSON string but got `%s`", jsonObj.get("product").toString())); - } - if (!jsonObj.get("version").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("version").toString())); - } - if (!jsonObj.get("cve_number").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `cve_number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cve_number").toString())); - } - if (!jsonObj.get("severity").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `severity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("severity").toString())); - } - // validate the required field `severity` - SeverityEnum.validateJsonElement(jsonObj.get("severity")); - 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())); - } - if (!jsonObj.get("cvss_version").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `cvss_version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cvss_version").toString())); - } - if (!jsonObj.get("cvss_vector").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `cvss_vector` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cvss_vector").toString())); - } - if (!jsonObj.get("remarks").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `remarks` to be a primitive type in the JSON string but got `%s`", jsonObj.get("remarks").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Vulnerability.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Vulnerability' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Vulnerability.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Vulnerability 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 Vulnerability read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Vulnerability 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 Vulnerability given an JSON string - * - * @param jsonString JSON string - * @return An instance of Vulnerability - * @throws IOException if the JSON string is invalid with respect to Vulnerability - */ - public static Vulnerability fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Vulnerability.class); - } - - /** - * Convert an instance of Vulnerability to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} -