From 0a29fe0e187acbee28532eee150d51c8fdc81b8d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 6 May 2026 07:47:13 +0000 Subject: [PATCH] Update SDK to version v3.80.1 - Generated from OpenAPI spec version v3.80.1 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 29 +- build.gradle | 4 +- build.sbt | 2 +- docs/AgentApi.md | 2 + docs/AnalysisReport.md | 26 + docs/ApiCall.md | 16 + docs/Connection.md | 18 + docs/DnsQuery.md | 14 + docs/DrakvufFileMetadata.md | 17 + docs/DynamicExecutionStatusResponse.md | 14 + docs/ErrorBody.md | 1 + docs/ExtractedURL.md | 14 + docs/FileActivityEntry.md | 14 + docs/HttpRequest.md | 28 + docs/MemdumpEntry.md | 24 + docs/ModuleLoadEntry.md | 16 + docs/MutexEntry.md | 14 + docs/NetworkActivity.md | 16 + docs/ProcessActivityEntry.md | 19 + docs/ProcessMemdumps.md | 14 + docs/ProcessNode.md | 23 + docs/ProcessTree.md | 14 + docs/RegistryOperation.md | 14 + docs/ReportEvent.md | 19 + docs/ReportInfo.md | 20 + docs/ReportOptions.md | 24 + docs/ScheduledTaskEntry.md | 23 + docs/ServiceEntry.md | 18 + docs/StartupInfo.md | 19 + docs/Ttp.md | 18 + pom.xml | 2 +- src/main/java/ai/reveng/api/AgentApi.java | 6 +- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 25 + .../java/ai/reveng/model/AnalysisReport.java | 764 ++++++++++++++++++ src/main/java/ai/reveng/model/ApiCall.java | 393 +++++++++ src/main/java/ai/reveng/model/Connection.java | 457 +++++++++++ src/main/java/ai/reveng/model/DnsQuery.java | 347 ++++++++ .../ai/reveng/model/DrakvufFileMetadata.java | 422 ++++++++++ .../model/DynamicExecutionStatusResponse.java | 323 ++++++++ src/main/java/ai/reveng/model/ErrorBody.java | 2 + .../java/ai/reveng/model/ExtractedURL.java | 347 ++++++++ .../ai/reveng/model/FileActivityEntry.java | 347 ++++++++ .../java/ai/reveng/model/HttpRequest.java | 746 +++++++++++++++++ .../java/ai/reveng/model/MemdumpEntry.java | 613 ++++++++++++++ .../java/ai/reveng/model/ModuleLoadEntry.java | 394 +++++++++ src/main/java/ai/reveng/model/MutexEntry.java | 347 ++++++++ .../java/ai/reveng/model/NetworkActivity.java | 428 ++++++++++ .../ai/reveng/model/ProcessActivityEntry.java | 492 +++++++++++ .../java/ai/reveng/model/ProcessMemdumps.java | 344 ++++++++ .../java/ai/reveng/model/ProcessNode.java | 595 ++++++++++++++ .../java/ai/reveng/model/ProcessTree.java | 337 ++++++++ .../ai/reveng/model/RegistryOperation.java | 347 ++++++++ .../java/ai/reveng/model/ReportEvent.java | 483 +++++++++++ src/main/java/ai/reveng/model/ReportInfo.java | 505 ++++++++++++ .../java/ai/reveng/model/ReportOptions.java | 620 ++++++++++++++ .../ai/reveng/model/ScheduledTaskEntry.java | 601 ++++++++++++++ .../java/ai/reveng/model/ServiceEntry.java | 456 +++++++++++ .../java/ai/reveng/model/StartupInfo.java | 467 +++++++++++ src/main/java/ai/reveng/model/Ttp.java | 477 +++++++++++ 62 files changed, 12175 insertions(+), 12 deletions(-) create mode 100644 docs/AnalysisReport.md create mode 100644 docs/ApiCall.md create mode 100644 docs/Connection.md create mode 100644 docs/DnsQuery.md create mode 100644 docs/DrakvufFileMetadata.md create mode 100644 docs/DynamicExecutionStatusResponse.md create mode 100644 docs/ExtractedURL.md create mode 100644 docs/FileActivityEntry.md create mode 100644 docs/HttpRequest.md create mode 100644 docs/MemdumpEntry.md create mode 100644 docs/ModuleLoadEntry.md create mode 100644 docs/MutexEntry.md create mode 100644 docs/NetworkActivity.md create mode 100644 docs/ProcessActivityEntry.md create mode 100644 docs/ProcessMemdumps.md create mode 100644 docs/ProcessNode.md create mode 100644 docs/ProcessTree.md create mode 100644 docs/RegistryOperation.md create mode 100644 docs/ReportEvent.md create mode 100644 docs/ReportInfo.md create mode 100644 docs/ReportOptions.md create mode 100644 docs/ScheduledTaskEntry.md create mode 100644 docs/ServiceEntry.md create mode 100644 docs/StartupInfo.md create mode 100644 docs/Ttp.md create mode 100644 src/main/java/ai/reveng/model/AnalysisReport.java create mode 100644 src/main/java/ai/reveng/model/ApiCall.java create mode 100644 src/main/java/ai/reveng/model/Connection.java create mode 100644 src/main/java/ai/reveng/model/DnsQuery.java create mode 100644 src/main/java/ai/reveng/model/DrakvufFileMetadata.java create mode 100644 src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java create mode 100644 src/main/java/ai/reveng/model/ExtractedURL.java create mode 100644 src/main/java/ai/reveng/model/FileActivityEntry.java create mode 100644 src/main/java/ai/reveng/model/HttpRequest.java create mode 100644 src/main/java/ai/reveng/model/MemdumpEntry.java create mode 100644 src/main/java/ai/reveng/model/ModuleLoadEntry.java create mode 100644 src/main/java/ai/reveng/model/MutexEntry.java create mode 100644 src/main/java/ai/reveng/model/NetworkActivity.java create mode 100644 src/main/java/ai/reveng/model/ProcessActivityEntry.java create mode 100644 src/main/java/ai/reveng/model/ProcessMemdumps.java create mode 100644 src/main/java/ai/reveng/model/ProcessNode.java create mode 100644 src/main/java/ai/reveng/model/ProcessTree.java create mode 100644 src/main/java/ai/reveng/model/RegistryOperation.java create mode 100644 src/main/java/ai/reveng/model/ReportEvent.java create mode 100644 src/main/java/ai/reveng/model/ReportInfo.java create mode 100644 src/main/java/ai/reveng/model/ReportOptions.java create mode 100644 src/main/java/ai/reveng/model/ScheduledTaskEntry.java create mode 100644 src/main/java/ai/reveng/model/ServiceEntry.java create mode 100644 src/main/java/ai/reveng/model/StartupInfo.java create mode 100644 src/main/java/ai/reveng/model/Ttp.java diff --git a/.sdk-version b/.sdk-version index c17f470..fbd4235 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.80.0 +v3.80.1 diff --git a/README.md b/README.md index db2d452..a183c6d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.80.0 + 3.80.1 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.80.0" + implementation "ai.reveng:sdk:3.80.1" } ``` @@ -209,6 +209,7 @@ Class | Method | HTTP request | Description - [AnalysisFunctions](docs/AnalysisFunctions.md) - [AnalysisFunctionsList](docs/AnalysisFunctionsList.md) - [AnalysisRecord](docs/AnalysisRecord.md) + - [AnalysisReport](docs/AnalysisReport.md) - [AnalysisScope](docs/AnalysisScope.md) - [AnalysisStringInput](docs/AnalysisStringInput.md) - [AnalysisStringsResponse](docs/AnalysisStringsResponse.md) @@ -217,6 +218,7 @@ Class | Method | HTTP request | Description - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) - [AnalysisUpdateTagsResponse](docs/AnalysisUpdateTagsResponse.md) + - [ApiCall](docs/ApiCall.md) - [AppApiRestV2AgentSchemaCapability](docs/AppApiRestV2AgentSchemaCapability.md) - [AppApiRestV2AnalysesEnumsOrderBy](docs/AppApiRestV2AnalysesEnumsOrderBy.md) - [AppApiRestV2CollectionsEnumsOrderBy](docs/AppApiRestV2CollectionsEnumsOrderBy.md) @@ -332,6 +334,7 @@ Class | Method | HTTP request | Description - [CommentUpdateRequest](docs/CommentUpdateRequest.md) - [ConfigResponse](docs/ConfigResponse.md) - [ConfirmToolInputBody](docs/ConfirmToolInputBody.md) + - [Connection](docs/Connection.md) - [Context](docs/Context.md) - [Conversation](docs/Conversation.md) - [ConversationContext](docs/ConversationContext.md) @@ -340,7 +343,10 @@ Class | Method | HTTP request | Description - [Created](docs/Created.md) - [DecompilationCommentContext](docs/DecompilationCommentContext.md) - [DieMatch](docs/DieMatch.md) + - [DnsQuery](docs/DnsQuery.md) + - [DrakvufFileMetadata](docs/DrakvufFileMetadata.md) - [DynamicExecutionStatus](docs/DynamicExecutionStatus.md) + - [DynamicExecutionStatusResponse](docs/DynamicExecutionStatusResponse.md) - [ELFImportModel](docs/ELFImportModel.md) - [ELFModel](docs/ELFModel.md) - [ELFRelocation](docs/ELFRelocation.md) @@ -372,6 +378,8 @@ Class | Method | HTTP request | Description - [EventTOOLCONFIRMATIONREQUIRED](docs/EventTOOLCONFIRMATIONREQUIRED.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) + - [ExtractedURL](docs/ExtractedURL.md) + - [FileActivityEntry](docs/FileActivityEntry.md) - [FileFormat](docs/FileFormat.md) - [FileHashes](docs/FileHashes.md) - [FileMetadata](docs/FileMetadata.md) @@ -421,6 +429,7 @@ Class | Method | HTTP request | Description - [GetMeResponse](docs/GetMeResponse.md) - [GetPublicUserResponse](docs/GetPublicUserResponse.md) - [GlobalVariable](docs/GlobalVariable.md) + - [HttpRequest](docs/HttpRequest.md) - [IOC](docs/IOC.md) - [ISA](docs/ISA.md) - [IconModel](docs/IconModel.md) @@ -434,33 +443,47 @@ Class | Method | HTTP request | Description - [MITRETechnique](docs/MITRETechnique.md) - [MatchedFunction](docs/MatchedFunction.md) - [MatchedFunctionSuggestion](docs/MatchedFunctionSuggestion.md) + - [MemdumpEntry](docs/MemdumpEntry.md) - [MetaModel](docs/MetaModel.md) - [ModelName](docs/ModelName.md) - [ModelsResponse](docs/ModelsResponse.md) + - [ModuleLoadEntry](docs/ModuleLoadEntry.md) + - [MutexEntry](docs/MutexEntry.md) - [NameConfidence](docs/NameConfidence.md) - [NameSourceType](docs/NameSourceType.md) + - [NetworkActivity](docs/NetworkActivity.md) - [Order](docs/Order.md) - [PDBDebugModel](docs/PDBDebugModel.md) - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) - [Params](docs/Params.md) - [Platform](docs/Platform.md) + - [ProcessActivityEntry](docs/ProcessActivityEntry.md) + - [ProcessMemdumps](docs/ProcessMemdumps.md) + - [ProcessNode](docs/ProcessNode.md) + - [ProcessTree](docs/ProcessTree.md) - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) - [QueuePositionResponse](docs/QueuePositionResponse.md) - [QueuedWorkflowTaskResponse](docs/QueuedWorkflowTaskResponse.md) - [ReAnalysisForm](docs/ReAnalysisForm.md) - [Recent](docs/Recent.md) - [RegenerateTarget](docs/RegenerateTarget.md) + - [RegistryOperation](docs/RegistryOperation.md) - [RelativeBinaryResponse](docs/RelativeBinaryResponse.md) - [ReportAnalysisResponse](docs/ReportAnalysisResponse.md) + - [ReportEvent](docs/ReportEvent.md) + - [ReportInfo](docs/ReportInfo.md) + - [ReportOptions](docs/ReportOptions.md) - [SBOM](docs/SBOM.md) - [SBOMPackage](docs/SBOMPackage.md) - [SandboxOptions](docs/SandboxOptions.md) + - [ScheduledTaskEntry](docs/ScheduledTaskEntry.md) - [ScrapeThirdPartyConfig](docs/ScrapeThirdPartyConfig.md) - [SectionModel](docs/SectionModel.md) - [SecurityModel](docs/SecurityModel.md) - [SegmentInfo](docs/SegmentInfo.md) - [SendMessageRequest](docs/SendMessageRequest.md) + - [ServiceEntry](docs/ServiceEntry.md) - [SingleCodeCertificateModel](docs/SingleCodeCertificateModel.md) - [SingleCodeSignatureModel](docs/SingleCodeSignatureModel.md) - [SinglePDBEntryModel](docs/SinglePDBEntryModel.md) @@ -482,6 +505,7 @@ Class | Method | HTTP request | Description - [SseEventToolCallStartData](docs/SseEventToolCallStartData.md) - [SseEventToolConfirmationRequiredData](docs/SseEventToolConfirmationRequiredData.md) - [StackVariable](docs/StackVariable.md) + - [StartupInfo](docs/StartupInfo.md) - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) - [StatusResponse](docs/StatusResponse.md) @@ -503,6 +527,7 @@ Class | Method | HTTP request | Description - [TimestampModel](docs/TimestampModel.md) - [TriageFunctionResponse](docs/TriageFunctionResponse.md) - [TriageReportResponse](docs/TriageReportResponse.md) + - [Ttp](docs/Ttp.md) - [TypeDefinition](docs/TypeDefinition.md) - [UpdateFunctionDataTypes](docs/UpdateFunctionDataTypes.md) - [UploadFileType](docs/UploadFileType.md) diff --git a/build.gradle b/build.gradle index 6013c64..1750abb 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.80.0' +version = '3.80.1' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.80.0") + coordinates("ai.reveng", "sdk", "3.80.1") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 59a014c..da4adf2 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.80.0", + version := "3.80.1", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AgentApi.md b/docs/AgentApi.md index 5b90fbc..326987f 100644 --- a/docs/AgentApi.md +++ b/docs/AgentApi.md @@ -498,6 +498,8 @@ public class Example { Get Report Analysis Result +Returns: - A summary of the analysis - The software type of the binary - An attack flow summary - List of IOCs - List of MITRE executable techniques - A YARA rule + ### Example ```java // Import classes: diff --git a/docs/AnalysisReport.md b/docs/AnalysisReport.md new file mode 100644 index 0000000..3441ebb --- /dev/null +++ b/docs/AnalysisReport.md @@ -0,0 +1,26 @@ + + +# AnalysisReport + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fileActivity** | **List<FileActivityEntry>** | | [optional] | +|**info** | **ReportInfo** | | | +|**memdumps** | **List<ProcessMemdumps>** | | [optional] | +|**moduleLoadAddresses** | **List<ModuleLoadEntry>** | | [optional] | +|**mutexes** | **List<MutexEntry>** | | [optional] | +|**networkActivity** | **NetworkActivity** | | [optional] | +|**processActivity** | **List<ProcessActivityEntry>** | | [optional] | +|**processTree** | **ProcessTree** | | [optional] | +|**registryOperations** | **List<RegistryOperation>** | | [optional] | +|**scheduledTasks** | **List<ScheduledTaskEntry>** | | [optional] | +|**services** | **List<ServiceEntry>** | | [optional] | +|**startup** | **StartupInfo** | | [optional] | +|**threatScore** | **Long** | | | +|**ttps** | **List<Ttp>** | | [optional] | + + + diff --git a/docs/ApiCall.md b/docs/ApiCall.md new file mode 100644 index 0000000..1470057 --- /dev/null +++ b/docs/ApiCall.md @@ -0,0 +1,16 @@ + + +# ApiCall + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**calledFrom** | **String** | | [optional] | +|**calledFromRva** | **String** | | [optional] | +|**fromModule** | **String** | | [optional] | +|**method** | **String** | | | + + + diff --git a/docs/Connection.md b/docs/Connection.md new file mode 100644 index 0000000..8e163da --- /dev/null +++ b/docs/Connection.md @@ -0,0 +1,18 @@ + + +# Connection + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**localIp** | **String** | | | +|**localPort** | **Object** | | | +|**protocol** | **String** | | | +|**remoteIp** | **String** | | | +|**remotePort** | **Object** | | | + + + diff --git a/docs/DnsQuery.md b/docs/DnsQuery.md new file mode 100644 index 0000000..324b53b --- /dev/null +++ b/docs/DnsQuery.md @@ -0,0 +1,14 @@ + + +# DnsQuery + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**domain** | **String** | | | +|**events** | **List<ReportEvent>** | | [optional] | + + + diff --git a/docs/DrakvufFileMetadata.md b/docs/DrakvufFileMetadata.md new file mode 100644 index 0000000..0384e91 --- /dev/null +++ b/docs/DrakvufFileMetadata.md @@ -0,0 +1,17 @@ + + +# DrakvufFileMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mimeType** | **String** | | [optional] | +|**name** | **String** | | | +|**sha256** | **String** | | | +|**type** | **String** | | [optional] | +|**typeId** | **String** | | [optional] | + + + diff --git a/docs/DynamicExecutionStatusResponse.md b/docs/DynamicExecutionStatusResponse.md new file mode 100644 index 0000000..f25bf76 --- /dev/null +++ b/docs/DynamicExecutionStatusResponse.md @@ -0,0 +1,14 @@ + + +# DynamicExecutionStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**errorMessage** | **String** | Error detail, set when status is ERROR | [optional] | +|**status** | **String** | Task status: UNINITIALISED, PENDING, RUNNING, COMPLETED, or ERROR | | + + + diff --git a/docs/ErrorBody.md b/docs/ErrorBody.md index 95db66a..1347740 100644 --- a/docs/ErrorBody.md +++ b/docs/ErrorBody.md @@ -27,6 +27,7 @@ | CONVERSATION_NOT_FOUND | "CONVERSATION_NOT_FOUND" | | DOMAIN_ALREADY_CLAIMED | "DOMAIN_ALREADY_CLAIMED" | | DOMAIN_VERIFICATION_PENDING | "DOMAIN_VERIFICATION_PENDING" | +| DYNAMIC_EXECUTION_INCOMPLETE | "DYNAMIC_EXECUTION_INCOMPLETE" | | EMAIL_NOT_VERIFIED | "EMAIL_NOT_VERIFIED" | | EXTERNAL_USER | "EXTERNAL_USER" | | FORBIDDEN | "FORBIDDEN" | diff --git a/docs/ExtractedURL.md b/docs/ExtractedURL.md new file mode 100644 index 0000000..a4b464d --- /dev/null +++ b/docs/ExtractedURL.md @@ -0,0 +1,14 @@ + + +# ExtractedURL + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**url** | **String** | | | + + + diff --git a/docs/FileActivityEntry.md b/docs/FileActivityEntry.md new file mode 100644 index 0000000..2b8edbe --- /dev/null +++ b/docs/FileActivityEntry.md @@ -0,0 +1,14 @@ + + +# FileActivityEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**path** | **String** | | | + + + diff --git a/docs/HttpRequest.md b/docs/HttpRequest.md new file mode 100644 index 0000000..23a19c5 --- /dev/null +++ b/docs/HttpRequest.md @@ -0,0 +1,28 @@ + + +# HttpRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**extraHeaders** | **List<String>** | | [optional] | +|**flags** | **Long** | | [optional] | +|**password** | **String** | | [optional] | +|**path** | **String** | | [optional] | +|**postData** | **String** | | [optional] | +|**proxy** | **String** | | [optional] | +|**proxyBypass** | **String** | | [optional] | +|**referer** | **String** | | [optional] | +|**serverName** | **String** | | [optional] | +|**serverPort** | **Long** | | [optional] | +|**service** | **Long** | | [optional] | +|**userAgent** | **String** | | [optional] | +|**username** | **String** | | [optional] | +|**verb** | **String** | | [optional] | +|**version** | **String** | | [optional] | + + + diff --git a/docs/MemdumpEntry.md b/docs/MemdumpEntry.md new file mode 100644 index 0000000..6d83c52 --- /dev/null +++ b/docs/MemdumpEntry.md @@ -0,0 +1,24 @@ + + +# MemdumpEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**address** | **String** | | | +|**dumpReason** | **String** | | | +|**fileType** | **String** | | [optional] | +|**filename** | **String** | | | +|**index** | **Long** | | | +|**isPe** | **Boolean** | | [optional] | +|**method** | **String** | | | +|**mimeType** | **String** | | [optional] | +|**sha256** | **String** | | [optional] | +|**size** | **Long** | | | +|**targetAddr** | **String** | | [optional] | +|**targetProcess** | **Long** | | [optional] | + + + diff --git a/docs/ModuleLoadEntry.md b/docs/ModuleLoadEntry.md new file mode 100644 index 0000000..dfbdac1 --- /dev/null +++ b/docs/ModuleLoadEntry.md @@ -0,0 +1,16 @@ + + +# ModuleLoadEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**modules** | **Map<String, String>** | | [optional] | +|**pid** | **Long** | | | +|**processName** | **String** | | [optional] | +|**processSeqid** | **Long** | | [optional] | + + + diff --git a/docs/MutexEntry.md b/docs/MutexEntry.md new file mode 100644 index 0000000..5abc90d --- /dev/null +++ b/docs/MutexEntry.md @@ -0,0 +1,14 @@ + + +# MutexEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**name** | **String** | | | + + + diff --git a/docs/NetworkActivity.md b/docs/NetworkActivity.md new file mode 100644 index 0000000..398ade5 --- /dev/null +++ b/docs/NetworkActivity.md @@ -0,0 +1,16 @@ + + +# NetworkActivity + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**connections** | **List<Connection>** | | [optional] | +|**dnsQueries** | **List<DnsQuery>** | | [optional] | +|**extractedUrls** | **List<ExtractedURL>** | | [optional] | +|**httpRequests** | **List<HttpRequest>** | | [optional] | + + + diff --git a/docs/ProcessActivityEntry.md b/docs/ProcessActivityEntry.md new file mode 100644 index 0000000..730cfbb --- /dev/null +++ b/docs/ProcessActivityEntry.md @@ -0,0 +1,19 @@ + + +# ProcessActivityEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**args** | **List<String>** | | [optional] | +|**childSeqid** | **Long** | | | +|**events** | **List<ReportEvent>** | | [optional] | +|**exitCode** | **Long** | | [optional] | +|**exitCodeStr** | **String** | | [optional] | +|**name** | **String** | | | +|**pid** | **Long** | | | + + + diff --git a/docs/ProcessMemdumps.md b/docs/ProcessMemdumps.md new file mode 100644 index 0000000..5c180f9 --- /dev/null +++ b/docs/ProcessMemdumps.md @@ -0,0 +1,14 @@ + + +# ProcessMemdumps + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dumps** | **List<MemdumpEntry>** | | [optional] | +|**processSeqid** | **Long** | | | + + + diff --git a/docs/ProcessNode.md b/docs/ProcessNode.md new file mode 100644 index 0000000..b2d2c0c --- /dev/null +++ b/docs/ProcessNode.md @@ -0,0 +1,23 @@ + + +# ProcessNode + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**args** | **List<String>** | | [optional] | +|**attributed** | **Boolean** | | | +|**children** | **List<ProcessNode>** | | [optional] | +|**exitCode** | **Long** | | [optional] | +|**exitCodeStr** | **String** | | [optional] | +|**exitedAt** | **Double** | | [optional] | +|**killedBy** | **Long** | | [optional] | +|**name** | **String** | | | +|**pid** | **Long** | | | +|**seqid** | **Long** | | | +|**startedAt** | **Double** | | [optional] | + + + diff --git a/docs/ProcessTree.md b/docs/ProcessTree.md new file mode 100644 index 0000000..6df7d7e --- /dev/null +++ b/docs/ProcessTree.md @@ -0,0 +1,14 @@ + + +# ProcessTree + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nodes** | **List<ProcessNode>** | | [optional] | +|**sampleSeqid** | **Long** | | [optional] | + + + diff --git a/docs/RegistryOperation.md b/docs/RegistryOperation.md new file mode 100644 index 0000000..6545fe1 --- /dev/null +++ b/docs/RegistryOperation.md @@ -0,0 +1,14 @@ + + +# RegistryOperation + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | **List<ReportEvent>** | | [optional] | +|**key** | **String** | | | + + + diff --git a/docs/ReportEvent.md b/docs/ReportEvent.md new file mode 100644 index 0000000..9cc4a23 --- /dev/null +++ b/docs/ReportEvent.md @@ -0,0 +1,19 @@ + + +# ReportEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**apiCalls** | **List<ApiCall>** | | [optional] | +|**processSeqid** | **Long** | | [optional] | +|**totalBytesRequested** | **Long** | | [optional] | +|**type** | **String** | | | +|**value** | **String** | | [optional] | +|**valueName** | **String** | | [optional] | +|**writeCount** | **Long** | | [optional] | + + + diff --git a/docs/ReportInfo.md b/docs/ReportInfo.md new file mode 100644 index 0000000..408758e --- /dev/null +++ b/docs/ReportInfo.md @@ -0,0 +1,20 @@ + + +# ReportInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | **DrakvufFileMetadata** | | [optional] | +|**id** | **String** | | | +|**options** | **ReportOptions** | | [optional] | +|**osProfile** | **String** | | [optional] | +|**status** | **String** | | [optional] | +|**timeAnalysisFinished** | **String** | | [optional] | +|**timeExecutionStarted** | **String** | | [optional] | +|**timeStarted** | **String** | | [optional] | + + + diff --git a/docs/ReportOptions.md b/docs/ReportOptions.md new file mode 100644 index 0000000..c1daffc --- /dev/null +++ b/docs/ReportOptions.md @@ -0,0 +1,24 @@ + + +# ReportOptions + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**archiveEntryPath** | **String** | | [optional] | +|**extractArchive** | **Boolean** | | [optional] | +|**guestTargetDirectory** | **String** | | [optional] | +|**guestWorkingDirectory** | **String** | | [optional] | +|**netEnable** | **Boolean** | | [optional] | +|**osProfile** | **String** | | [optional] | +|**plugins** | **List<String>** | | [optional] | +|**preset** | **String** | | [optional] | +|**sampleFilename** | **String** | | [optional] | +|**startCommand** | **String** | | [optional] | +|**startMethod** | **String** | | [optional] | +|**timeout** | **Long** | | [optional] | + + + diff --git a/docs/ScheduledTaskEntry.md b/docs/ScheduledTaskEntry.md new file mode 100644 index 0000000..385c366 --- /dev/null +++ b/docs/ScheduledTaskEntry.md @@ -0,0 +1,23 @@ + + +# ScheduledTaskEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**command** | **String** | | [optional] | +|**day** | **String** | | [optional] | +|**endDate** | **String** | | [optional] | +|**events** | **List<ReportEvent>** | | [optional] | +|**executable** | **String** | | [optional] | +|**modifier** | **String** | | [optional] | +|**runAs** | **String** | | [optional] | +|**scheduleType** | **String** | | [optional] | +|**startDate** | **String** | | [optional] | +|**startTime** | **String** | | [optional] | +|**taskName** | **String** | | [optional] | + + + diff --git a/docs/ServiceEntry.md b/docs/ServiceEntry.md new file mode 100644 index 0000000..24dab9f --- /dev/null +++ b/docs/ServiceEntry.md @@ -0,0 +1,18 @@ + + +# ServiceEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaryPath** | **String** | | [optional] | +|**displayName** | **String** | | [optional] | +|**events** | **List<ReportEvent>** | | [optional] | +|**name** | **String** | | [optional] | +|**serviceType** | **String** | | [optional] | +|**startType** | **String** | | [optional] | + + + diff --git a/docs/StartupInfo.md b/docs/StartupInfo.md new file mode 100644 index 0000000..8b7f992 --- /dev/null +++ b/docs/StartupInfo.md @@ -0,0 +1,19 @@ + + +# StartupInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arguments** | **String** | | [optional] | +|**error** | **String** | | [optional] | +|**errorCode** | **String** | | [optional] | +|**pid** | **Long** | | [optional] | +|**process** | **Long** | | [optional] | +|**processName** | **String** | | [optional] | +|**status** | **String** | | [optional] | + + + diff --git a/docs/Ttp.md b/docs/Ttp.md new file mode 100644 index 0000000..c5d6e29 --- /dev/null +++ b/docs/Ttp.md @@ -0,0 +1,18 @@ + + +# Ttp + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attAmpersandCk** | **List<String>** | | [optional] | +|**mbc** | **List<Object>** | | [optional] | +|**name** | **String** | | [optional] | +|**namespace** | **String** | | [optional] | +|**processSeqids** | **List<Long>** | | [optional] | +|**score** | **Long** | | | + + + diff --git a/pom.xml b/pom.xml index 2c1eb9e..0918d53 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.80.0 + 3.80.1 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AgentApi.java b/src/main/java/ai/reveng/api/AgentApi.java index 4f37e7d..fddcb18 100644 --- a/src/main/java/ai/reveng/api/AgentApi.java +++ b/src/main/java/ai/reveng/api/AgentApi.java @@ -1071,7 +1071,7 @@ private okhttp3.Call getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnaly /** * Get Report Analysis Result - * + * Returns: - A summary of the analysis - The software type of the binary - An attack flow summary - List of IOCs - List of MITRE executable techniques - A YARA rule * @param analysisId (required) * @return BaseResponseReportAnalysisResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1090,7 +1090,7 @@ public BaseResponseReportAnalysisResponse getReportAnalysisResultV2AnalysesAnaly /** * Get Report Analysis Result - * + * Returns: - A summary of the analysis - The software type of the binary - An attack flow summary - List of IOCs - List of MITRE executable techniques - A YARA rule * @param analysisId (required) * @return ApiResponse<BaseResponseReportAnalysisResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1110,7 +1110,7 @@ public ApiResponse getReportAnalysisResultV2 /** * Get Report Analysis Result (asynchronously) - * + * Returns: - A summary of the analysis - The software type of the binary - An attack flow summary - List of IOCs - List of MITRE executable techniques - A YARA rule * @param analysisId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 84a235c..ea36d35 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -146,7 +146,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.80.0/java"); + setUserAgent("OpenAPI-Generator/3.80.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 fd4f6c3..fbfc4f8 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.80.0"; + public static final String VERSION = "3.80.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 e996f5f..fae1cb5 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -115,6 +115,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisReport.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsStatusResponse.CustomTypeAdapterFactory()); @@ -122,6 +123,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ApiCall.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2AgentSchemaCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsResponsesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); @@ -232,6 +234,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CommentUpdateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ConfigResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ConfirmToolInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Connection.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Context.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Conversation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ConversationContext.CustomTypeAdapterFactory()); @@ -240,6 +243,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Created.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationCommentContext.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DieMatch.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DnsQuery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DrakvufFileMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DynamicExecutionStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFImportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFRelocation.CustomTypeAdapterFactory()); @@ -271,6 +277,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCONFIRMATIONREQUIRED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedURL.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileActivityEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileHashes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBlockDestinationResponse.CustomTypeAdapterFactory()); @@ -316,6 +324,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetMeResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetPublicUserResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GlobalVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HttpRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IOC.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IconModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportModel.CustomTypeAdapterFactory()); @@ -328,29 +337,43 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MITRETechnique.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MatchedFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MatchedFunctionSuggestion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MemdumpEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MetaModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ModelsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ModuleLoadEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MutexEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NameConfidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NameSourceType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkActivity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PDBDebugModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PEModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PaginationModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Params.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessActivityEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessMemdumps.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessNode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessTree.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PutAnalysisStringsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuePositionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuedWorkflowTaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReAnalysisForm.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Recent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RegistryOperation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RelativeBinaryResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportAnalysisResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportOptions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOM.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOMPackage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SandboxOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScheduledTaskEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScrapeThirdPartyConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SectionModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecurityModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SegmentInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SendMessageRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ServiceEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleCodeCertificateModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleCodeSignatureModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SinglePDBEntryModel.CustomTypeAdapterFactory()); @@ -372,6 +395,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventToolCallStartData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventToolConfirmationRequiredData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StackVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartupInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StreamEvents200ResponseInner.CustomTypeAdapterFactory()); @@ -390,6 +414,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TimestampModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageFunctionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageReportResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Ttp.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypeDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateFunctionDataTypes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UploadResponse.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisReport.java b/src/main/java/ai/reveng/model/AnalysisReport.java new file mode 100644 index 0000000..3f8fa0c --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisReport.java @@ -0,0 +1,764 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.FileActivityEntry; +import ai.reveng.model.ModuleLoadEntry; +import ai.reveng.model.MutexEntry; +import ai.reveng.model.NetworkActivity; +import ai.reveng.model.ProcessActivityEntry; +import ai.reveng.model.ProcessMemdumps; +import ai.reveng.model.ProcessTree; +import ai.reveng.model.RegistryOperation; +import ai.reveng.model.ReportInfo; +import ai.reveng.model.ScheduledTaskEntry; +import ai.reveng.model.ServiceEntry; +import ai.reveng.model.StartupInfo; +import ai.reveng.model.Ttp; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisReport + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisReport { + public static final String SERIALIZED_NAME_FILE_ACTIVITY = "file_activity"; + @SerializedName(SERIALIZED_NAME_FILE_ACTIVITY) + @javax.annotation.Nullable + private List fileActivity; + + public static final String SERIALIZED_NAME_INFO = "info"; + @SerializedName(SERIALIZED_NAME_INFO) + @javax.annotation.Nonnull + private ReportInfo info; + + public static final String SERIALIZED_NAME_MEMDUMPS = "memdumps"; + @SerializedName(SERIALIZED_NAME_MEMDUMPS) + @javax.annotation.Nullable + private List memdumps; + + public static final String SERIALIZED_NAME_MODULE_LOAD_ADDRESSES = "module_load_addresses"; + @SerializedName(SERIALIZED_NAME_MODULE_LOAD_ADDRESSES) + @javax.annotation.Nullable + private List moduleLoadAddresses; + + public static final String SERIALIZED_NAME_MUTEXES = "mutexes"; + @SerializedName(SERIALIZED_NAME_MUTEXES) + @javax.annotation.Nullable + private List mutexes; + + public static final String SERIALIZED_NAME_NETWORK_ACTIVITY = "network_activity"; + @SerializedName(SERIALIZED_NAME_NETWORK_ACTIVITY) + @javax.annotation.Nullable + private NetworkActivity networkActivity; + + public static final String SERIALIZED_NAME_PROCESS_ACTIVITY = "process_activity"; + @SerializedName(SERIALIZED_NAME_PROCESS_ACTIVITY) + @javax.annotation.Nullable + private List processActivity; + + public static final String SERIALIZED_NAME_PROCESS_TREE = "process_tree"; + @SerializedName(SERIALIZED_NAME_PROCESS_TREE) + @javax.annotation.Nullable + private ProcessTree processTree; + + public static final String SERIALIZED_NAME_REGISTRY_OPERATIONS = "registry_operations"; + @SerializedName(SERIALIZED_NAME_REGISTRY_OPERATIONS) + @javax.annotation.Nullable + private List registryOperations; + + public static final String SERIALIZED_NAME_SCHEDULED_TASKS = "scheduled_tasks"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_TASKS) + @javax.annotation.Nullable + private List scheduledTasks; + + public static final String SERIALIZED_NAME_SERVICES = "services"; + @SerializedName(SERIALIZED_NAME_SERVICES) + @javax.annotation.Nullable + private List services; + + public static final String SERIALIZED_NAME_STARTUP = "startup"; + @SerializedName(SERIALIZED_NAME_STARTUP) + @javax.annotation.Nullable + private StartupInfo startup; + + public static final String SERIALIZED_NAME_THREAT_SCORE = "threat_score"; + @SerializedName(SERIALIZED_NAME_THREAT_SCORE) + @javax.annotation.Nonnull + private Long threatScore; + + public static final String SERIALIZED_NAME_TTPS = "ttps"; + @SerializedName(SERIALIZED_NAME_TTPS) + @javax.annotation.Nullable + private List ttps; + + public AnalysisReport() { + } + + public AnalysisReport fileActivity(@javax.annotation.Nullable List fileActivity) { + this.fileActivity = fileActivity; + return this; + } + + public AnalysisReport addFileActivityItem(FileActivityEntry fileActivityItem) { + if (this.fileActivity == null) { + this.fileActivity = new ArrayList<>(); + } + this.fileActivity.add(fileActivityItem); + return this; + } + + /** + * Get fileActivity + * @return fileActivity + */ + @javax.annotation.Nullable + public List getFileActivity() { + return fileActivity; + } + + public void setFileActivity(@javax.annotation.Nullable List fileActivity) { + this.fileActivity = fileActivity; + } + + + public AnalysisReport info(@javax.annotation.Nonnull ReportInfo info) { + this.info = info; + return this; + } + + /** + * Get info + * @return info + */ + @javax.annotation.Nonnull + public ReportInfo getInfo() { + return info; + } + + public void setInfo(@javax.annotation.Nonnull ReportInfo info) { + this.info = info; + } + + + public AnalysisReport memdumps(@javax.annotation.Nullable List memdumps) { + this.memdumps = memdumps; + return this; + } + + public AnalysisReport addMemdumpsItem(ProcessMemdumps memdumpsItem) { + if (this.memdumps == null) { + this.memdumps = new ArrayList<>(); + } + this.memdumps.add(memdumpsItem); + return this; + } + + /** + * Get memdumps + * @return memdumps + */ + @javax.annotation.Nullable + public List getMemdumps() { + return memdumps; + } + + public void setMemdumps(@javax.annotation.Nullable List memdumps) { + this.memdumps = memdumps; + } + + + public AnalysisReport moduleLoadAddresses(@javax.annotation.Nullable List moduleLoadAddresses) { + this.moduleLoadAddresses = moduleLoadAddresses; + return this; + } + + public AnalysisReport addModuleLoadAddressesItem(ModuleLoadEntry moduleLoadAddressesItem) { + if (this.moduleLoadAddresses == null) { + this.moduleLoadAddresses = new ArrayList<>(); + } + this.moduleLoadAddresses.add(moduleLoadAddressesItem); + return this; + } + + /** + * Get moduleLoadAddresses + * @return moduleLoadAddresses + */ + @javax.annotation.Nullable + public List getModuleLoadAddresses() { + return moduleLoadAddresses; + } + + public void setModuleLoadAddresses(@javax.annotation.Nullable List moduleLoadAddresses) { + this.moduleLoadAddresses = moduleLoadAddresses; + } + + + public AnalysisReport mutexes(@javax.annotation.Nullable List mutexes) { + this.mutexes = mutexes; + return this; + } + + public AnalysisReport addMutexesItem(MutexEntry mutexesItem) { + if (this.mutexes == null) { + this.mutexes = new ArrayList<>(); + } + this.mutexes.add(mutexesItem); + return this; + } + + /** + * Get mutexes + * @return mutexes + */ + @javax.annotation.Nullable + public List getMutexes() { + return mutexes; + } + + public void setMutexes(@javax.annotation.Nullable List mutexes) { + this.mutexes = mutexes; + } + + + public AnalysisReport networkActivity(@javax.annotation.Nullable NetworkActivity networkActivity) { + this.networkActivity = networkActivity; + return this; + } + + /** + * Get networkActivity + * @return networkActivity + */ + @javax.annotation.Nullable + public NetworkActivity getNetworkActivity() { + return networkActivity; + } + + public void setNetworkActivity(@javax.annotation.Nullable NetworkActivity networkActivity) { + this.networkActivity = networkActivity; + } + + + public AnalysisReport processActivity(@javax.annotation.Nullable List processActivity) { + this.processActivity = processActivity; + return this; + } + + public AnalysisReport addProcessActivityItem(ProcessActivityEntry processActivityItem) { + if (this.processActivity == null) { + this.processActivity = new ArrayList<>(); + } + this.processActivity.add(processActivityItem); + return this; + } + + /** + * Get processActivity + * @return processActivity + */ + @javax.annotation.Nullable + public List getProcessActivity() { + return processActivity; + } + + public void setProcessActivity(@javax.annotation.Nullable List processActivity) { + this.processActivity = processActivity; + } + + + public AnalysisReport processTree(@javax.annotation.Nullable ProcessTree processTree) { + this.processTree = processTree; + return this; + } + + /** + * Get processTree + * @return processTree + */ + @javax.annotation.Nullable + public ProcessTree getProcessTree() { + return processTree; + } + + public void setProcessTree(@javax.annotation.Nullable ProcessTree processTree) { + this.processTree = processTree; + } + + + public AnalysisReport registryOperations(@javax.annotation.Nullable List registryOperations) { + this.registryOperations = registryOperations; + return this; + } + + public AnalysisReport addRegistryOperationsItem(RegistryOperation registryOperationsItem) { + if (this.registryOperations == null) { + this.registryOperations = new ArrayList<>(); + } + this.registryOperations.add(registryOperationsItem); + return this; + } + + /** + * Get registryOperations + * @return registryOperations + */ + @javax.annotation.Nullable + public List getRegistryOperations() { + return registryOperations; + } + + public void setRegistryOperations(@javax.annotation.Nullable List registryOperations) { + this.registryOperations = registryOperations; + } + + + public AnalysisReport scheduledTasks(@javax.annotation.Nullable List scheduledTasks) { + this.scheduledTasks = scheduledTasks; + return this; + } + + public AnalysisReport addScheduledTasksItem(ScheduledTaskEntry scheduledTasksItem) { + if (this.scheduledTasks == null) { + this.scheduledTasks = new ArrayList<>(); + } + this.scheduledTasks.add(scheduledTasksItem); + return this; + } + + /** + * Get scheduledTasks + * @return scheduledTasks + */ + @javax.annotation.Nullable + public List getScheduledTasks() { + return scheduledTasks; + } + + public void setScheduledTasks(@javax.annotation.Nullable List scheduledTasks) { + this.scheduledTasks = scheduledTasks; + } + + + public AnalysisReport services(@javax.annotation.Nullable List services) { + this.services = services; + return this; + } + + public AnalysisReport addServicesItem(ServiceEntry servicesItem) { + if (this.services == null) { + this.services = new ArrayList<>(); + } + this.services.add(servicesItem); + return this; + } + + /** + * Get services + * @return services + */ + @javax.annotation.Nullable + public List getServices() { + return services; + } + + public void setServices(@javax.annotation.Nullable List services) { + this.services = services; + } + + + public AnalysisReport startup(@javax.annotation.Nullable StartupInfo startup) { + this.startup = startup; + return this; + } + + /** + * Get startup + * @return startup + */ + @javax.annotation.Nullable + public StartupInfo getStartup() { + return startup; + } + + public void setStartup(@javax.annotation.Nullable StartupInfo startup) { + this.startup = startup; + } + + + public AnalysisReport threatScore(@javax.annotation.Nonnull Long threatScore) { + this.threatScore = threatScore; + return this; + } + + /** + * Get threatScore + * @return threatScore + */ + @javax.annotation.Nonnull + public Long getThreatScore() { + return threatScore; + } + + public void setThreatScore(@javax.annotation.Nonnull Long threatScore) { + this.threatScore = threatScore; + } + + + public AnalysisReport ttps(@javax.annotation.Nullable List ttps) { + this.ttps = ttps; + return this; + } + + public AnalysisReport addTtpsItem(Ttp ttpsItem) { + if (this.ttps == null) { + this.ttps = new ArrayList<>(); + } + this.ttps.add(ttpsItem); + return this; + } + + /** + * Get ttps + * @return ttps + */ + @javax.annotation.Nullable + public List getTtps() { + return ttps; + } + + public void setTtps(@javax.annotation.Nullable List ttps) { + this.ttps = ttps; + } + + /** + * 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 AnalysisReport instance itself + */ + public AnalysisReport 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; + } + AnalysisReport analysisReport = (AnalysisReport) o; + return Objects.equals(this.fileActivity, analysisReport.fileActivity) && + Objects.equals(this.info, analysisReport.info) && + Objects.equals(this.memdumps, analysisReport.memdumps) && + Objects.equals(this.moduleLoadAddresses, analysisReport.moduleLoadAddresses) && + Objects.equals(this.mutexes, analysisReport.mutexes) && + Objects.equals(this.networkActivity, analysisReport.networkActivity) && + Objects.equals(this.processActivity, analysisReport.processActivity) && + Objects.equals(this.processTree, analysisReport.processTree) && + Objects.equals(this.registryOperations, analysisReport.registryOperations) && + Objects.equals(this.scheduledTasks, analysisReport.scheduledTasks) && + Objects.equals(this.services, analysisReport.services) && + Objects.equals(this.startup, analysisReport.startup) && + Objects.equals(this.threatScore, analysisReport.threatScore) && + Objects.equals(this.ttps, analysisReport.ttps)&& + Objects.equals(this.additionalProperties, analysisReport.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(fileActivity, info, memdumps, moduleLoadAddresses, mutexes, networkActivity, processActivity, processTree, registryOperations, scheduledTasks, services, startup, threatScore, ttps, 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 AnalysisReport {\n"); + sb.append(" fileActivity: ").append(toIndentedString(fileActivity)).append("\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" memdumps: ").append(toIndentedString(memdumps)).append("\n"); + sb.append(" moduleLoadAddresses: ").append(toIndentedString(moduleLoadAddresses)).append("\n"); + sb.append(" mutexes: ").append(toIndentedString(mutexes)).append("\n"); + sb.append(" networkActivity: ").append(toIndentedString(networkActivity)).append("\n"); + sb.append(" processActivity: ").append(toIndentedString(processActivity)).append("\n"); + sb.append(" processTree: ").append(toIndentedString(processTree)).append("\n"); + sb.append(" registryOperations: ").append(toIndentedString(registryOperations)).append("\n"); + sb.append(" scheduledTasks: ").append(toIndentedString(scheduledTasks)).append("\n"); + sb.append(" services: ").append(toIndentedString(services)).append("\n"); + sb.append(" startup: ").append(toIndentedString(startup)).append("\n"); + sb.append(" threatScore: ").append(toIndentedString(threatScore)).append("\n"); + sb.append(" ttps: ").append(toIndentedString(ttps)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file_activity", "info", "memdumps", "module_load_addresses", "mutexes", "network_activity", "process_activity", "process_tree", "registry_operations", "scheduled_tasks", "services", "startup", "threat_score", "ttps")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("info", "threat_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 AnalysisReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AnalysisReport is not found in the empty JSON string", AnalysisReport.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisReport.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("file_activity") != null && !jsonObj.get("file_activity").isJsonNull() && !jsonObj.get("file_activity").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `file_activity` to be an array in the JSON string but got `%s`", jsonObj.get("file_activity").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("memdumps") != null && !jsonObj.get("memdumps").isJsonNull() && !jsonObj.get("memdumps").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `memdumps` to be an array in the JSON string but got `%s`", jsonObj.get("memdumps").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("module_load_addresses") != null && !jsonObj.get("module_load_addresses").isJsonNull() && !jsonObj.get("module_load_addresses").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `module_load_addresses` to be an array in the JSON string but got `%s`", jsonObj.get("module_load_addresses").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("mutexes") != null && !jsonObj.get("mutexes").isJsonNull() && !jsonObj.get("mutexes").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mutexes` to be an array in the JSON string but got `%s`", jsonObj.get("mutexes").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("process_activity") != null && !jsonObj.get("process_activity").isJsonNull() && !jsonObj.get("process_activity").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `process_activity` to be an array in the JSON string but got `%s`", jsonObj.get("process_activity").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("registry_operations") != null && !jsonObj.get("registry_operations").isJsonNull() && !jsonObj.get("registry_operations").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `registry_operations` to be an array in the JSON string but got `%s`", jsonObj.get("registry_operations").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("scheduled_tasks") != null && !jsonObj.get("scheduled_tasks").isJsonNull() && !jsonObj.get("scheduled_tasks").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `scheduled_tasks` to be an array in the JSON string but got `%s`", jsonObj.get("scheduled_tasks").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("services") != null && !jsonObj.get("services").isJsonNull() && !jsonObj.get("services").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `services` to be an array in the JSON string but got `%s`", jsonObj.get("services").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("ttps") != null && !jsonObj.get("ttps").isJsonNull() && !jsonObj.get("ttps").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `ttps` to be an array in the JSON string but got `%s`", jsonObj.get("ttps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisReport 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 AnalysisReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisReport instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisReport + * @throws IOException if the JSON string is invalid with respect to AnalysisReport + */ + public static AnalysisReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisReport.class); + } + + /** + * Convert an instance of AnalysisReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ApiCall.java b/src/main/java/ai/reveng/model/ApiCall.java new file mode 100644 index 0000000..8d7774d --- /dev/null +++ b/src/main/java/ai/reveng/model/ApiCall.java @@ -0,0 +1,393 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ApiCall + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiCall { + public static final String SERIALIZED_NAME_CALLED_FROM = "called_from"; + @SerializedName(SERIALIZED_NAME_CALLED_FROM) + @javax.annotation.Nullable + private String calledFrom; + + public static final String SERIALIZED_NAME_CALLED_FROM_RVA = "called_from_rva"; + @SerializedName(SERIALIZED_NAME_CALLED_FROM_RVA) + @javax.annotation.Nullable + private String calledFromRva; + + public static final String SERIALIZED_NAME_FROM_MODULE = "from_module"; + @SerializedName(SERIALIZED_NAME_FROM_MODULE) + @javax.annotation.Nullable + private String fromModule; + + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + private String method; + + public ApiCall() { + } + + public ApiCall calledFrom(@javax.annotation.Nullable String calledFrom) { + this.calledFrom = calledFrom; + return this; + } + + /** + * Get calledFrom + * @return calledFrom + */ + @javax.annotation.Nullable + public String getCalledFrom() { + return calledFrom; + } + + public void setCalledFrom(@javax.annotation.Nullable String calledFrom) { + this.calledFrom = calledFrom; + } + + + public ApiCall calledFromRva(@javax.annotation.Nullable String calledFromRva) { + this.calledFromRva = calledFromRva; + return this; + } + + /** + * Get calledFromRva + * @return calledFromRva + */ + @javax.annotation.Nullable + public String getCalledFromRva() { + return calledFromRva; + } + + public void setCalledFromRva(@javax.annotation.Nullable String calledFromRva) { + this.calledFromRva = calledFromRva; + } + + + public ApiCall fromModule(@javax.annotation.Nullable String fromModule) { + this.fromModule = fromModule; + return this; + } + + /** + * Get fromModule + * @return fromModule + */ + @javax.annotation.Nullable + public String getFromModule() { + return fromModule; + } + + public void setFromModule(@javax.annotation.Nullable String fromModule) { + this.fromModule = fromModule; + } + + + public ApiCall method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + /** + * 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 ApiCall instance itself + */ + public ApiCall 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; + } + ApiCall apiCall = (ApiCall) o; + return Objects.equals(this.calledFrom, apiCall.calledFrom) && + Objects.equals(this.calledFromRva, apiCall.calledFromRva) && + Objects.equals(this.fromModule, apiCall.fromModule) && + Objects.equals(this.method, apiCall.method)&& + Objects.equals(this.additionalProperties, apiCall.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(calledFrom, calledFromRva, fromModule, method, 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 ApiCall {\n"); + sb.append(" calledFrom: ").append(toIndentedString(calledFrom)).append("\n"); + sb.append(" calledFromRva: ").append(toIndentedString(calledFromRva)).append("\n"); + sb.append(" fromModule: ").append(toIndentedString(fromModule)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("called_from", "called_from_rva", "from_module", "method")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("method")); + } + + /** + * 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 ApiCall + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ApiCall is not found in the empty JSON string", ApiCall.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApiCall.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("called_from") != null && !jsonObj.get("called_from").isJsonNull()) && !jsonObj.get("called_from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `called_from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("called_from").toString())); + } + if ((jsonObj.get("called_from_rva") != null && !jsonObj.get("called_from_rva").isJsonNull()) && !jsonObj.get("called_from_rva").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `called_from_rva` to be a primitive type in the JSON string but got `%s`", jsonObj.get("called_from_rva").toString())); + } + if ((jsonObj.get("from_module") != null && !jsonObj.get("from_module").isJsonNull()) && !jsonObj.get("from_module").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `from_module` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from_module").toString())); + } + if ((jsonObj.get("method") != null && !jsonObj.get("method").isJsonNull()) && !jsonObj.get("method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiCall.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiCall' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiCall.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiCall 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 ApiCall read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiCall instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApiCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiCall + * @throws IOException if the JSON string is invalid with respect to ApiCall + */ + public static ApiCall fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiCall.class); + } + + /** + * Convert an instance of ApiCall to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Connection.java b/src/main/java/ai/reveng/model/Connection.java new file mode 100644 index 0000000..7e78466 --- /dev/null +++ b/src/main/java/ai/reveng/model/Connection.java @@ -0,0 +1,457 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * Connection + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Connection { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_LOCAL_IP = "local_ip"; + @SerializedName(SERIALIZED_NAME_LOCAL_IP) + @javax.annotation.Nullable + private String localIp; + + public static final String SERIALIZED_NAME_LOCAL_PORT = "local_port"; + @SerializedName(SERIALIZED_NAME_LOCAL_PORT) + @javax.annotation.Nullable + private Object localPort = null; + + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable + private String protocol; + + public static final String SERIALIZED_NAME_REMOTE_IP = "remote_ip"; + @SerializedName(SERIALIZED_NAME_REMOTE_IP) + @javax.annotation.Nullable + private String remoteIp; + + public static final String SERIALIZED_NAME_REMOTE_PORT = "remote_port"; + @SerializedName(SERIALIZED_NAME_REMOTE_PORT) + @javax.annotation.Nullable + private Object remotePort = null; + + public Connection() { + } + + public Connection events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public Connection addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public Connection localIp(@javax.annotation.Nullable String localIp) { + this.localIp = localIp; + return this; + } + + /** + * Get localIp + * @return localIp + */ + @javax.annotation.Nullable + public String getLocalIp() { + return localIp; + } + + public void setLocalIp(@javax.annotation.Nullable String localIp) { + this.localIp = localIp; + } + + + public Connection localPort(@javax.annotation.Nullable Object localPort) { + this.localPort = localPort; + return this; + } + + /** + * Get localPort + * @return localPort + */ + @javax.annotation.Nullable + public Object getLocalPort() { + return localPort; + } + + public void setLocalPort(@javax.annotation.Nullable Object localPort) { + this.localPort = localPort; + } + + + public Connection protocol(@javax.annotation.Nullable String protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * @return protocol + */ + @javax.annotation.Nullable + public String getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable String protocol) { + this.protocol = protocol; + } + + + public Connection remoteIp(@javax.annotation.Nullable String remoteIp) { + this.remoteIp = remoteIp; + return this; + } + + /** + * Get remoteIp + * @return remoteIp + */ + @javax.annotation.Nullable + public String getRemoteIp() { + return remoteIp; + } + + public void setRemoteIp(@javax.annotation.Nullable String remoteIp) { + this.remoteIp = remoteIp; + } + + + public Connection remotePort(@javax.annotation.Nullable Object remotePort) { + this.remotePort = remotePort; + return this; + } + + /** + * Get remotePort + * @return remotePort + */ + @javax.annotation.Nullable + public Object getRemotePort() { + return remotePort; + } + + public void setRemotePort(@javax.annotation.Nullable Object remotePort) { + this.remotePort = remotePort; + } + + /** + * 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 Connection instance itself + */ + public Connection 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; + } + Connection connection = (Connection) o; + return Objects.equals(this.events, connection.events) && + Objects.equals(this.localIp, connection.localIp) && + Objects.equals(this.localPort, connection.localPort) && + Objects.equals(this.protocol, connection.protocol) && + Objects.equals(this.remoteIp, connection.remoteIp) && + Objects.equals(this.remotePort, connection.remotePort)&& + Objects.equals(this.additionalProperties, connection.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(events, localIp, localPort, protocol, remoteIp, remotePort, 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 Connection {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" localIp: ").append(toIndentedString(localIp)).append("\n"); + sb.append(" localPort: ").append(toIndentedString(localPort)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).append("\n"); + sb.append(" remoteIp: ").append(toIndentedString(remoteIp)).append("\n"); + sb.append(" remotePort: ").append(toIndentedString(remotePort)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "local_ip", "local_port", "protocol", "remote_ip", "remote_port")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("local_ip", "local_port", "protocol", "remote_ip", "remote_port")); + } + + /** + * 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 Connection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Connection.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Connection is not found in the empty JSON string", Connection.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Connection.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("local_ip") != null && !jsonObj.get("local_ip").isJsonNull()) && !jsonObj.get("local_ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `local_ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("local_ip").toString())); + } + if ((jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) && !jsonObj.get("protocol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `protocol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("protocol").toString())); + } + if ((jsonObj.get("remote_ip") != null && !jsonObj.get("remote_ip").isJsonNull()) && !jsonObj.get("remote_ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `remote_ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("remote_ip").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Connection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Connection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Connection.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Connection 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 Connection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Connection instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Connection given an JSON string + * + * @param jsonString JSON string + * @return An instance of Connection + * @throws IOException if the JSON string is invalid with respect to Connection + */ + public static Connection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Connection.class); + } + + /** + * Convert an instance of Connection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DnsQuery.java b/src/main/java/ai/reveng/model/DnsQuery.java new file mode 100644 index 0000000..06646fc --- /dev/null +++ b/src/main/java/ai/reveng/model/DnsQuery.java @@ -0,0 +1,347 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DnsQuery + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DnsQuery { + public static final String SERIALIZED_NAME_DOMAIN = "domain"; + @SerializedName(SERIALIZED_NAME_DOMAIN) + @javax.annotation.Nullable + private String domain; + + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public DnsQuery() { + } + + public DnsQuery domain(@javax.annotation.Nullable String domain) { + this.domain = domain; + return this; + } + + /** + * Get domain + * @return domain + */ + @javax.annotation.Nullable + public String getDomain() { + return domain; + } + + public void setDomain(@javax.annotation.Nullable String domain) { + this.domain = domain; + } + + + public DnsQuery events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public DnsQuery addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + /** + * 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 DnsQuery instance itself + */ + public DnsQuery 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; + } + DnsQuery dnsQuery = (DnsQuery) o; + return Objects.equals(this.domain, dnsQuery.domain) && + Objects.equals(this.events, dnsQuery.events)&& + Objects.equals(this.additionalProperties, dnsQuery.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(domain, events, 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 DnsQuery {\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("domain", "events")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("domain")); + } + + /** + * 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 DnsQuery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DnsQuery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DnsQuery is not found in the empty JSON string", DnsQuery.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DnsQuery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("domain") != null && !jsonObj.get("domain").isJsonNull()) && !jsonObj.get("domain").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `domain` to be a primitive type in the JSON string but got `%s`", jsonObj.get("domain").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DnsQuery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DnsQuery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DnsQuery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DnsQuery 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 DnsQuery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DnsQuery instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DnsQuery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DnsQuery + * @throws IOException if the JSON string is invalid with respect to DnsQuery + */ + public static DnsQuery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DnsQuery.class); + } + + /** + * Convert an instance of DnsQuery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DrakvufFileMetadata.java b/src/main/java/ai/reveng/model/DrakvufFileMetadata.java new file mode 100644 index 0000000..69f9ec9 --- /dev/null +++ b/src/main/java/ai/reveng/model/DrakvufFileMetadata.java @@ -0,0 +1,422 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DrakvufFileMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DrakvufFileMetadata { + public static final String SERIALIZED_NAME_MIME_TYPE = "mime_type"; + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @javax.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SHA256 = "sha256"; + @SerializedName(SERIALIZED_NAME_SHA256) + @javax.annotation.Nullable + private String sha256; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_TYPE_ID = "type_id"; + @SerializedName(SERIALIZED_NAME_TYPE_ID) + @javax.annotation.Nullable + private String typeId; + + public DrakvufFileMetadata() { + } + + public DrakvufFileMetadata mimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * @return mimeType + */ + @javax.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + + public DrakvufFileMetadata name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public DrakvufFileMetadata sha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + return this; + } + + /** + * Get sha256 + * @return sha256 + */ + @javax.annotation.Nullable + public String getSha256() { + return sha256; + } + + public void setSha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + } + + + public DrakvufFileMetadata type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DrakvufFileMetadata typeId(@javax.annotation.Nullable String typeId) { + this.typeId = typeId; + return this; + } + + /** + * Get typeId + * @return typeId + */ + @javax.annotation.Nullable + public String getTypeId() { + return typeId; + } + + public void setTypeId(@javax.annotation.Nullable String typeId) { + this.typeId = typeId; + } + + /** + * 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 DrakvufFileMetadata instance itself + */ + public DrakvufFileMetadata 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; + } + DrakvufFileMetadata drakvufFileMetadata = (DrakvufFileMetadata) o; + return Objects.equals(this.mimeType, drakvufFileMetadata.mimeType) && + Objects.equals(this.name, drakvufFileMetadata.name) && + Objects.equals(this.sha256, drakvufFileMetadata.sha256) && + Objects.equals(this.type, drakvufFileMetadata.type) && + Objects.equals(this.typeId, drakvufFileMetadata.typeId)&& + Objects.equals(this.additionalProperties, drakvufFileMetadata.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(mimeType, name, sha256, type, typeId, 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 DrakvufFileMetadata {\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sha256: ").append(toIndentedString(sha256)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" typeId: ").append(toIndentedString(typeId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mime_type", "name", "sha256", "type", "type_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "sha256")); + } + + /** + * 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 DrakvufFileMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DrakvufFileMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DrakvufFileMetadata is not found in the empty JSON string", DrakvufFileMetadata.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DrakvufFileMetadata.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("mime_type") != null && !jsonObj.get("mime_type").isJsonNull()) && !jsonObj.get("mime_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mime_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mime_type").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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("sha256") != null && !jsonObj.get("sha256").isJsonNull()) && !jsonObj.get("sha256").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `sha256` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha256").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("type_id") != null && !jsonObj.get("type_id").isJsonNull()) && !jsonObj.get("type_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DrakvufFileMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DrakvufFileMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DrakvufFileMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DrakvufFileMetadata 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 DrakvufFileMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DrakvufFileMetadata instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DrakvufFileMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of DrakvufFileMetadata + * @throws IOException if the JSON string is invalid with respect to DrakvufFileMetadata + */ + public static DrakvufFileMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DrakvufFileMetadata.class); + } + + /** + * Convert an instance of DrakvufFileMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java b/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java new file mode 100644 index 0000000..9f16c27 --- /dev/null +++ b/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java @@ -0,0 +1,323 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DynamicExecutionStatusResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DynamicExecutionStatusResponse { + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "error_message"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @javax.annotation.Nullable + private String errorMessage; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public DynamicExecutionStatusResponse() { + } + + public DynamicExecutionStatusResponse errorMessage(@javax.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Error detail, set when status is ERROR + * @return errorMessage + */ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(@javax.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; + } + + + public DynamicExecutionStatusResponse status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Task status: UNINITIALISED, PENDING, RUNNING, COMPLETED, or ERROR + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * 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 DynamicExecutionStatusResponse instance itself + */ + public DynamicExecutionStatusResponse 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; + } + DynamicExecutionStatusResponse dynamicExecutionStatusResponse = (DynamicExecutionStatusResponse) o; + return Objects.equals(this.errorMessage, dynamicExecutionStatusResponse.errorMessage) && + Objects.equals(this.status, dynamicExecutionStatusResponse.status)&& + Objects.equals(this.additionalProperties, dynamicExecutionStatusResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(errorMessage, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DynamicExecutionStatusResponse {\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("error_message", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DynamicExecutionStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DynamicExecutionStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DynamicExecutionStatusResponse is not found in the empty JSON string", DynamicExecutionStatusResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DynamicExecutionStatusResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("error_message") != null && !jsonObj.get("error_message").isJsonNull()) && !jsonObj.get("error_message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error_message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_message").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DynamicExecutionStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DynamicExecutionStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DynamicExecutionStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DynamicExecutionStatusResponse 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 DynamicExecutionStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DynamicExecutionStatusResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DynamicExecutionStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DynamicExecutionStatusResponse + * @throws IOException if the JSON string is invalid with respect to DynamicExecutionStatusResponse + */ + public static DynamicExecutionStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DynamicExecutionStatusResponse.class); + } + + /** + * Convert an instance of DynamicExecutionStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ErrorBody.java b/src/main/java/ai/reveng/model/ErrorBody.java index 9898097..5837e64 100644 --- a/src/main/java/ai/reveng/model/ErrorBody.java +++ b/src/main/java/ai/reveng/model/ErrorBody.java @@ -72,6 +72,8 @@ public enum CodeEnum { DOMAIN_VERIFICATION_PENDING("DOMAIN_VERIFICATION_PENDING"), + DYNAMIC_EXECUTION_INCOMPLETE("DYNAMIC_EXECUTION_INCOMPLETE"), + EMAIL_NOT_VERIFIED("EMAIL_NOT_VERIFIED"), EXTERNAL_USER("EXTERNAL_USER"), diff --git a/src/main/java/ai/reveng/model/ExtractedURL.java b/src/main/java/ai/reveng/model/ExtractedURL.java new file mode 100644 index 0000000..d9b5fe6 --- /dev/null +++ b/src/main/java/ai/reveng/model/ExtractedURL.java @@ -0,0 +1,347 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ExtractedURL + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExtractedURL { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public ExtractedURL() { + } + + public ExtractedURL events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public ExtractedURL addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public ExtractedURL url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 ExtractedURL instance itself + */ + public ExtractedURL 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; + } + ExtractedURL extractedURL = (ExtractedURL) o; + return Objects.equals(this.events, extractedURL.events) && + Objects.equals(this.url, extractedURL.url)&& + Objects.equals(this.additionalProperties, extractedURL.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(events, url, 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 ExtractedURL {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("url")); + } + + /** + * 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 ExtractedURL + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExtractedURL.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ExtractedURL is not found in the empty JSON string", ExtractedURL.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExtractedURL.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExtractedURL.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExtractedURL' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExtractedURL.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExtractedURL 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 ExtractedURL read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ExtractedURL instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExtractedURL given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExtractedURL + * @throws IOException if the JSON string is invalid with respect to ExtractedURL + */ + public static ExtractedURL fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExtractedURL.class); + } + + /** + * Convert an instance of ExtractedURL to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FileActivityEntry.java b/src/main/java/ai/reveng/model/FileActivityEntry.java new file mode 100644 index 0000000..d3d4702 --- /dev/null +++ b/src/main/java/ai/reveng/model/FileActivityEntry.java @@ -0,0 +1,347 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * FileActivityEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FileActivityEntry { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public FileActivityEntry() { + } + + public FileActivityEntry events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public FileActivityEntry addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public FileActivityEntry path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + /** + * 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 FileActivityEntry instance itself + */ + public FileActivityEntry 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; + } + FileActivityEntry fileActivityEntry = (FileActivityEntry) o; + return Objects.equals(this.events, fileActivityEntry.events) && + Objects.equals(this.path, fileActivityEntry.path)&& + Objects.equals(this.additionalProperties, fileActivityEntry.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(events, path, 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 FileActivityEntry {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "path")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("path")); + } + + /** + * 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 FileActivityEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileActivityEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in FileActivityEntry is not found in the empty JSON string", FileActivityEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileActivityEntry.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileActivityEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileActivityEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileActivityEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileActivityEntry 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 FileActivityEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileActivityEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileActivityEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileActivityEntry + * @throws IOException if the JSON string is invalid with respect to FileActivityEntry + */ + public static FileActivityEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileActivityEntry.class); + } + + /** + * Convert an instance of FileActivityEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/HttpRequest.java b/src/main/java/ai/reveng/model/HttpRequest.java new file mode 100644 index 0000000..0318b6b --- /dev/null +++ b/src/main/java/ai/reveng/model/HttpRequest.java @@ -0,0 +1,746 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * HttpRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HttpRequest { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_EXTRA_HEADERS = "extra_headers"; + @SerializedName(SERIALIZED_NAME_EXTRA_HEADERS) + @javax.annotation.Nullable + private List extraHeaders; + + public static final String SERIALIZED_NAME_FLAGS = "flags"; + @SerializedName(SERIALIZED_NAME_FLAGS) + @javax.annotation.Nullable + private Long flags; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_POST_DATA = "post_data"; + @SerializedName(SERIALIZED_NAME_POST_DATA) + @javax.annotation.Nullable + private String postData; + + public static final String SERIALIZED_NAME_PROXY = "proxy"; + @SerializedName(SERIALIZED_NAME_PROXY) + @javax.annotation.Nullable + private String proxy; + + public static final String SERIALIZED_NAME_PROXY_BYPASS = "proxy_bypass"; + @SerializedName(SERIALIZED_NAME_PROXY_BYPASS) + @javax.annotation.Nullable + private String proxyBypass; + + public static final String SERIALIZED_NAME_REFERER = "referer"; + @SerializedName(SERIALIZED_NAME_REFERER) + @javax.annotation.Nullable + private String referer; + + public static final String SERIALIZED_NAME_SERVER_NAME = "server_name"; + @SerializedName(SERIALIZED_NAME_SERVER_NAME) + @javax.annotation.Nullable + private String serverName; + + public static final String SERIALIZED_NAME_SERVER_PORT = "server_port"; + @SerializedName(SERIALIZED_NAME_SERVER_PORT) + @javax.annotation.Nullable + private Long serverPort; + + public static final String SERIALIZED_NAME_SERVICE = "service"; + @SerializedName(SERIALIZED_NAME_SERVICE) + @javax.annotation.Nullable + private Long service; + + public static final String SERIALIZED_NAME_USER_AGENT = "user_agent"; + @SerializedName(SERIALIZED_NAME_USER_AGENT) + @javax.annotation.Nullable + private String userAgent; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_VERB = "verb"; + @SerializedName(SERIALIZED_NAME_VERB) + @javax.annotation.Nullable + private String verb; + + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + @javax.annotation.Nullable + private String version; + + public HttpRequest() { + } + + public HttpRequest events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public HttpRequest addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public HttpRequest extraHeaders(@javax.annotation.Nullable List extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public HttpRequest addExtraHeadersItem(String extraHeadersItem) { + if (this.extraHeaders == null) { + this.extraHeaders = new ArrayList<>(); + } + this.extraHeaders.add(extraHeadersItem); + return this; + } + + /** + * Get extraHeaders + * @return extraHeaders + */ + @javax.annotation.Nullable + public List getExtraHeaders() { + return extraHeaders; + } + + public void setExtraHeaders(@javax.annotation.Nullable List extraHeaders) { + this.extraHeaders = extraHeaders; + } + + + public HttpRequest flags(@javax.annotation.Nullable Long flags) { + this.flags = flags; + return this; + } + + /** + * Get flags + * @return flags + */ + @javax.annotation.Nullable + public Long getFlags() { + return flags; + } + + public void setFlags(@javax.annotation.Nullable Long flags) { + this.flags = flags; + } + + + public HttpRequest password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public HttpRequest path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public HttpRequest postData(@javax.annotation.Nullable String postData) { + this.postData = postData; + return this; + } + + /** + * Get postData + * @return postData + */ + @javax.annotation.Nullable + public String getPostData() { + return postData; + } + + public void setPostData(@javax.annotation.Nullable String postData) { + this.postData = postData; + } + + + public HttpRequest proxy(@javax.annotation.Nullable String proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get proxy + * @return proxy + */ + @javax.annotation.Nullable + public String getProxy() { + return proxy; + } + + public void setProxy(@javax.annotation.Nullable String proxy) { + this.proxy = proxy; + } + + + public HttpRequest proxyBypass(@javax.annotation.Nullable String proxyBypass) { + this.proxyBypass = proxyBypass; + return this; + } + + /** + * Get proxyBypass + * @return proxyBypass + */ + @javax.annotation.Nullable + public String getProxyBypass() { + return proxyBypass; + } + + public void setProxyBypass(@javax.annotation.Nullable String proxyBypass) { + this.proxyBypass = proxyBypass; + } + + + public HttpRequest referer(@javax.annotation.Nullable String referer) { + this.referer = referer; + return this; + } + + /** + * Get referer + * @return referer + */ + @javax.annotation.Nullable + public String getReferer() { + return referer; + } + + public void setReferer(@javax.annotation.Nullable String referer) { + this.referer = referer; + } + + + public HttpRequest serverName(@javax.annotation.Nullable String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get serverName + * @return serverName + */ + @javax.annotation.Nullable + public String getServerName() { + return serverName; + } + + public void setServerName(@javax.annotation.Nullable String serverName) { + this.serverName = serverName; + } + + + public HttpRequest serverPort(@javax.annotation.Nullable Long serverPort) { + this.serverPort = serverPort; + return this; + } + + /** + * Get serverPort + * @return serverPort + */ + @javax.annotation.Nullable + public Long getServerPort() { + return serverPort; + } + + public void setServerPort(@javax.annotation.Nullable Long serverPort) { + this.serverPort = serverPort; + } + + + public HttpRequest service(@javax.annotation.Nullable Long service) { + this.service = service; + return this; + } + + /** + * Get service + * @return service + */ + @javax.annotation.Nullable + public Long getService() { + return service; + } + + public void setService(@javax.annotation.Nullable Long service) { + this.service = service; + } + + + public HttpRequest userAgent(@javax.annotation.Nullable String userAgent) { + this.userAgent = userAgent; + return this; + } + + /** + * Get userAgent + * @return userAgent + */ + @javax.annotation.Nullable + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(@javax.annotation.Nullable String userAgent) { + this.userAgent = userAgent; + } + + + public HttpRequest username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public HttpRequest verb(@javax.annotation.Nullable String verb) { + this.verb = verb; + return this; + } + + /** + * Get verb + * @return verb + */ + @javax.annotation.Nullable + public String getVerb() { + return verb; + } + + public void setVerb(@javax.annotation.Nullable String verb) { + this.verb = verb; + } + + + public HttpRequest version(@javax.annotation.Nullable String version) { + this.version = version; + return this; + } + + /** + * Get version + * @return version + */ + @javax.annotation.Nullable + public String getVersion() { + return version; + } + + public void setVersion(@javax.annotation.Nullable 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 HttpRequest instance itself + */ + public HttpRequest 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; + } + HttpRequest httpRequest = (HttpRequest) o; + return Objects.equals(this.events, httpRequest.events) && + Objects.equals(this.extraHeaders, httpRequest.extraHeaders) && + Objects.equals(this.flags, httpRequest.flags) && + Objects.equals(this.password, httpRequest.password) && + Objects.equals(this.path, httpRequest.path) && + Objects.equals(this.postData, httpRequest.postData) && + Objects.equals(this.proxy, httpRequest.proxy) && + Objects.equals(this.proxyBypass, httpRequest.proxyBypass) && + Objects.equals(this.referer, httpRequest.referer) && + Objects.equals(this.serverName, httpRequest.serverName) && + Objects.equals(this.serverPort, httpRequest.serverPort) && + Objects.equals(this.service, httpRequest.service) && + Objects.equals(this.userAgent, httpRequest.userAgent) && + Objects.equals(this.username, httpRequest.username) && + Objects.equals(this.verb, httpRequest.verb) && + Objects.equals(this.version, httpRequest.version)&& + Objects.equals(this.additionalProperties, httpRequest.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(events, extraHeaders, flags, password, path, postData, proxy, proxyBypass, referer, serverName, serverPort, service, userAgent, username, verb, version, 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 HttpRequest {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" extraHeaders: ").append(toIndentedString(extraHeaders)).append("\n"); + sb.append(" flags: ").append(toIndentedString(flags)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" postData: ").append(toIndentedString(postData)).append("\n"); + sb.append(" proxy: ").append(toIndentedString(proxy)).append("\n"); + sb.append(" proxyBypass: ").append(toIndentedString(proxyBypass)).append("\n"); + sb.append(" referer: ").append(toIndentedString(referer)).append("\n"); + sb.append(" serverName: ").append(toIndentedString(serverName)).append("\n"); + sb.append(" serverPort: ").append(toIndentedString(serverPort)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" userAgent: ").append(toIndentedString(userAgent)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" verb: ").append(toIndentedString(verb)).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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "extra_headers", "flags", "password", "path", "post_data", "proxy", "proxy_bypass", "referer", "server_name", "server_port", "service", "user_agent", "username", "verb", "version")); + + // 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 HttpRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HttpRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in HttpRequest is not found in the empty JSON string", HttpRequest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("extra_headers") != null && !jsonObj.get("extra_headers").isJsonNull() && !jsonObj.get("extra_headers").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `extra_headers` to be an array in the JSON string but got `%s`", jsonObj.get("extra_headers").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("post_data") != null && !jsonObj.get("post_data").isJsonNull()) && !jsonObj.get("post_data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `post_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("post_data").toString())); + } + if ((jsonObj.get("proxy") != null && !jsonObj.get("proxy").isJsonNull()) && !jsonObj.get("proxy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `proxy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proxy").toString())); + } + if ((jsonObj.get("proxy_bypass") != null && !jsonObj.get("proxy_bypass").isJsonNull()) && !jsonObj.get("proxy_bypass").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `proxy_bypass` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proxy_bypass").toString())); + } + if ((jsonObj.get("referer") != null && !jsonObj.get("referer").isJsonNull()) && !jsonObj.get("referer").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `referer` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referer").toString())); + } + if ((jsonObj.get("server_name") != null && !jsonObj.get("server_name").isJsonNull()) && !jsonObj.get("server_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `server_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("server_name").toString())); + } + if ((jsonObj.get("user_agent") != null && !jsonObj.get("user_agent").isJsonNull()) && !jsonObj.get("user_agent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `user_agent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_agent").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("verb") != null && !jsonObj.get("verb").isJsonNull()) && !jsonObj.get("verb").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `verb` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verb").toString())); + } + if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) && !jsonObj.get("version").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!HttpRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HttpRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HttpRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HttpRequest 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 HttpRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HttpRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HttpRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of HttpRequest + * @throws IOException if the JSON string is invalid with respect to HttpRequest + */ + public static HttpRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HttpRequest.class); + } + + /** + * Convert an instance of HttpRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/MemdumpEntry.java b/src/main/java/ai/reveng/model/MemdumpEntry.java new file mode 100644 index 0000000..6db754d --- /dev/null +++ b/src/main/java/ai/reveng/model/MemdumpEntry.java @@ -0,0 +1,613 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * MemdumpEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MemdumpEntry { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private String address; + + public static final String SERIALIZED_NAME_DUMP_REASON = "dump_reason"; + @SerializedName(SERIALIZED_NAME_DUMP_REASON) + @javax.annotation.Nullable + private String dumpReason; + + public static final String SERIALIZED_NAME_FILE_TYPE = "file_type"; + @SerializedName(SERIALIZED_NAME_FILE_TYPE) + @javax.annotation.Nullable + private String fileType; + + public static final String SERIALIZED_NAME_FILENAME = "filename"; + @SerializedName(SERIALIZED_NAME_FILENAME) + @javax.annotation.Nullable + private String filename; + + public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) + @javax.annotation.Nonnull + private Long index; + + public static final String SERIALIZED_NAME_IS_PE = "is_pe"; + @SerializedName(SERIALIZED_NAME_IS_PE) + @javax.annotation.Nullable + private Boolean isPe; + + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + private String method; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mime_type"; + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @javax.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_SHA256 = "sha256"; + @SerializedName(SERIALIZED_NAME_SHA256) + @javax.annotation.Nullable + private String sha256; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public static final String SERIALIZED_NAME_TARGET_ADDR = "target_addr"; + @SerializedName(SERIALIZED_NAME_TARGET_ADDR) + @javax.annotation.Nullable + private String targetAddr; + + public static final String SERIALIZED_NAME_TARGET_PROCESS = "target_process"; + @SerializedName(SERIALIZED_NAME_TARGET_PROCESS) + @javax.annotation.Nullable + private Long targetProcess; + + public MemdumpEntry() { + } + + public MemdumpEntry address(@javax.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable String address) { + this.address = address; + } + + + public MemdumpEntry dumpReason(@javax.annotation.Nullable String dumpReason) { + this.dumpReason = dumpReason; + return this; + } + + /** + * Get dumpReason + * @return dumpReason + */ + @javax.annotation.Nullable + public String getDumpReason() { + return dumpReason; + } + + public void setDumpReason(@javax.annotation.Nullable String dumpReason) { + this.dumpReason = dumpReason; + } + + + public MemdumpEntry fileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + return this; + } + + /** + * Get fileType + * @return fileType + */ + @javax.annotation.Nullable + public String getFileType() { + return fileType; + } + + public void setFileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + } + + + public MemdumpEntry filename(@javax.annotation.Nullable String filename) { + this.filename = filename; + return this; + } + + /** + * Get filename + * @return filename + */ + @javax.annotation.Nullable + public String getFilename() { + return filename; + } + + public void setFilename(@javax.annotation.Nullable String filename) { + this.filename = filename; + } + + + public MemdumpEntry index(@javax.annotation.Nonnull Long index) { + this.index = index; + return this; + } + + /** + * Get index + * @return index + */ + @javax.annotation.Nonnull + public Long getIndex() { + return index; + } + + public void setIndex(@javax.annotation.Nonnull Long index) { + this.index = index; + } + + + public MemdumpEntry isPe(@javax.annotation.Nullable Boolean isPe) { + this.isPe = isPe; + return this; + } + + /** + * Get isPe + * @return isPe + */ + @javax.annotation.Nullable + public Boolean getIsPe() { + return isPe; + } + + public void setIsPe(@javax.annotation.Nullable Boolean isPe) { + this.isPe = isPe; + } + + + public MemdumpEntry method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + + public MemdumpEntry mimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * @return mimeType + */ + @javax.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + + public MemdumpEntry sha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + return this; + } + + /** + * Get sha256 + * @return sha256 + */ + @javax.annotation.Nullable + public String getSha256() { + return sha256; + } + + public void setSha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + } + + + public MemdumpEntry size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Get size + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + + public MemdumpEntry targetAddr(@javax.annotation.Nullable String targetAddr) { + this.targetAddr = targetAddr; + return this; + } + + /** + * Get targetAddr + * @return targetAddr + */ + @javax.annotation.Nullable + public String getTargetAddr() { + return targetAddr; + } + + public void setTargetAddr(@javax.annotation.Nullable String targetAddr) { + this.targetAddr = targetAddr; + } + + + public MemdumpEntry targetProcess(@javax.annotation.Nullable Long targetProcess) { + this.targetProcess = targetProcess; + return this; + } + + /** + * Get targetProcess + * @return targetProcess + */ + @javax.annotation.Nullable + public Long getTargetProcess() { + return targetProcess; + } + + public void setTargetProcess(@javax.annotation.Nullable Long targetProcess) { + this.targetProcess = targetProcess; + } + + /** + * 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 MemdumpEntry instance itself + */ + public MemdumpEntry 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; + } + MemdumpEntry memdumpEntry = (MemdumpEntry) o; + return Objects.equals(this.address, memdumpEntry.address) && + Objects.equals(this.dumpReason, memdumpEntry.dumpReason) && + Objects.equals(this.fileType, memdumpEntry.fileType) && + Objects.equals(this.filename, memdumpEntry.filename) && + Objects.equals(this.index, memdumpEntry.index) && + Objects.equals(this.isPe, memdumpEntry.isPe) && + Objects.equals(this.method, memdumpEntry.method) && + Objects.equals(this.mimeType, memdumpEntry.mimeType) && + Objects.equals(this.sha256, memdumpEntry.sha256) && + Objects.equals(this.size, memdumpEntry.size) && + Objects.equals(this.targetAddr, memdumpEntry.targetAddr) && + Objects.equals(this.targetProcess, memdumpEntry.targetProcess)&& + Objects.equals(this.additionalProperties, memdumpEntry.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(address, dumpReason, fileType, filename, index, isPe, method, mimeType, sha256, size, targetAddr, targetProcess, 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 MemdumpEntry {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dumpReason: ").append(toIndentedString(dumpReason)).append("\n"); + sb.append(" fileType: ").append(toIndentedString(fileType)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" isPe: ").append(toIndentedString(isPe)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" sha256: ").append(toIndentedString(sha256)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" targetAddr: ").append(toIndentedString(targetAddr)).append("\n"); + sb.append(" targetProcess: ").append(toIndentedString(targetProcess)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("address", "dump_reason", "file_type", "filename", "index", "is_pe", "method", "mime_type", "sha256", "size", "target_addr", "target_process")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("address", "dump_reason", "filename", "index", "method", "size")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MemdumpEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MemdumpEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in MemdumpEntry is not found in the empty JSON string", MemdumpEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MemdumpEntry.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString())); + } + if ((jsonObj.get("dump_reason") != null && !jsonObj.get("dump_reason").isJsonNull()) && !jsonObj.get("dump_reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `dump_reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dump_reason").toString())); + } + if ((jsonObj.get("file_type") != null && !jsonObj.get("file_type").isJsonNull()) && !jsonObj.get("file_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `file_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_type").toString())); + } + if ((jsonObj.get("filename") != null && !jsonObj.get("filename").isJsonNull()) && !jsonObj.get("filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("filename").toString())); + } + if ((jsonObj.get("method") != null && !jsonObj.get("method").isJsonNull()) && !jsonObj.get("method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); + } + if ((jsonObj.get("mime_type") != null && !jsonObj.get("mime_type").isJsonNull()) && !jsonObj.get("mime_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mime_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mime_type").toString())); + } + if ((jsonObj.get("sha256") != null && !jsonObj.get("sha256").isJsonNull()) && !jsonObj.get("sha256").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `sha256` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha256").toString())); + } + if ((jsonObj.get("target_addr") != null && !jsonObj.get("target_addr").isJsonNull()) && !jsonObj.get("target_addr").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `target_addr` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_addr").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MemdumpEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MemdumpEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MemdumpEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MemdumpEntry 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 MemdumpEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MemdumpEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MemdumpEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of MemdumpEntry + * @throws IOException if the JSON string is invalid with respect to MemdumpEntry + */ + public static MemdumpEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MemdumpEntry.class); + } + + /** + * Convert an instance of MemdumpEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ModuleLoadEntry.java b/src/main/java/ai/reveng/model/ModuleLoadEntry.java new file mode 100644 index 0000000..91d7bc8 --- /dev/null +++ b/src/main/java/ai/reveng/model/ModuleLoadEntry.java @@ -0,0 +1,394 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ModuleLoadEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ModuleLoadEntry { + public static final String SERIALIZED_NAME_MODULES = "modules"; + @SerializedName(SERIALIZED_NAME_MODULES) + @javax.annotation.Nullable + private Map modules = new HashMap<>(); + + public static final String SERIALIZED_NAME_PID = "pid"; + @SerializedName(SERIALIZED_NAME_PID) + @javax.annotation.Nonnull + private Long pid; + + public static final String SERIALIZED_NAME_PROCESS_NAME = "process_name"; + @SerializedName(SERIALIZED_NAME_PROCESS_NAME) + @javax.annotation.Nullable + private String processName; + + public static final String SERIALIZED_NAME_PROCESS_SEQID = "process_seqid"; + @SerializedName(SERIALIZED_NAME_PROCESS_SEQID) + @javax.annotation.Nullable + private Long processSeqid; + + public ModuleLoadEntry() { + } + + public ModuleLoadEntry modules(@javax.annotation.Nullable Map modules) { + this.modules = modules; + return this; + } + + public ModuleLoadEntry putModulesItem(String key, String modulesItem) { + if (this.modules == null) { + this.modules = new HashMap<>(); + } + this.modules.put(key, modulesItem); + return this; + } + + /** + * Get modules + * @return modules + */ + @javax.annotation.Nullable + public Map getModules() { + return modules; + } + + public void setModules(@javax.annotation.Nullable Map modules) { + this.modules = modules; + } + + + public ModuleLoadEntry pid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + return this; + } + + /** + * Get pid + * @return pid + */ + @javax.annotation.Nonnull + public Long getPid() { + return pid; + } + + public void setPid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + } + + + public ModuleLoadEntry processName(@javax.annotation.Nullable String processName) { + this.processName = processName; + return this; + } + + /** + * Get processName + * @return processName + */ + @javax.annotation.Nullable + public String getProcessName() { + return processName; + } + + public void setProcessName(@javax.annotation.Nullable String processName) { + this.processName = processName; + } + + + public ModuleLoadEntry processSeqid(@javax.annotation.Nullable Long processSeqid) { + this.processSeqid = processSeqid; + return this; + } + + /** + * Get processSeqid + * @return processSeqid + */ + @javax.annotation.Nullable + public Long getProcessSeqid() { + return processSeqid; + } + + public void setProcessSeqid(@javax.annotation.Nullable Long processSeqid) { + this.processSeqid = processSeqid; + } + + /** + * 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 ModuleLoadEntry instance itself + */ + public ModuleLoadEntry 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; + } + ModuleLoadEntry moduleLoadEntry = (ModuleLoadEntry) o; + return Objects.equals(this.modules, moduleLoadEntry.modules) && + Objects.equals(this.pid, moduleLoadEntry.pid) && + Objects.equals(this.processName, moduleLoadEntry.processName) && + Objects.equals(this.processSeqid, moduleLoadEntry.processSeqid)&& + Objects.equals(this.additionalProperties, moduleLoadEntry.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(modules, pid, processName, processSeqid, 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 ModuleLoadEntry {\n"); + sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); + sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); + sb.append(" processName: ").append(toIndentedString(processName)).append("\n"); + sb.append(" processSeqid: ").append(toIndentedString(processSeqid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("modules", "pid", "process_name", "process_seqid")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pid")); + } + + /** + * 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 ModuleLoadEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModuleLoadEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ModuleLoadEntry is not found in the empty JSON string", ModuleLoadEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModuleLoadEntry.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("process_name") != null && !jsonObj.get("process_name").isJsonNull()) && !jsonObj.get("process_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `process_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("process_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModuleLoadEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModuleLoadEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModuleLoadEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModuleLoadEntry 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 ModuleLoadEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModuleLoadEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModuleLoadEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModuleLoadEntry + * @throws IOException if the JSON string is invalid with respect to ModuleLoadEntry + */ + public static ModuleLoadEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModuleLoadEntry.class); + } + + /** + * Convert an instance of ModuleLoadEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/MutexEntry.java b/src/main/java/ai/reveng/model/MutexEntry.java new file mode 100644 index 0000000..31b30c7 --- /dev/null +++ b/src/main/java/ai/reveng/model/MutexEntry.java @@ -0,0 +1,347 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * MutexEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MutexEntry { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public MutexEntry() { + } + + public MutexEntry events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public MutexEntry addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public MutexEntry name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 MutexEntry instance itself + */ + public MutexEntry 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; + } + MutexEntry mutexEntry = (MutexEntry) o; + return Objects.equals(this.events, mutexEntry.events) && + Objects.equals(this.name, mutexEntry.name)&& + Objects.equals(this.additionalProperties, mutexEntry.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(events, name, 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 MutexEntry {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MutexEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MutexEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in MutexEntry is not found in the empty JSON string", MutexEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MutexEntry.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MutexEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MutexEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MutexEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MutexEntry 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 MutexEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MutexEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MutexEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of MutexEntry + * @throws IOException if the JSON string is invalid with respect to MutexEntry + */ + public static MutexEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MutexEntry.class); + } + + /** + * Convert an instance of MutexEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/NetworkActivity.java b/src/main/java/ai/reveng/model/NetworkActivity.java new file mode 100644 index 0000000..332675b --- /dev/null +++ b/src/main/java/ai/reveng/model/NetworkActivity.java @@ -0,0 +1,428 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.Connection; +import ai.reveng.model.DnsQuery; +import ai.reveng.model.ExtractedURL; +import ai.reveng.model.HttpRequest; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * NetworkActivity + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NetworkActivity { + public static final String SERIALIZED_NAME_CONNECTIONS = "connections"; + @SerializedName(SERIALIZED_NAME_CONNECTIONS) + @javax.annotation.Nullable + private List connections; + + public static final String SERIALIZED_NAME_DNS_QUERIES = "dns_queries"; + @SerializedName(SERIALIZED_NAME_DNS_QUERIES) + @javax.annotation.Nullable + private List dnsQueries; + + public static final String SERIALIZED_NAME_EXTRACTED_URLS = "extracted_urls"; + @SerializedName(SERIALIZED_NAME_EXTRACTED_URLS) + @javax.annotation.Nullable + private List extractedUrls; + + public static final String SERIALIZED_NAME_HTTP_REQUESTS = "http_requests"; + @SerializedName(SERIALIZED_NAME_HTTP_REQUESTS) + @javax.annotation.Nullable + private List httpRequests; + + public NetworkActivity() { + } + + public NetworkActivity connections(@javax.annotation.Nullable List connections) { + this.connections = connections; + return this; + } + + public NetworkActivity addConnectionsItem(Connection connectionsItem) { + if (this.connections == null) { + this.connections = new ArrayList<>(); + } + this.connections.add(connectionsItem); + return this; + } + + /** + * Get connections + * @return connections + */ + @javax.annotation.Nullable + public List getConnections() { + return connections; + } + + public void setConnections(@javax.annotation.Nullable List connections) { + this.connections = connections; + } + + + public NetworkActivity dnsQueries(@javax.annotation.Nullable List dnsQueries) { + this.dnsQueries = dnsQueries; + return this; + } + + public NetworkActivity addDnsQueriesItem(DnsQuery dnsQueriesItem) { + if (this.dnsQueries == null) { + this.dnsQueries = new ArrayList<>(); + } + this.dnsQueries.add(dnsQueriesItem); + return this; + } + + /** + * Get dnsQueries + * @return dnsQueries + */ + @javax.annotation.Nullable + public List getDnsQueries() { + return dnsQueries; + } + + public void setDnsQueries(@javax.annotation.Nullable List dnsQueries) { + this.dnsQueries = dnsQueries; + } + + + public NetworkActivity extractedUrls(@javax.annotation.Nullable List extractedUrls) { + this.extractedUrls = extractedUrls; + return this; + } + + public NetworkActivity addExtractedUrlsItem(ExtractedURL extractedUrlsItem) { + if (this.extractedUrls == null) { + this.extractedUrls = new ArrayList<>(); + } + this.extractedUrls.add(extractedUrlsItem); + return this; + } + + /** + * Get extractedUrls + * @return extractedUrls + */ + @javax.annotation.Nullable + public List getExtractedUrls() { + return extractedUrls; + } + + public void setExtractedUrls(@javax.annotation.Nullable List extractedUrls) { + this.extractedUrls = extractedUrls; + } + + + public NetworkActivity httpRequests(@javax.annotation.Nullable List httpRequests) { + this.httpRequests = httpRequests; + return this; + } + + public NetworkActivity addHttpRequestsItem(HttpRequest httpRequestsItem) { + if (this.httpRequests == null) { + this.httpRequests = new ArrayList<>(); + } + this.httpRequests.add(httpRequestsItem); + return this; + } + + /** + * Get httpRequests + * @return httpRequests + */ + @javax.annotation.Nullable + public List getHttpRequests() { + return httpRequests; + } + + public void setHttpRequests(@javax.annotation.Nullable List httpRequests) { + this.httpRequests = httpRequests; + } + + /** + * 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 NetworkActivity instance itself + */ + public NetworkActivity 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; + } + NetworkActivity networkActivity = (NetworkActivity) o; + return Objects.equals(this.connections, networkActivity.connections) && + Objects.equals(this.dnsQueries, networkActivity.dnsQueries) && + Objects.equals(this.extractedUrls, networkActivity.extractedUrls) && + Objects.equals(this.httpRequests, networkActivity.httpRequests)&& + Objects.equals(this.additionalProperties, networkActivity.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(connections, dnsQueries, extractedUrls, httpRequests, 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 NetworkActivity {\n"); + sb.append(" connections: ").append(toIndentedString(connections)).append("\n"); + sb.append(" dnsQueries: ").append(toIndentedString(dnsQueries)).append("\n"); + sb.append(" extractedUrls: ").append(toIndentedString(extractedUrls)).append("\n"); + sb.append(" httpRequests: ").append(toIndentedString(httpRequests)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("connections", "dns_queries", "extracted_urls", "http_requests")); + + // 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 NetworkActivity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkActivity.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in NetworkActivity is not found in the empty JSON string", NetworkActivity.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("connections") != null && !jsonObj.get("connections").isJsonNull() && !jsonObj.get("connections").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `connections` to be an array in the JSON string but got `%s`", jsonObj.get("connections").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("dns_queries") != null && !jsonObj.get("dns_queries").isJsonNull() && !jsonObj.get("dns_queries").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `dns_queries` to be an array in the JSON string but got `%s`", jsonObj.get("dns_queries").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("extracted_urls") != null && !jsonObj.get("extracted_urls").isJsonNull() && !jsonObj.get("extracted_urls").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `extracted_urls` to be an array in the JSON string but got `%s`", jsonObj.get("extracted_urls").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("http_requests") != null && !jsonObj.get("http_requests").isJsonNull() && !jsonObj.get("http_requests").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `http_requests` to be an array in the JSON string but got `%s`", jsonObj.get("http_requests").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkActivity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkActivity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NetworkActivity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkActivity 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 NetworkActivity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkActivity instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NetworkActivity given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkActivity + * @throws IOException if the JSON string is invalid with respect to NetworkActivity + */ + public static NetworkActivity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkActivity.class); + } + + /** + * Convert an instance of NetworkActivity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProcessActivityEntry.java b/src/main/java/ai/reveng/model/ProcessActivityEntry.java new file mode 100644 index 0000000..3253fad --- /dev/null +++ b/src/main/java/ai/reveng/model/ProcessActivityEntry.java @@ -0,0 +1,492 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ProcessActivityEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProcessActivityEntry { + public static final String SERIALIZED_NAME_ARGS = "args"; + @SerializedName(SERIALIZED_NAME_ARGS) + @javax.annotation.Nullable + private List args; + + public static final String SERIALIZED_NAME_CHILD_SEQID = "child_seqid"; + @SerializedName(SERIALIZED_NAME_CHILD_SEQID) + @javax.annotation.Nonnull + private Long childSeqid; + + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_EXIT_CODE = "exit_code"; + @SerializedName(SERIALIZED_NAME_EXIT_CODE) + @javax.annotation.Nullable + private Long exitCode; + + public static final String SERIALIZED_NAME_EXIT_CODE_STR = "exit_code_str"; + @SerializedName(SERIALIZED_NAME_EXIT_CODE_STR) + @javax.annotation.Nullable + private String exitCodeStr; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PID = "pid"; + @SerializedName(SERIALIZED_NAME_PID) + @javax.annotation.Nonnull + private Long pid; + + public ProcessActivityEntry() { + } + + public ProcessActivityEntry args(@javax.annotation.Nullable List args) { + this.args = args; + return this; + } + + public ProcessActivityEntry addArgsItem(String argsItem) { + if (this.args == null) { + this.args = new ArrayList<>(); + } + this.args.add(argsItem); + return this; + } + + /** + * Get args + * @return args + */ + @javax.annotation.Nullable + public List getArgs() { + return args; + } + + public void setArgs(@javax.annotation.Nullable List args) { + this.args = args; + } + + + public ProcessActivityEntry childSeqid(@javax.annotation.Nonnull Long childSeqid) { + this.childSeqid = childSeqid; + return this; + } + + /** + * Get childSeqid + * @return childSeqid + */ + @javax.annotation.Nonnull + public Long getChildSeqid() { + return childSeqid; + } + + public void setChildSeqid(@javax.annotation.Nonnull Long childSeqid) { + this.childSeqid = childSeqid; + } + + + public ProcessActivityEntry events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public ProcessActivityEntry addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public ProcessActivityEntry exitCode(@javax.annotation.Nullable Long exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get exitCode + * @return exitCode + */ + @javax.annotation.Nullable + public Long getExitCode() { + return exitCode; + } + + public void setExitCode(@javax.annotation.Nullable Long exitCode) { + this.exitCode = exitCode; + } + + + public ProcessActivityEntry exitCodeStr(@javax.annotation.Nullable String exitCodeStr) { + this.exitCodeStr = exitCodeStr; + return this; + } + + /** + * Get exitCodeStr + * @return exitCodeStr + */ + @javax.annotation.Nullable + public String getExitCodeStr() { + return exitCodeStr; + } + + public void setExitCodeStr(@javax.annotation.Nullable String exitCodeStr) { + this.exitCodeStr = exitCodeStr; + } + + + public ProcessActivityEntry name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProcessActivityEntry pid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + return this; + } + + /** + * Get pid + * @return pid + */ + @javax.annotation.Nonnull + public Long getPid() { + return pid; + } + + public void setPid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + } + + /** + * 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 ProcessActivityEntry instance itself + */ + public ProcessActivityEntry 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; + } + ProcessActivityEntry processActivityEntry = (ProcessActivityEntry) o; + return Objects.equals(this.args, processActivityEntry.args) && + Objects.equals(this.childSeqid, processActivityEntry.childSeqid) && + Objects.equals(this.events, processActivityEntry.events) && + Objects.equals(this.exitCode, processActivityEntry.exitCode) && + Objects.equals(this.exitCodeStr, processActivityEntry.exitCodeStr) && + Objects.equals(this.name, processActivityEntry.name) && + Objects.equals(this.pid, processActivityEntry.pid)&& + Objects.equals(this.additionalProperties, processActivityEntry.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(args, childSeqid, events, exitCode, exitCodeStr, name, pid, 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 ProcessActivityEntry {\n"); + sb.append(" args: ").append(toIndentedString(args)).append("\n"); + sb.append(" childSeqid: ").append(toIndentedString(childSeqid)).append("\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" exitCode: ").append(toIndentedString(exitCode)).append("\n"); + sb.append(" exitCodeStr: ").append(toIndentedString(exitCodeStr)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("args", "child_seqid", "events", "exit_code", "exit_code_str", "name", "pid")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("child_seqid", "name", "pid")); + } + + /** + * 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 ProcessActivityEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProcessActivityEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProcessActivityEntry is not found in the empty JSON string", ProcessActivityEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProcessActivityEntry.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("args") != null && !jsonObj.get("args").isJsonNull() && !jsonObj.get("args").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `args` to be an array in the JSON string but got `%s`", jsonObj.get("args").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("exit_code_str") != null && !jsonObj.get("exit_code_str").isJsonNull()) && !jsonObj.get("exit_code_str").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `exit_code_str` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exit_code_str").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProcessActivityEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProcessActivityEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProcessActivityEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProcessActivityEntry 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 ProcessActivityEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProcessActivityEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProcessActivityEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProcessActivityEntry + * @throws IOException if the JSON string is invalid with respect to ProcessActivityEntry + */ + public static ProcessActivityEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProcessActivityEntry.class); + } + + /** + * Convert an instance of ProcessActivityEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProcessMemdumps.java b/src/main/java/ai/reveng/model/ProcessMemdumps.java new file mode 100644 index 0000000..654b152 --- /dev/null +++ b/src/main/java/ai/reveng/model/ProcessMemdumps.java @@ -0,0 +1,344 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.MemdumpEntry; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ProcessMemdumps + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProcessMemdumps { + public static final String SERIALIZED_NAME_DUMPS = "dumps"; + @SerializedName(SERIALIZED_NAME_DUMPS) + @javax.annotation.Nullable + private List dumps; + + public static final String SERIALIZED_NAME_PROCESS_SEQID = "process_seqid"; + @SerializedName(SERIALIZED_NAME_PROCESS_SEQID) + @javax.annotation.Nonnull + private Long processSeqid; + + public ProcessMemdumps() { + } + + public ProcessMemdumps dumps(@javax.annotation.Nullable List dumps) { + this.dumps = dumps; + return this; + } + + public ProcessMemdumps addDumpsItem(MemdumpEntry dumpsItem) { + if (this.dumps == null) { + this.dumps = new ArrayList<>(); + } + this.dumps.add(dumpsItem); + return this; + } + + /** + * Get dumps + * @return dumps + */ + @javax.annotation.Nullable + public List getDumps() { + return dumps; + } + + public void setDumps(@javax.annotation.Nullable List dumps) { + this.dumps = dumps; + } + + + public ProcessMemdumps processSeqid(@javax.annotation.Nonnull Long processSeqid) { + this.processSeqid = processSeqid; + return this; + } + + /** + * Get processSeqid + * @return processSeqid + */ + @javax.annotation.Nonnull + public Long getProcessSeqid() { + return processSeqid; + } + + public void setProcessSeqid(@javax.annotation.Nonnull Long processSeqid) { + this.processSeqid = processSeqid; + } + + /** + * 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 ProcessMemdumps instance itself + */ + public ProcessMemdumps 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; + } + ProcessMemdumps processMemdumps = (ProcessMemdumps) o; + return Objects.equals(this.dumps, processMemdumps.dumps) && + Objects.equals(this.processSeqid, processMemdumps.processSeqid)&& + Objects.equals(this.additionalProperties, processMemdumps.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(dumps, processSeqid, 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 ProcessMemdumps {\n"); + sb.append(" dumps: ").append(toIndentedString(dumps)).append("\n"); + sb.append(" processSeqid: ").append(toIndentedString(processSeqid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("dumps", "process_seqid")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("process_seqid")); + } + + /** + * 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 ProcessMemdumps + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProcessMemdumps.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProcessMemdumps is not found in the empty JSON string", ProcessMemdumps.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProcessMemdumps.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("dumps") != null && !jsonObj.get("dumps").isJsonNull() && !jsonObj.get("dumps").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `dumps` to be an array in the JSON string but got `%s`", jsonObj.get("dumps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProcessMemdumps.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProcessMemdumps' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProcessMemdumps.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProcessMemdumps 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 ProcessMemdumps read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProcessMemdumps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProcessMemdumps given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProcessMemdumps + * @throws IOException if the JSON string is invalid with respect to ProcessMemdumps + */ + public static ProcessMemdumps fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProcessMemdumps.class); + } + + /** + * Convert an instance of ProcessMemdumps to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProcessNode.java b/src/main/java/ai/reveng/model/ProcessNode.java new file mode 100644 index 0000000..f7d8a93 --- /dev/null +++ b/src/main/java/ai/reveng/model/ProcessNode.java @@ -0,0 +1,595 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ProcessNode + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProcessNode { + public static final String SERIALIZED_NAME_ARGS = "args"; + @SerializedName(SERIALIZED_NAME_ARGS) + @javax.annotation.Nullable + private List args; + + public static final String SERIALIZED_NAME_ATTRIBUTED = "attributed"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTED) + @javax.annotation.Nonnull + private Boolean attributed; + + public static final String SERIALIZED_NAME_CHILDREN = "children"; + @SerializedName(SERIALIZED_NAME_CHILDREN) + @javax.annotation.Nullable + private List children; + + public static final String SERIALIZED_NAME_EXIT_CODE = "exit_code"; + @SerializedName(SERIALIZED_NAME_EXIT_CODE) + @javax.annotation.Nullable + private Long exitCode; + + public static final String SERIALIZED_NAME_EXIT_CODE_STR = "exit_code_str"; + @SerializedName(SERIALIZED_NAME_EXIT_CODE_STR) + @javax.annotation.Nullable + private String exitCodeStr; + + public static final String SERIALIZED_NAME_EXITED_AT = "exited_at"; + @SerializedName(SERIALIZED_NAME_EXITED_AT) + @javax.annotation.Nullable + private Double exitedAt; + + public static final String SERIALIZED_NAME_KILLED_BY = "killed_by"; + @SerializedName(SERIALIZED_NAME_KILLED_BY) + @javax.annotation.Nullable + private Long killedBy; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PID = "pid"; + @SerializedName(SERIALIZED_NAME_PID) + @javax.annotation.Nonnull + private Long pid; + + public static final String SERIALIZED_NAME_SEQID = "seqid"; + @SerializedName(SERIALIZED_NAME_SEQID) + @javax.annotation.Nonnull + private Long seqid; + + public static final String SERIALIZED_NAME_STARTED_AT = "started_at"; + @SerializedName(SERIALIZED_NAME_STARTED_AT) + @javax.annotation.Nullable + private Double startedAt; + + public ProcessNode() { + } + + public ProcessNode args(@javax.annotation.Nullable List args) { + this.args = args; + return this; + } + + public ProcessNode addArgsItem(String argsItem) { + if (this.args == null) { + this.args = new ArrayList<>(); + } + this.args.add(argsItem); + return this; + } + + /** + * Get args + * @return args + */ + @javax.annotation.Nullable + public List getArgs() { + return args; + } + + public void setArgs(@javax.annotation.Nullable List args) { + this.args = args; + } + + + public ProcessNode attributed(@javax.annotation.Nonnull Boolean attributed) { + this.attributed = attributed; + return this; + } + + /** + * Get attributed + * @return attributed + */ + @javax.annotation.Nonnull + public Boolean getAttributed() { + return attributed; + } + + public void setAttributed(@javax.annotation.Nonnull Boolean attributed) { + this.attributed = attributed; + } + + + public ProcessNode children(@javax.annotation.Nullable List children) { + this.children = children; + return this; + } + + public ProcessNode addChildrenItem(ProcessNode childrenItem) { + if (this.children == null) { + this.children = new ArrayList<>(); + } + this.children.add(childrenItem); + return this; + } + + /** + * Get children + * @return children + */ + @javax.annotation.Nullable + public List getChildren() { + return children; + } + + public void setChildren(@javax.annotation.Nullable List children) { + this.children = children; + } + + + public ProcessNode exitCode(@javax.annotation.Nullable Long exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get exitCode + * @return exitCode + */ + @javax.annotation.Nullable + public Long getExitCode() { + return exitCode; + } + + public void setExitCode(@javax.annotation.Nullable Long exitCode) { + this.exitCode = exitCode; + } + + + public ProcessNode exitCodeStr(@javax.annotation.Nullable String exitCodeStr) { + this.exitCodeStr = exitCodeStr; + return this; + } + + /** + * Get exitCodeStr + * @return exitCodeStr + */ + @javax.annotation.Nullable + public String getExitCodeStr() { + return exitCodeStr; + } + + public void setExitCodeStr(@javax.annotation.Nullable String exitCodeStr) { + this.exitCodeStr = exitCodeStr; + } + + + public ProcessNode exitedAt(@javax.annotation.Nullable Double exitedAt) { + this.exitedAt = exitedAt; + return this; + } + + /** + * Get exitedAt + * @return exitedAt + */ + @javax.annotation.Nullable + public Double getExitedAt() { + return exitedAt; + } + + public void setExitedAt(@javax.annotation.Nullable Double exitedAt) { + this.exitedAt = exitedAt; + } + + + public ProcessNode killedBy(@javax.annotation.Nullable Long killedBy) { + this.killedBy = killedBy; + return this; + } + + /** + * Get killedBy + * @return killedBy + */ + @javax.annotation.Nullable + public Long getKilledBy() { + return killedBy; + } + + public void setKilledBy(@javax.annotation.Nullable Long killedBy) { + this.killedBy = killedBy; + } + + + public ProcessNode name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProcessNode pid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + return this; + } + + /** + * Get pid + * @return pid + */ + @javax.annotation.Nonnull + public Long getPid() { + return pid; + } + + public void setPid(@javax.annotation.Nonnull Long pid) { + this.pid = pid; + } + + + public ProcessNode seqid(@javax.annotation.Nonnull Long seqid) { + this.seqid = seqid; + return this; + } + + /** + * Get seqid + * @return seqid + */ + @javax.annotation.Nonnull + public Long getSeqid() { + return seqid; + } + + public void setSeqid(@javax.annotation.Nonnull Long seqid) { + this.seqid = seqid; + } + + + public ProcessNode startedAt(@javax.annotation.Nullable Double startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + * Get startedAt + * @return startedAt + */ + @javax.annotation.Nullable + public Double getStartedAt() { + return startedAt; + } + + public void setStartedAt(@javax.annotation.Nullable Double startedAt) { + this.startedAt = startedAt; + } + + /** + * 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 ProcessNode instance itself + */ + public ProcessNode 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; + } + ProcessNode processNode = (ProcessNode) o; + return Objects.equals(this.args, processNode.args) && + Objects.equals(this.attributed, processNode.attributed) && + Objects.equals(this.children, processNode.children) && + Objects.equals(this.exitCode, processNode.exitCode) && + Objects.equals(this.exitCodeStr, processNode.exitCodeStr) && + Objects.equals(this.exitedAt, processNode.exitedAt) && + Objects.equals(this.killedBy, processNode.killedBy) && + Objects.equals(this.name, processNode.name) && + Objects.equals(this.pid, processNode.pid) && + Objects.equals(this.seqid, processNode.seqid) && + Objects.equals(this.startedAt, processNode.startedAt)&& + Objects.equals(this.additionalProperties, processNode.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(args, attributed, children, exitCode, exitCodeStr, exitedAt, killedBy, name, pid, seqid, startedAt, 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 ProcessNode {\n"); + sb.append(" args: ").append(toIndentedString(args)).append("\n"); + sb.append(" attributed: ").append(toIndentedString(attributed)).append("\n"); + sb.append(" children: ").append(toIndentedString(children)).append("\n"); + sb.append(" exitCode: ").append(toIndentedString(exitCode)).append("\n"); + sb.append(" exitCodeStr: ").append(toIndentedString(exitCodeStr)).append("\n"); + sb.append(" exitedAt: ").append(toIndentedString(exitedAt)).append("\n"); + sb.append(" killedBy: ").append(toIndentedString(killedBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); + sb.append(" seqid: ").append(toIndentedString(seqid)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("args", "attributed", "children", "exit_code", "exit_code_str", "exited_at", "killed_by", "name", "pid", "seqid", "started_at")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attributed", "name", "pid", "seqid")); + } + + /** + * 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 ProcessNode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProcessNode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProcessNode is not found in the empty JSON string", ProcessNode.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProcessNode.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("args") != null && !jsonObj.get("args").isJsonNull() && !jsonObj.get("args").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `args` to be an array in the JSON string but got `%s`", jsonObj.get("args").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("children") != null && !jsonObj.get("children").isJsonNull() && !jsonObj.get("children").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `children` to be an array in the JSON string but got `%s`", jsonObj.get("children").toString())); + } + if ((jsonObj.get("exit_code_str") != null && !jsonObj.get("exit_code_str").isJsonNull()) && !jsonObj.get("exit_code_str").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `exit_code_str` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exit_code_str").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProcessNode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProcessNode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProcessNode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProcessNode 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 ProcessNode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProcessNode instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProcessNode given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProcessNode + * @throws IOException if the JSON string is invalid with respect to ProcessNode + */ + public static ProcessNode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProcessNode.class); + } + + /** + * Convert an instance of ProcessNode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProcessTree.java b/src/main/java/ai/reveng/model/ProcessTree.java new file mode 100644 index 0000000..b5e1b82 --- /dev/null +++ b/src/main/java/ai/reveng/model/ProcessTree.java @@ -0,0 +1,337 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ProcessNode; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ProcessTree + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProcessTree { + public static final String SERIALIZED_NAME_NODES = "nodes"; + @SerializedName(SERIALIZED_NAME_NODES) + @javax.annotation.Nullable + private List nodes; + + public static final String SERIALIZED_NAME_SAMPLE_SEQID = "sample_seqid"; + @SerializedName(SERIALIZED_NAME_SAMPLE_SEQID) + @javax.annotation.Nullable + private Long sampleSeqid; + + public ProcessTree() { + } + + public ProcessTree nodes(@javax.annotation.Nullable List nodes) { + this.nodes = nodes; + return this; + } + + public ProcessTree addNodesItem(ProcessNode nodesItem) { + if (this.nodes == null) { + this.nodes = new ArrayList<>(); + } + this.nodes.add(nodesItem); + return this; + } + + /** + * Get nodes + * @return nodes + */ + @javax.annotation.Nullable + public List getNodes() { + return nodes; + } + + public void setNodes(@javax.annotation.Nullable List nodes) { + this.nodes = nodes; + } + + + public ProcessTree sampleSeqid(@javax.annotation.Nullable Long sampleSeqid) { + this.sampleSeqid = sampleSeqid; + return this; + } + + /** + * Get sampleSeqid + * @return sampleSeqid + */ + @javax.annotation.Nullable + public Long getSampleSeqid() { + return sampleSeqid; + } + + public void setSampleSeqid(@javax.annotation.Nullable Long sampleSeqid) { + this.sampleSeqid = sampleSeqid; + } + + /** + * 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 ProcessTree instance itself + */ + public ProcessTree 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; + } + ProcessTree processTree = (ProcessTree) o; + return Objects.equals(this.nodes, processTree.nodes) && + Objects.equals(this.sampleSeqid, processTree.sampleSeqid)&& + Objects.equals(this.additionalProperties, processTree.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(nodes, sampleSeqid, 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 ProcessTree {\n"); + sb.append(" nodes: ").append(toIndentedString(nodes)).append("\n"); + sb.append(" sampleSeqid: ").append(toIndentedString(sampleSeqid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("nodes", "sample_seqid")); + + // 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 ProcessTree + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProcessTree.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProcessTree is not found in the empty JSON string", ProcessTree.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("nodes") != null && !jsonObj.get("nodes").isJsonNull() && !jsonObj.get("nodes").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `nodes` to be an array in the JSON string but got `%s`", jsonObj.get("nodes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProcessTree.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProcessTree' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProcessTree.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProcessTree 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 ProcessTree read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProcessTree instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProcessTree given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProcessTree + * @throws IOException if the JSON string is invalid with respect to ProcessTree + */ + public static ProcessTree fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProcessTree.class); + } + + /** + * Convert an instance of ProcessTree to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RegistryOperation.java b/src/main/java/ai/reveng/model/RegistryOperation.java new file mode 100644 index 0000000..449ea2b --- /dev/null +++ b/src/main/java/ai/reveng/model/RegistryOperation.java @@ -0,0 +1,347 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * RegistryOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RegistryOperation { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nullable + private String key; + + public RegistryOperation() { + } + + public RegistryOperation events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public RegistryOperation addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public RegistryOperation key(@javax.annotation.Nullable String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nullable String key) { + this.key = key; + } + + /** + * 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 RegistryOperation instance itself + */ + public RegistryOperation 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; + } + RegistryOperation registryOperation = (RegistryOperation) o; + return Objects.equals(this.events, registryOperation.events) && + Objects.equals(this.key, registryOperation.key)&& + Objects.equals(this.additionalProperties, registryOperation.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(events, key, 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 RegistryOperation {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events", "key")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("key")); + } + + /** + * 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 RegistryOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RegistryOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in RegistryOperation is not found in the empty JSON string", RegistryOperation.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RegistryOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RegistryOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RegistryOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RegistryOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RegistryOperation 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 RegistryOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RegistryOperation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RegistryOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of RegistryOperation + * @throws IOException if the JSON string is invalid with respect to RegistryOperation + */ + public static RegistryOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RegistryOperation.class); + } + + /** + * Convert an instance of RegistryOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ReportEvent.java b/src/main/java/ai/reveng/model/ReportEvent.java new file mode 100644 index 0000000..f46a6cc --- /dev/null +++ b/src/main/java/ai/reveng/model/ReportEvent.java @@ -0,0 +1,483 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ApiCall; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ReportEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReportEvent { + public static final String SERIALIZED_NAME_API_CALLS = "api_calls"; + @SerializedName(SERIALIZED_NAME_API_CALLS) + @javax.annotation.Nullable + private List apiCalls; + + public static final String SERIALIZED_NAME_PROCESS_SEQID = "process_seqid"; + @SerializedName(SERIALIZED_NAME_PROCESS_SEQID) + @javax.annotation.Nullable + private Long processSeqid; + + public static final String SERIALIZED_NAME_TOTAL_BYTES_REQUESTED = "total_bytes_requested"; + @SerializedName(SERIALIZED_NAME_TOTAL_BYTES_REQUESTED) + @javax.annotation.Nullable + private Long totalBytesRequested; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_VALUE_NAME = "value_name"; + @SerializedName(SERIALIZED_NAME_VALUE_NAME) + @javax.annotation.Nullable + private String valueName; + + public static final String SERIALIZED_NAME_WRITE_COUNT = "write_count"; + @SerializedName(SERIALIZED_NAME_WRITE_COUNT) + @javax.annotation.Nullable + private Long writeCount; + + public ReportEvent() { + } + + public ReportEvent apiCalls(@javax.annotation.Nullable List apiCalls) { + this.apiCalls = apiCalls; + return this; + } + + public ReportEvent addApiCallsItem(ApiCall apiCallsItem) { + if (this.apiCalls == null) { + this.apiCalls = new ArrayList<>(); + } + this.apiCalls.add(apiCallsItem); + return this; + } + + /** + * Get apiCalls + * @return apiCalls + */ + @javax.annotation.Nullable + public List getApiCalls() { + return apiCalls; + } + + public void setApiCalls(@javax.annotation.Nullable List apiCalls) { + this.apiCalls = apiCalls; + } + + + public ReportEvent processSeqid(@javax.annotation.Nullable Long processSeqid) { + this.processSeqid = processSeqid; + return this; + } + + /** + * Get processSeqid + * @return processSeqid + */ + @javax.annotation.Nullable + public Long getProcessSeqid() { + return processSeqid; + } + + public void setProcessSeqid(@javax.annotation.Nullable Long processSeqid) { + this.processSeqid = processSeqid; + } + + + public ReportEvent totalBytesRequested(@javax.annotation.Nullable Long totalBytesRequested) { + this.totalBytesRequested = totalBytesRequested; + return this; + } + + /** + * Get totalBytesRequested + * @return totalBytesRequested + */ + @javax.annotation.Nullable + public Long getTotalBytesRequested() { + return totalBytesRequested; + } + + public void setTotalBytesRequested(@javax.annotation.Nullable Long totalBytesRequested) { + this.totalBytesRequested = totalBytesRequested; + } + + + public ReportEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ReportEvent value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ReportEvent valueName(@javax.annotation.Nullable String valueName) { + this.valueName = valueName; + return this; + } + + /** + * Get valueName + * @return valueName + */ + @javax.annotation.Nullable + public String getValueName() { + return valueName; + } + + public void setValueName(@javax.annotation.Nullable String valueName) { + this.valueName = valueName; + } + + + public ReportEvent writeCount(@javax.annotation.Nullable Long writeCount) { + this.writeCount = writeCount; + return this; + } + + /** + * Get writeCount + * @return writeCount + */ + @javax.annotation.Nullable + public Long getWriteCount() { + return writeCount; + } + + public void setWriteCount(@javax.annotation.Nullable Long writeCount) { + this.writeCount = writeCount; + } + + /** + * 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 ReportEvent instance itself + */ + public ReportEvent 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; + } + ReportEvent reportEvent = (ReportEvent) o; + return Objects.equals(this.apiCalls, reportEvent.apiCalls) && + Objects.equals(this.processSeqid, reportEvent.processSeqid) && + Objects.equals(this.totalBytesRequested, reportEvent.totalBytesRequested) && + Objects.equals(this.type, reportEvent.type) && + Objects.equals(this.value, reportEvent.value) && + Objects.equals(this.valueName, reportEvent.valueName) && + Objects.equals(this.writeCount, reportEvent.writeCount)&& + Objects.equals(this.additionalProperties, reportEvent.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(apiCalls, processSeqid, totalBytesRequested, type, value, valueName, writeCount, 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 ReportEvent {\n"); + sb.append(" apiCalls: ").append(toIndentedString(apiCalls)).append("\n"); + sb.append(" processSeqid: ").append(toIndentedString(processSeqid)).append("\n"); + sb.append(" totalBytesRequested: ").append(toIndentedString(totalBytesRequested)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" valueName: ").append(toIndentedString(valueName)).append("\n"); + sb.append(" writeCount: ").append(toIndentedString(writeCount)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("api_calls", "process_seqid", "total_bytes_requested", "type", "value", "value_name", "write_count")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReportEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReportEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ReportEvent is not found in the empty JSON string", ReportEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReportEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("api_calls") != null && !jsonObj.get("api_calls").isJsonNull() && !jsonObj.get("api_calls").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `api_calls` to be an array in the JSON string but got `%s`", jsonObj.get("api_calls").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("value_name") != null && !jsonObj.get("value_name").isJsonNull()) && !jsonObj.get("value_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReportEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReportEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReportEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReportEvent 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 ReportEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReportEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReportEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReportEvent + * @throws IOException if the JSON string is invalid with respect to ReportEvent + */ + public static ReportEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReportEvent.class); + } + + /** + * Convert an instance of ReportEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ReportInfo.java b/src/main/java/ai/reveng/model/ReportInfo.java new file mode 100644 index 0000000..d8009eb --- /dev/null +++ b/src/main/java/ai/reveng/model/ReportInfo.java @@ -0,0 +1,505 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.DrakvufFileMetadata; +import ai.reveng.model.ReportOptions; +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 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ReportInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReportInfo { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private DrakvufFileMetadata _file; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private ReportOptions options; + + public static final String SERIALIZED_NAME_OS_PROFILE = "os_profile"; + @SerializedName(SERIALIZED_NAME_OS_PROFILE) + @javax.annotation.Nullable + private String osProfile; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_TIME_ANALYSIS_FINISHED = "time_analysis_finished"; + @SerializedName(SERIALIZED_NAME_TIME_ANALYSIS_FINISHED) + @javax.annotation.Nullable + private String timeAnalysisFinished; + + public static final String SERIALIZED_NAME_TIME_EXECUTION_STARTED = "time_execution_started"; + @SerializedName(SERIALIZED_NAME_TIME_EXECUTION_STARTED) + @javax.annotation.Nullable + private String timeExecutionStarted; + + public static final String SERIALIZED_NAME_TIME_STARTED = "time_started"; + @SerializedName(SERIALIZED_NAME_TIME_STARTED) + @javax.annotation.Nullable + private String timeStarted; + + public ReportInfo() { + } + + public ReportInfo _file(@javax.annotation.Nullable DrakvufFileMetadata _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + public DrakvufFileMetadata getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable DrakvufFileMetadata _file) { + this._file = _file; + } + + + public ReportInfo id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ReportInfo options(@javax.annotation.Nullable ReportOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public ReportOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable ReportOptions options) { + this.options = options; + } + + + public ReportInfo osProfile(@javax.annotation.Nullable String osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get osProfile + * @return osProfile + */ + @javax.annotation.Nullable + public String getOsProfile() { + return osProfile; + } + + public void setOsProfile(@javax.annotation.Nullable String osProfile) { + this.osProfile = osProfile; + } + + + public ReportInfo status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + public ReportInfo timeAnalysisFinished(@javax.annotation.Nullable String timeAnalysisFinished) { + this.timeAnalysisFinished = timeAnalysisFinished; + return this; + } + + /** + * Get timeAnalysisFinished + * @return timeAnalysisFinished + */ + @javax.annotation.Nullable + public String getTimeAnalysisFinished() { + return timeAnalysisFinished; + } + + public void setTimeAnalysisFinished(@javax.annotation.Nullable String timeAnalysisFinished) { + this.timeAnalysisFinished = timeAnalysisFinished; + } + + + public ReportInfo timeExecutionStarted(@javax.annotation.Nullable String timeExecutionStarted) { + this.timeExecutionStarted = timeExecutionStarted; + return this; + } + + /** + * Get timeExecutionStarted + * @return timeExecutionStarted + */ + @javax.annotation.Nullable + public String getTimeExecutionStarted() { + return timeExecutionStarted; + } + + public void setTimeExecutionStarted(@javax.annotation.Nullable String timeExecutionStarted) { + this.timeExecutionStarted = timeExecutionStarted; + } + + + public ReportInfo timeStarted(@javax.annotation.Nullable String timeStarted) { + this.timeStarted = timeStarted; + return this; + } + + /** + * Get timeStarted + * @return timeStarted + */ + @javax.annotation.Nullable + public String getTimeStarted() { + return timeStarted; + } + + public void setTimeStarted(@javax.annotation.Nullable String timeStarted) { + this.timeStarted = timeStarted; + } + + /** + * 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 ReportInfo instance itself + */ + public ReportInfo 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; + } + ReportInfo reportInfo = (ReportInfo) o; + return Objects.equals(this._file, reportInfo._file) && + Objects.equals(this.id, reportInfo.id) && + Objects.equals(this.options, reportInfo.options) && + Objects.equals(this.osProfile, reportInfo.osProfile) && + Objects.equals(this.status, reportInfo.status) && + Objects.equals(this.timeAnalysisFinished, reportInfo.timeAnalysisFinished) && + Objects.equals(this.timeExecutionStarted, reportInfo.timeExecutionStarted) && + Objects.equals(this.timeStarted, reportInfo.timeStarted)&& + Objects.equals(this.additionalProperties, reportInfo.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(_file, id, options, osProfile, status, timeAnalysisFinished, timeExecutionStarted, timeStarted, 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 ReportInfo {\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" osProfile: ").append(toIndentedString(osProfile)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" timeAnalysisFinished: ").append(toIndentedString(timeAnalysisFinished)).append("\n"); + sb.append(" timeExecutionStarted: ").append(toIndentedString(timeExecutionStarted)).append("\n"); + sb.append(" timeStarted: ").append(toIndentedString(timeStarted)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "id", "options", "os_profile", "status", "time_analysis_finished", "time_execution_started", "time_started")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id")); + } + + /** + * 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 ReportInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReportInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ReportInfo is not found in the empty JSON string", ReportInfo.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReportInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("os_profile") != null && !jsonObj.get("os_profile").isJsonNull()) && !jsonObj.get("os_profile").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `os_profile` to be a primitive type in the JSON string but got `%s`", jsonObj.get("os_profile").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("time_analysis_finished") != null && !jsonObj.get("time_analysis_finished").isJsonNull()) && !jsonObj.get("time_analysis_finished").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `time_analysis_finished` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_analysis_finished").toString())); + } + if ((jsonObj.get("time_execution_started") != null && !jsonObj.get("time_execution_started").isJsonNull()) && !jsonObj.get("time_execution_started").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `time_execution_started` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_execution_started").toString())); + } + if ((jsonObj.get("time_started") != null && !jsonObj.get("time_started").isJsonNull()) && !jsonObj.get("time_started").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `time_started` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_started").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReportInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReportInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReportInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReportInfo 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 ReportInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReportInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReportInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReportInfo + * @throws IOException if the JSON string is invalid with respect to ReportInfo + */ + public static ReportInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReportInfo.class); + } + + /** + * Convert an instance of ReportInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ReportOptions.java b/src/main/java/ai/reveng/model/ReportOptions.java new file mode 100644 index 0000000..6c0f1b4 --- /dev/null +++ b/src/main/java/ai/reveng/model/ReportOptions.java @@ -0,0 +1,620 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ReportOptions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReportOptions { + public static final String SERIALIZED_NAME_ARCHIVE_ENTRY_PATH = "archive_entry_path"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_ENTRY_PATH) + @javax.annotation.Nullable + private String archiveEntryPath; + + public static final String SERIALIZED_NAME_EXTRACT_ARCHIVE = "extract_archive"; + @SerializedName(SERIALIZED_NAME_EXTRACT_ARCHIVE) + @javax.annotation.Nullable + private Boolean extractArchive; + + public static final String SERIALIZED_NAME_GUEST_TARGET_DIRECTORY = "guest_target_directory"; + @SerializedName(SERIALIZED_NAME_GUEST_TARGET_DIRECTORY) + @javax.annotation.Nullable + private String guestTargetDirectory; + + public static final String SERIALIZED_NAME_GUEST_WORKING_DIRECTORY = "guest_working_directory"; + @SerializedName(SERIALIZED_NAME_GUEST_WORKING_DIRECTORY) + @javax.annotation.Nullable + private String guestWorkingDirectory; + + public static final String SERIALIZED_NAME_NET_ENABLE = "net_enable"; + @SerializedName(SERIALIZED_NAME_NET_ENABLE) + @javax.annotation.Nullable + private Boolean netEnable; + + public static final String SERIALIZED_NAME_OS_PROFILE = "os_profile"; + @SerializedName(SERIALIZED_NAME_OS_PROFILE) + @javax.annotation.Nullable + private String osProfile; + + public static final String SERIALIZED_NAME_PLUGINS = "plugins"; + @SerializedName(SERIALIZED_NAME_PLUGINS) + @javax.annotation.Nullable + private List plugins; + + public static final String SERIALIZED_NAME_PRESET = "preset"; + @SerializedName(SERIALIZED_NAME_PRESET) + @javax.annotation.Nullable + private String preset; + + public static final String SERIALIZED_NAME_SAMPLE_FILENAME = "sample_filename"; + @SerializedName(SERIALIZED_NAME_SAMPLE_FILENAME) + @javax.annotation.Nullable + private String sampleFilename; + + public static final String SERIALIZED_NAME_START_COMMAND = "start_command"; + @SerializedName(SERIALIZED_NAME_START_COMMAND) + @javax.annotation.Nullable + private String startCommand; + + public static final String SERIALIZED_NAME_START_METHOD = "start_method"; + @SerializedName(SERIALIZED_NAME_START_METHOD) + @javax.annotation.Nullable + private String startMethod; + + public static final String SERIALIZED_NAME_TIMEOUT = "timeout"; + @SerializedName(SERIALIZED_NAME_TIMEOUT) + @javax.annotation.Nullable + private Long timeout; + + public ReportOptions() { + } + + public ReportOptions archiveEntryPath(@javax.annotation.Nullable String archiveEntryPath) { + this.archiveEntryPath = archiveEntryPath; + return this; + } + + /** + * Get archiveEntryPath + * @return archiveEntryPath + */ + @javax.annotation.Nullable + public String getArchiveEntryPath() { + return archiveEntryPath; + } + + public void setArchiveEntryPath(@javax.annotation.Nullable String archiveEntryPath) { + this.archiveEntryPath = archiveEntryPath; + } + + + public ReportOptions extractArchive(@javax.annotation.Nullable Boolean extractArchive) { + this.extractArchive = extractArchive; + return this; + } + + /** + * Get extractArchive + * @return extractArchive + */ + @javax.annotation.Nullable + public Boolean getExtractArchive() { + return extractArchive; + } + + public void setExtractArchive(@javax.annotation.Nullable Boolean extractArchive) { + this.extractArchive = extractArchive; + } + + + public ReportOptions guestTargetDirectory(@javax.annotation.Nullable String guestTargetDirectory) { + this.guestTargetDirectory = guestTargetDirectory; + return this; + } + + /** + * Get guestTargetDirectory + * @return guestTargetDirectory + */ + @javax.annotation.Nullable + public String getGuestTargetDirectory() { + return guestTargetDirectory; + } + + public void setGuestTargetDirectory(@javax.annotation.Nullable String guestTargetDirectory) { + this.guestTargetDirectory = guestTargetDirectory; + } + + + public ReportOptions guestWorkingDirectory(@javax.annotation.Nullable String guestWorkingDirectory) { + this.guestWorkingDirectory = guestWorkingDirectory; + return this; + } + + /** + * Get guestWorkingDirectory + * @return guestWorkingDirectory + */ + @javax.annotation.Nullable + public String getGuestWorkingDirectory() { + return guestWorkingDirectory; + } + + public void setGuestWorkingDirectory(@javax.annotation.Nullable String guestWorkingDirectory) { + this.guestWorkingDirectory = guestWorkingDirectory; + } + + + public ReportOptions netEnable(@javax.annotation.Nullable Boolean netEnable) { + this.netEnable = netEnable; + return this; + } + + /** + * Get netEnable + * @return netEnable + */ + @javax.annotation.Nullable + public Boolean getNetEnable() { + return netEnable; + } + + public void setNetEnable(@javax.annotation.Nullable Boolean netEnable) { + this.netEnable = netEnable; + } + + + public ReportOptions osProfile(@javax.annotation.Nullable String osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get osProfile + * @return osProfile + */ + @javax.annotation.Nullable + public String getOsProfile() { + return osProfile; + } + + public void setOsProfile(@javax.annotation.Nullable String osProfile) { + this.osProfile = osProfile; + } + + + public ReportOptions plugins(@javax.annotation.Nullable List plugins) { + this.plugins = plugins; + return this; + } + + public ReportOptions addPluginsItem(String pluginsItem) { + if (this.plugins == null) { + this.plugins = new ArrayList<>(); + } + this.plugins.add(pluginsItem); + return this; + } + + /** + * Get plugins + * @return plugins + */ + @javax.annotation.Nullable + public List getPlugins() { + return plugins; + } + + public void setPlugins(@javax.annotation.Nullable List plugins) { + this.plugins = plugins; + } + + + public ReportOptions preset(@javax.annotation.Nullable String preset) { + this.preset = preset; + return this; + } + + /** + * Get preset + * @return preset + */ + @javax.annotation.Nullable + public String getPreset() { + return preset; + } + + public void setPreset(@javax.annotation.Nullable String preset) { + this.preset = preset; + } + + + public ReportOptions sampleFilename(@javax.annotation.Nullable String sampleFilename) { + this.sampleFilename = sampleFilename; + return this; + } + + /** + * Get sampleFilename + * @return sampleFilename + */ + @javax.annotation.Nullable + public String getSampleFilename() { + return sampleFilename; + } + + public void setSampleFilename(@javax.annotation.Nullable String sampleFilename) { + this.sampleFilename = sampleFilename; + } + + + public ReportOptions startCommand(@javax.annotation.Nullable String startCommand) { + this.startCommand = startCommand; + return this; + } + + /** + * Get startCommand + * @return startCommand + */ + @javax.annotation.Nullable + public String getStartCommand() { + return startCommand; + } + + public void setStartCommand(@javax.annotation.Nullable String startCommand) { + this.startCommand = startCommand; + } + + + public ReportOptions startMethod(@javax.annotation.Nullable String startMethod) { + this.startMethod = startMethod; + return this; + } + + /** + * Get startMethod + * @return startMethod + */ + @javax.annotation.Nullable + public String getStartMethod() { + return startMethod; + } + + public void setStartMethod(@javax.annotation.Nullable String startMethod) { + this.startMethod = startMethod; + } + + + public ReportOptions timeout(@javax.annotation.Nullable Long timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get timeout + * @return timeout + */ + @javax.annotation.Nullable + public Long getTimeout() { + return timeout; + } + + public void setTimeout(@javax.annotation.Nullable Long timeout) { + this.timeout = timeout; + } + + /** + * 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 ReportOptions instance itself + */ + public ReportOptions 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; + } + ReportOptions reportOptions = (ReportOptions) o; + return Objects.equals(this.archiveEntryPath, reportOptions.archiveEntryPath) && + Objects.equals(this.extractArchive, reportOptions.extractArchive) && + Objects.equals(this.guestTargetDirectory, reportOptions.guestTargetDirectory) && + Objects.equals(this.guestWorkingDirectory, reportOptions.guestWorkingDirectory) && + Objects.equals(this.netEnable, reportOptions.netEnable) && + Objects.equals(this.osProfile, reportOptions.osProfile) && + Objects.equals(this.plugins, reportOptions.plugins) && + Objects.equals(this.preset, reportOptions.preset) && + Objects.equals(this.sampleFilename, reportOptions.sampleFilename) && + Objects.equals(this.startCommand, reportOptions.startCommand) && + Objects.equals(this.startMethod, reportOptions.startMethod) && + Objects.equals(this.timeout, reportOptions.timeout)&& + Objects.equals(this.additionalProperties, reportOptions.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(archiveEntryPath, extractArchive, guestTargetDirectory, guestWorkingDirectory, netEnable, osProfile, plugins, preset, sampleFilename, startCommand, startMethod, timeout, 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 ReportOptions {\n"); + sb.append(" archiveEntryPath: ").append(toIndentedString(archiveEntryPath)).append("\n"); + sb.append(" extractArchive: ").append(toIndentedString(extractArchive)).append("\n"); + sb.append(" guestTargetDirectory: ").append(toIndentedString(guestTargetDirectory)).append("\n"); + sb.append(" guestWorkingDirectory: ").append(toIndentedString(guestWorkingDirectory)).append("\n"); + sb.append(" netEnable: ").append(toIndentedString(netEnable)).append("\n"); + sb.append(" osProfile: ").append(toIndentedString(osProfile)).append("\n"); + sb.append(" plugins: ").append(toIndentedString(plugins)).append("\n"); + sb.append(" preset: ").append(toIndentedString(preset)).append("\n"); + sb.append(" sampleFilename: ").append(toIndentedString(sampleFilename)).append("\n"); + sb.append(" startCommand: ").append(toIndentedString(startCommand)).append("\n"); + sb.append(" startMethod: ").append(toIndentedString(startMethod)).append("\n"); + sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("archive_entry_path", "extract_archive", "guest_target_directory", "guest_working_directory", "net_enable", "os_profile", "plugins", "preset", "sample_filename", "start_command", "start_method", "timeout")); + + // 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 ReportOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReportOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ReportOptions is not found in the empty JSON string", ReportOptions.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("archive_entry_path") != null && !jsonObj.get("archive_entry_path").isJsonNull()) && !jsonObj.get("archive_entry_path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `archive_entry_path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archive_entry_path").toString())); + } + if ((jsonObj.get("guest_target_directory") != null && !jsonObj.get("guest_target_directory").isJsonNull()) && !jsonObj.get("guest_target_directory").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `guest_target_directory` to be a primitive type in the JSON string but got `%s`", jsonObj.get("guest_target_directory").toString())); + } + if ((jsonObj.get("guest_working_directory") != null && !jsonObj.get("guest_working_directory").isJsonNull()) && !jsonObj.get("guest_working_directory").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `guest_working_directory` to be a primitive type in the JSON string but got `%s`", jsonObj.get("guest_working_directory").toString())); + } + if ((jsonObj.get("os_profile") != null && !jsonObj.get("os_profile").isJsonNull()) && !jsonObj.get("os_profile").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `os_profile` to be a primitive type in the JSON string but got `%s`", jsonObj.get("os_profile").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("plugins") != null && !jsonObj.get("plugins").isJsonNull() && !jsonObj.get("plugins").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `plugins` to be an array in the JSON string but got `%s`", jsonObj.get("plugins").toString())); + } + if ((jsonObj.get("preset") != null && !jsonObj.get("preset").isJsonNull()) && !jsonObj.get("preset").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `preset` to be a primitive type in the JSON string but got `%s`", jsonObj.get("preset").toString())); + } + if ((jsonObj.get("sample_filename") != null && !jsonObj.get("sample_filename").isJsonNull()) && !jsonObj.get("sample_filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `sample_filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sample_filename").toString())); + } + if ((jsonObj.get("start_command") != null && !jsonObj.get("start_command").isJsonNull()) && !jsonObj.get("start_command").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_command` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_command").toString())); + } + if ((jsonObj.get("start_method") != null && !jsonObj.get("start_method").isJsonNull()) && !jsonObj.get("start_method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_method").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReportOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReportOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReportOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReportOptions 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 ReportOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReportOptions instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReportOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReportOptions + * @throws IOException if the JSON string is invalid with respect to ReportOptions + */ + public static ReportOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReportOptions.class); + } + + /** + * Convert an instance of ReportOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ScheduledTaskEntry.java b/src/main/java/ai/reveng/model/ScheduledTaskEntry.java new file mode 100644 index 0000000..0fdc9e4 --- /dev/null +++ b/src/main/java/ai/reveng/model/ScheduledTaskEntry.java @@ -0,0 +1,601 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ScheduledTaskEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ScheduledTaskEntry { + public static final String SERIALIZED_NAME_COMMAND = "command"; + @SerializedName(SERIALIZED_NAME_COMMAND) + @javax.annotation.Nullable + private String command; + + public static final String SERIALIZED_NAME_DAY = "day"; + @SerializedName(SERIALIZED_NAME_DAY) + @javax.annotation.Nullable + private String day; + + public static final String SERIALIZED_NAME_END_DATE = "end_date"; + @SerializedName(SERIALIZED_NAME_END_DATE) + @javax.annotation.Nullable + private String endDate; + + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_EXECUTABLE = "executable"; + @SerializedName(SERIALIZED_NAME_EXECUTABLE) + @javax.annotation.Nullable + private String executable; + + public static final String SERIALIZED_NAME_MODIFIER = "modifier"; + @SerializedName(SERIALIZED_NAME_MODIFIER) + @javax.annotation.Nullable + private String modifier; + + public static final String SERIALIZED_NAME_RUN_AS = "run_as"; + @SerializedName(SERIALIZED_NAME_RUN_AS) + @javax.annotation.Nullable + private String runAs; + + public static final String SERIALIZED_NAME_SCHEDULE_TYPE = "schedule_type"; + @SerializedName(SERIALIZED_NAME_SCHEDULE_TYPE) + @javax.annotation.Nullable + private String scheduleType; + + public static final String SERIALIZED_NAME_START_DATE = "start_date"; + @SerializedName(SERIALIZED_NAME_START_DATE) + @javax.annotation.Nullable + private String startDate; + + public static final String SERIALIZED_NAME_START_TIME = "start_time"; + @SerializedName(SERIALIZED_NAME_START_TIME) + @javax.annotation.Nullable + private String startTime; + + public static final String SERIALIZED_NAME_TASK_NAME = "task_name"; + @SerializedName(SERIALIZED_NAME_TASK_NAME) + @javax.annotation.Nullable + private String taskName; + + public ScheduledTaskEntry() { + } + + public ScheduledTaskEntry command(@javax.annotation.Nullable String command) { + this.command = command; + return this; + } + + /** + * Get command + * @return command + */ + @javax.annotation.Nullable + public String getCommand() { + return command; + } + + public void setCommand(@javax.annotation.Nullable String command) { + this.command = command; + } + + + public ScheduledTaskEntry day(@javax.annotation.Nullable String day) { + this.day = day; + return this; + } + + /** + * Get day + * @return day + */ + @javax.annotation.Nullable + public String getDay() { + return day; + } + + public void setDay(@javax.annotation.Nullable String day) { + this.day = day; + } + + + public ScheduledTaskEntry endDate(@javax.annotation.Nullable String endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get endDate + * @return endDate + */ + @javax.annotation.Nullable + public String getEndDate() { + return endDate; + } + + public void setEndDate(@javax.annotation.Nullable String endDate) { + this.endDate = endDate; + } + + + public ScheduledTaskEntry events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public ScheduledTaskEntry addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public ScheduledTaskEntry executable(@javax.annotation.Nullable String executable) { + this.executable = executable; + return this; + } + + /** + * Get executable + * @return executable + */ + @javax.annotation.Nullable + public String getExecutable() { + return executable; + } + + public void setExecutable(@javax.annotation.Nullable String executable) { + this.executable = executable; + } + + + public ScheduledTaskEntry modifier(@javax.annotation.Nullable String modifier) { + this.modifier = modifier; + return this; + } + + /** + * Get modifier + * @return modifier + */ + @javax.annotation.Nullable + public String getModifier() { + return modifier; + } + + public void setModifier(@javax.annotation.Nullable String modifier) { + this.modifier = modifier; + } + + + public ScheduledTaskEntry runAs(@javax.annotation.Nullable String runAs) { + this.runAs = runAs; + return this; + } + + /** + * Get runAs + * @return runAs + */ + @javax.annotation.Nullable + public String getRunAs() { + return runAs; + } + + public void setRunAs(@javax.annotation.Nullable String runAs) { + this.runAs = runAs; + } + + + public ScheduledTaskEntry scheduleType(@javax.annotation.Nullable String scheduleType) { + this.scheduleType = scheduleType; + return this; + } + + /** + * Get scheduleType + * @return scheduleType + */ + @javax.annotation.Nullable + public String getScheduleType() { + return scheduleType; + } + + public void setScheduleType(@javax.annotation.Nullable String scheduleType) { + this.scheduleType = scheduleType; + } + + + public ScheduledTaskEntry startDate(@javax.annotation.Nullable String startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get startDate + * @return startDate + */ + @javax.annotation.Nullable + public String getStartDate() { + return startDate; + } + + public void setStartDate(@javax.annotation.Nullable String startDate) { + this.startDate = startDate; + } + + + public ScheduledTaskEntry startTime(@javax.annotation.Nullable String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + */ + @javax.annotation.Nullable + public String getStartTime() { + return startTime; + } + + public void setStartTime(@javax.annotation.Nullable String startTime) { + this.startTime = startTime; + } + + + public ScheduledTaskEntry taskName(@javax.annotation.Nullable String taskName) { + this.taskName = taskName; + return this; + } + + /** + * Get taskName + * @return taskName + */ + @javax.annotation.Nullable + public String getTaskName() { + return taskName; + } + + public void setTaskName(@javax.annotation.Nullable String taskName) { + this.taskName = taskName; + } + + /** + * 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 ScheduledTaskEntry instance itself + */ + public ScheduledTaskEntry 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; + } + ScheduledTaskEntry scheduledTaskEntry = (ScheduledTaskEntry) o; + return Objects.equals(this.command, scheduledTaskEntry.command) && + Objects.equals(this.day, scheduledTaskEntry.day) && + Objects.equals(this.endDate, scheduledTaskEntry.endDate) && + Objects.equals(this.events, scheduledTaskEntry.events) && + Objects.equals(this.executable, scheduledTaskEntry.executable) && + Objects.equals(this.modifier, scheduledTaskEntry.modifier) && + Objects.equals(this.runAs, scheduledTaskEntry.runAs) && + Objects.equals(this.scheduleType, scheduledTaskEntry.scheduleType) && + Objects.equals(this.startDate, scheduledTaskEntry.startDate) && + Objects.equals(this.startTime, scheduledTaskEntry.startTime) && + Objects.equals(this.taskName, scheduledTaskEntry.taskName)&& + Objects.equals(this.additionalProperties, scheduledTaskEntry.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(command, day, endDate, events, executable, modifier, runAs, scheduleType, startDate, startTime, taskName, 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 ScheduledTaskEntry {\n"); + sb.append(" command: ").append(toIndentedString(command)).append("\n"); + sb.append(" day: ").append(toIndentedString(day)).append("\n"); + sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" executable: ").append(toIndentedString(executable)).append("\n"); + sb.append(" modifier: ").append(toIndentedString(modifier)).append("\n"); + sb.append(" runAs: ").append(toIndentedString(runAs)).append("\n"); + sb.append(" scheduleType: ").append(toIndentedString(scheduleType)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" taskName: ").append(toIndentedString(taskName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("command", "day", "end_date", "events", "executable", "modifier", "run_as", "schedule_type", "start_date", "start_time", "task_name")); + + // 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 ScheduledTaskEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ScheduledTaskEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ScheduledTaskEntry is not found in the empty JSON string", ScheduledTaskEntry.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("command") != null && !jsonObj.get("command").isJsonNull()) && !jsonObj.get("command").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `command` to be a primitive type in the JSON string but got `%s`", jsonObj.get("command").toString())); + } + if ((jsonObj.get("day") != null && !jsonObj.get("day").isJsonNull()) && !jsonObj.get("day").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `day` to be a primitive type in the JSON string but got `%s`", jsonObj.get("day").toString())); + } + if ((jsonObj.get("end_date") != null && !jsonObj.get("end_date").isJsonNull()) && !jsonObj.get("end_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `end_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end_date").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("executable") != null && !jsonObj.get("executable").isJsonNull()) && !jsonObj.get("executable").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `executable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("executable").toString())); + } + if ((jsonObj.get("modifier") != null && !jsonObj.get("modifier").isJsonNull()) && !jsonObj.get("modifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `modifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("modifier").toString())); + } + if ((jsonObj.get("run_as") != null && !jsonObj.get("run_as").isJsonNull()) && !jsonObj.get("run_as").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `run_as` to be a primitive type in the JSON string but got `%s`", jsonObj.get("run_as").toString())); + } + if ((jsonObj.get("schedule_type") != null && !jsonObj.get("schedule_type").isJsonNull()) && !jsonObj.get("schedule_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `schedule_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schedule_type").toString())); + } + if ((jsonObj.get("start_date") != null && !jsonObj.get("start_date").isJsonNull()) && !jsonObj.get("start_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_date").toString())); + } + if ((jsonObj.get("start_time") != null && !jsonObj.get("start_time").isJsonNull()) && !jsonObj.get("start_time").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_time").toString())); + } + if ((jsonObj.get("task_name") != null && !jsonObj.get("task_name").isJsonNull()) && !jsonObj.get("task_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `task_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("task_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ScheduledTaskEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScheduledTaskEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ScheduledTaskEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ScheduledTaskEntry 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 ScheduledTaskEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ScheduledTaskEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ScheduledTaskEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ScheduledTaskEntry + * @throws IOException if the JSON string is invalid with respect to ScheduledTaskEntry + */ + public static ScheduledTaskEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ScheduledTaskEntry.class); + } + + /** + * Convert an instance of ScheduledTaskEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ServiceEntry.java b/src/main/java/ai/reveng/model/ServiceEntry.java new file mode 100644 index 0000000..0e727cd --- /dev/null +++ b/src/main/java/ai/reveng/model/ServiceEntry.java @@ -0,0 +1,456 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ReportEvent; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ServiceEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ServiceEntry { + public static final String SERIALIZED_NAME_BINARY_PATH = "binary_path"; + @SerializedName(SERIALIZED_NAME_BINARY_PATH) + @javax.annotation.Nullable + private String binaryPath; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nullable + private String displayName; + + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nullable + private List events; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SERVICE_TYPE = "service_type"; + @SerializedName(SERIALIZED_NAME_SERVICE_TYPE) + @javax.annotation.Nullable + private String serviceType; + + public static final String SERIALIZED_NAME_START_TYPE = "start_type"; + @SerializedName(SERIALIZED_NAME_START_TYPE) + @javax.annotation.Nullable + private String startType; + + public ServiceEntry() { + } + + public ServiceEntry binaryPath(@javax.annotation.Nullable String binaryPath) { + this.binaryPath = binaryPath; + return this; + } + + /** + * Get binaryPath + * @return binaryPath + */ + @javax.annotation.Nullable + public String getBinaryPath() { + return binaryPath; + } + + public void setBinaryPath(@javax.annotation.Nullable String binaryPath) { + this.binaryPath = binaryPath; + } + + + public ServiceEntry displayName(@javax.annotation.Nullable String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * @return displayName + */ + @javax.annotation.Nullable + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nullable String displayName) { + this.displayName = displayName; + } + + + public ServiceEntry events(@javax.annotation.Nullable List events) { + this.events = events; + return this; + } + + public ServiceEntry addEventsItem(ReportEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nullable + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nullable List events) { + this.events = events; + } + + + public ServiceEntry name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ServiceEntry serviceType(@javax.annotation.Nullable String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Get serviceType + * @return serviceType + */ + @javax.annotation.Nullable + public String getServiceType() { + return serviceType; + } + + public void setServiceType(@javax.annotation.Nullable String serviceType) { + this.serviceType = serviceType; + } + + + public ServiceEntry startType(@javax.annotation.Nullable String startType) { + this.startType = startType; + return this; + } + + /** + * Get startType + * @return startType + */ + @javax.annotation.Nullable + public String getStartType() { + return startType; + } + + public void setStartType(@javax.annotation.Nullable String startType) { + this.startType = startType; + } + + /** + * 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 ServiceEntry instance itself + */ + public ServiceEntry 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; + } + ServiceEntry serviceEntry = (ServiceEntry) o; + return Objects.equals(this.binaryPath, serviceEntry.binaryPath) && + Objects.equals(this.displayName, serviceEntry.displayName) && + Objects.equals(this.events, serviceEntry.events) && + Objects.equals(this.name, serviceEntry.name) && + Objects.equals(this.serviceType, serviceEntry.serviceType) && + Objects.equals(this.startType, serviceEntry.startType)&& + Objects.equals(this.additionalProperties, serviceEntry.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(binaryPath, displayName, events, name, serviceType, startType, 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 ServiceEntry {\n"); + sb.append(" binaryPath: ").append(toIndentedString(binaryPath)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" serviceType: ").append(toIndentedString(serviceType)).append("\n"); + sb.append(" startType: ").append(toIndentedString(startType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("binary_path", "display_name", "events", "name", "service_type", "start_type")); + + // 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 ServiceEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServiceEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ServiceEntry is not found in the empty JSON string", ServiceEntry.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("binary_path") != null && !jsonObj.get("binary_path").isJsonNull()) && !jsonObj.get("binary_path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `binary_path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_path").toString())); + } + if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull() && !jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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("service_type") != null && !jsonObj.get("service_type").isJsonNull()) && !jsonObj.get("service_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `service_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("service_type").toString())); + } + if ((jsonObj.get("start_type") != null && !jsonObj.get("start_type").isJsonNull()) && !jsonObj.get("start_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServiceEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServiceEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ServiceEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ServiceEntry 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 ServiceEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServiceEntry instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ServiceEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServiceEntry + * @throws IOException if the JSON string is invalid with respect to ServiceEntry + */ + public static ServiceEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServiceEntry.class); + } + + /** + * Convert an instance of ServiceEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StartupInfo.java b/src/main/java/ai/reveng/model/StartupInfo.java new file mode 100644 index 0000000..3497250 --- /dev/null +++ b/src/main/java/ai/reveng/model/StartupInfo.java @@ -0,0 +1,467 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * StartupInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StartupInfo { + public static final String SERIALIZED_NAME_ARGUMENTS = "arguments"; + @SerializedName(SERIALIZED_NAME_ARGUMENTS) + @javax.annotation.Nullable + private String arguments; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private String error; + + public static final String SERIALIZED_NAME_ERROR_CODE = "error_code"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @javax.annotation.Nullable + private String errorCode; + + public static final String SERIALIZED_NAME_PID = "pid"; + @SerializedName(SERIALIZED_NAME_PID) + @javax.annotation.Nullable + private Long pid; + + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nullable + private Long process; + + public static final String SERIALIZED_NAME_PROCESS_NAME = "process_name"; + @SerializedName(SERIALIZED_NAME_PROCESS_NAME) + @javax.annotation.Nullable + private String processName; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private String status; + + public StartupInfo() { + } + + public StartupInfo arguments(@javax.annotation.Nullable String arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get arguments + * @return arguments + */ + @javax.annotation.Nullable + public String getArguments() { + return arguments; + } + + public void setArguments(@javax.annotation.Nullable String arguments) { + this.arguments = arguments; + } + + + public StartupInfo error(@javax.annotation.Nullable String error) { + this.error = error; + return this; + } + + /** + * Get error + * @return error + */ + @javax.annotation.Nullable + public String getError() { + return error; + } + + public void setError(@javax.annotation.Nullable String error) { + this.error = error; + } + + + public StartupInfo errorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + */ + @javax.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + + public StartupInfo pid(@javax.annotation.Nullable Long pid) { + this.pid = pid; + return this; + } + + /** + * Get pid + * @return pid + */ + @javax.annotation.Nullable + public Long getPid() { + return pid; + } + + public void setPid(@javax.annotation.Nullable Long pid) { + this.pid = pid; + } + + + public StartupInfo process(@javax.annotation.Nullable Long process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nullable + public Long getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nullable Long process) { + this.process = process; + } + + + public StartupInfo processName(@javax.annotation.Nullable String processName) { + this.processName = processName; + return this; + } + + /** + * Get processName + * @return processName + */ + @javax.annotation.Nullable + public String getProcessName() { + return processName; + } + + public void setProcessName(@javax.annotation.Nullable String processName) { + this.processName = processName; + } + + + public StartupInfo status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + /** + * 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 StartupInfo instance itself + */ + public StartupInfo 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; + } + StartupInfo startupInfo = (StartupInfo) o; + return Objects.equals(this.arguments, startupInfo.arguments) && + Objects.equals(this.error, startupInfo.error) && + Objects.equals(this.errorCode, startupInfo.errorCode) && + Objects.equals(this.pid, startupInfo.pid) && + Objects.equals(this.process, startupInfo.process) && + Objects.equals(this.processName, startupInfo.processName) && + Objects.equals(this.status, startupInfo.status)&& + Objects.equals(this.additionalProperties, startupInfo.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(arguments, error, errorCode, pid, process, processName, status, 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 StartupInfo {\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append(" processName: ").append(toIndentedString(processName)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("arguments", "error", "error_code", "pid", "process", "process_name", "status")); + + // 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 StartupInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StartupInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in StartupInfo is not found in the empty JSON string", StartupInfo.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("arguments") != null && !jsonObj.get("arguments").isJsonNull()) && !jsonObj.get("arguments").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `arguments` to be a primitive type in the JSON string but got `%s`", jsonObj.get("arguments").toString())); + } + if ((jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) && !jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + if ((jsonObj.get("error_code") != null && !jsonObj.get("error_code").isJsonNull()) && !jsonObj.get("error_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_code").toString())); + } + if ((jsonObj.get("process_name") != null && !jsonObj.get("process_name").isJsonNull()) && !jsonObj.get("process_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `process_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("process_name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StartupInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StartupInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StartupInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StartupInfo 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 StartupInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StartupInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StartupInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of StartupInfo + * @throws IOException if the JSON string is invalid with respect to StartupInfo + */ + public static StartupInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StartupInfo.class); + } + + /** + * Convert an instance of StartupInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Ttp.java b/src/main/java/ai/reveng/model/Ttp.java new file mode 100644 index 0000000..3a2afb6 --- /dev/null +++ b/src/main/java/ai/reveng/model/Ttp.java @@ -0,0 +1,477 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * Ttp + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Ttp { + public static final String SERIALIZED_NAME_ATT_AMPERSAND_CK = "att&ck"; + @SerializedName(SERIALIZED_NAME_ATT_AMPERSAND_CK) + @javax.annotation.Nullable + private List attAmpersandCk; + + public static final String SERIALIZED_NAME_MBC = "mbc"; + @SerializedName(SERIALIZED_NAME_MBC) + @javax.annotation.Nullable + private List mbc; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_PROCESS_SEQIDS = "process_seqids"; + @SerializedName(SERIALIZED_NAME_PROCESS_SEQIDS) + @javax.annotation.Nullable + private List processSeqids; + + public static final String SERIALIZED_NAME_SCORE = "score"; + @SerializedName(SERIALIZED_NAME_SCORE) + @javax.annotation.Nonnull + private Long score; + + public Ttp() { + } + + public Ttp attAmpersandCk(@javax.annotation.Nullable List attAmpersandCk) { + this.attAmpersandCk = attAmpersandCk; + return this; + } + + public Ttp addAttAmpersandCkItem(String attAmpersandCkItem) { + if (this.attAmpersandCk == null) { + this.attAmpersandCk = new ArrayList<>(); + } + this.attAmpersandCk.add(attAmpersandCkItem); + return this; + } + + /** + * Get attAmpersandCk + * @return attAmpersandCk + */ + @javax.annotation.Nullable + public List getAttAmpersandCk() { + return attAmpersandCk; + } + + public void setAttAmpersandCk(@javax.annotation.Nullable List attAmpersandCk) { + this.attAmpersandCk = attAmpersandCk; + } + + + public Ttp mbc(@javax.annotation.Nullable List mbc) { + this.mbc = mbc; + return this; + } + + public Ttp addMbcItem(Object mbcItem) { + if (this.mbc == null) { + this.mbc = new ArrayList<>(); + } + this.mbc.add(mbcItem); + return this; + } + + /** + * Get mbc + * @return mbc + */ + @javax.annotation.Nullable + public List getMbc() { + return mbc; + } + + public void setMbc(@javax.annotation.Nullable List mbc) { + this.mbc = mbc; + } + + + public Ttp name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public Ttp namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get namespace + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public Ttp processSeqids(@javax.annotation.Nullable List processSeqids) { + this.processSeqids = processSeqids; + return this; + } + + public Ttp addProcessSeqidsItem(Long processSeqidsItem) { + if (this.processSeqids == null) { + this.processSeqids = new ArrayList<>(); + } + this.processSeqids.add(processSeqidsItem); + return this; + } + + /** + * Get processSeqids + * @return processSeqids + */ + @javax.annotation.Nullable + public List getProcessSeqids() { + return processSeqids; + } + + public void setProcessSeqids(@javax.annotation.Nullable List processSeqids) { + this.processSeqids = processSeqids; + } + + + public Ttp score(@javax.annotation.Nonnull Long score) { + this.score = score; + return this; + } + + /** + * Get score + * @return score + */ + @javax.annotation.Nonnull + public Long getScore() { + return score; + } + + public void setScore(@javax.annotation.Nonnull Long score) { + this.score = score; + } + + /** + * 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 Ttp instance itself + */ + public Ttp 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; + } + Ttp ttp = (Ttp) o; + return Objects.equals(this.attAmpersandCk, ttp.attAmpersandCk) && + Objects.equals(this.mbc, ttp.mbc) && + Objects.equals(this.name, ttp.name) && + Objects.equals(this.namespace, ttp.namespace) && + Objects.equals(this.processSeqids, ttp.processSeqids) && + Objects.equals(this.score, ttp.score)&& + Objects.equals(this.additionalProperties, ttp.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(attAmpersandCk, mbc, name, namespace, processSeqids, score, 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 Ttp {\n"); + sb.append(" attAmpersandCk: ").append(toIndentedString(attAmpersandCk)).append("\n"); + sb.append(" mbc: ").append(toIndentedString(mbc)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" processSeqids: ").append(toIndentedString(processSeqids)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("att&ck", "mbc", "name", "namespace", "process_seqids", "score")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 Ttp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Ttp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Ttp is not found in the empty JSON string", Ttp.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Ttp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("att&ck") != null && !jsonObj.get("att&ck").isJsonNull() && !jsonObj.get("att&ck").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `att&ck` to be an array in the JSON string but got `%s`", jsonObj.get("att&ck").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("mbc") != null && !jsonObj.get("mbc").isJsonNull() && !jsonObj.get("mbc").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mbc` to be an array in the JSON string but got `%s`", jsonObj.get("mbc").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("process_seqids") != null && !jsonObj.get("process_seqids").isJsonNull() && !jsonObj.get("process_seqids").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `process_seqids` to be an array in the JSON string but got `%s`", jsonObj.get("process_seqids").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Ttp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Ttp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Ttp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Ttp 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 Ttp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Ttp instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Ttp given an JSON string + * + * @param jsonString JSON string + * @return An instance of Ttp + * @throws IOException if the JSON string is invalid with respect to Ttp + */ + public static Ttp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Ttp.class); + } + + /** + * Convert an instance of Ttp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +