rea-agents 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -30
- package/bridge/ghidra/ReaGhidraBridge.java +358 -15
- package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
- package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
- package/dist/android/AndroidTargetSnapshot.js +34 -0
- package/dist/android/JadxAnalysis.js +191 -0
- package/dist/android/JadxConfiguration.js +41 -0
- package/dist/android/JadxMcpTransport.js +145 -0
- package/dist/android/JadxProtocol.js +101 -0
- package/dist/android/JadxProvider.js +170 -0
- package/dist/android/JadxRelease.js +19 -0
- package/dist/android/JadxSession.js +97 -0
- package/dist/application/AnalysisContextQueries.js +2 -1
- package/dist/application/AnalysisProviderEvaluation.js +5 -3
- package/dist/application/AnalysisProviderRegistry.js +2 -1
- package/dist/application/AnalysisSnapshotCache.js +4 -1
- package/dist/application/AnalysisSnapshotFiles.js +1 -1
- package/dist/application/AndroidAnalysisPort.js +1 -0
- package/dist/application/AndroidAnalysisService.js +37 -0
- package/dist/application/ArtifactExtraction.js +7 -4
- package/dist/application/ArtifactGraphConstruction.js +10 -17
- package/dist/application/ArtifactInventory/scanCanonical.js +8 -7
- package/dist/application/BinarySession.js +16 -3
- package/dist/application/BinarySessionExecution.js +4 -1
- package/dist/application/BinarySessionOpen.js +3 -2
- package/dist/application/BinarySessionRecords.js +9 -3
- package/dist/application/BinaryTargetResolver.js +25 -6
- package/dist/application/BrowserObservationService.js +2 -1
- package/dist/application/BrowserScenarioCaptureService.js +2 -1
- package/dist/application/BrowserScenarioEvidence.js +2 -2
- package/dist/application/CallPathTracing.js +2 -1
- package/dist/application/CapabilityInventory.js +18 -0
- package/dist/application/ClientConfigPath.js +3 -1
- package/dist/application/ClientConfigurationDocument.js +11 -1
- package/dist/application/ClientRegistrationStatus.js +8 -1
- package/dist/application/CompositeProvider.js +1 -1
- package/dist/application/DirectAnalysis.js +23 -7
- package/dist/application/DirectAnalysisStatus.js +3 -3
- package/dist/application/Doctor.js +48 -8
- package/dist/application/DoctorDiagnostics.js +7 -5
- package/dist/application/DoctorScope.js +1 -1
- package/dist/application/ElectronActiveEvidence.js +2 -2
- package/dist/application/ElectronActiveObservationService.js +2 -1
- package/dist/application/ElectronBoundaryAnalysis.js +1 -1
- package/dist/application/ElectronObservationService.js +2 -1
- package/dist/application/EnhancedLiteralTracing.js +2 -1
- package/dist/application/EnhancedToolTypes.js +2 -1
- package/dist/application/EnhancedTools.js +3 -1
- package/dist/application/EvidenceBundleCommands.js +2 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/EvidenceInputResolver.js +30 -0
- package/dist/application/EvidenceLedger.js +2 -1
- package/dist/application/FirmwareAnalysisPort.js +1 -0
- package/dist/application/FirmwareAnalysisService.js +35 -0
- package/dist/application/FunctionAnalysisEvidence.js +32 -0
- package/dist/application/InventoryProjectionEvidence.js +2 -1
- package/dist/application/JavaScriptApplicationService.js +50 -3
- package/dist/application/JavaScriptApplicationWorkflowService.js +2 -1
- package/dist/application/JavaScriptArtifactAnalysis.js +4 -2
- package/dist/application/JavaScriptArtifactFiles.js +4 -2
- package/dist/application/JavaScriptArtifactPathResolution.js +6 -2
- package/dist/application/JavaScriptJsonModules.js +3 -2
- package/dist/application/JavaScriptModuleRelationships.js +4 -2
- package/dist/application/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/JavaScriptRuntimeReconciliationService.js +2 -1
- package/dist/application/JavaScriptSemanticGraphProjection.js +1 -1
- package/dist/application/JavaScriptSemanticTraceService.js +2 -1
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LazyAnalysisProvider.js +3 -1
- package/dist/application/LinuxHopper.js +12 -4
- package/dist/application/MacHopper.js +20 -7
- package/dist/application/ManagedApplicationGraphService.js +2 -1
- package/dist/application/ManagedMemberComparisonService.js +3 -1
- package/dist/application/ManagedNativeVerificationService.js +2 -1
- package/dist/application/ManagedReconstructionService.js +2 -1
- package/dist/application/NativeCallRoutes.js +1 -1
- package/dist/application/NativeDispatchMetadataInspection.js +1 -1
- package/dist/application/NativeUiActionTrace.js +2 -1
- package/dist/application/NativeValueTrace.js +1 -1
- package/dist/application/ProcessCaptureError.js +1 -1
- package/dist/application/ProcessCaptureJournal.js +3 -1
- package/dist/application/ProcessCaptureLifecycle.js +6 -3
- package/dist/application/ProcessCli.js +9 -5
- package/dist/application/ProcessEvidence.js +2 -6
- package/dist/application/ProcessHarness.js +3 -2
- package/dist/application/ProcessNormalization.js +12 -5
- package/dist/application/ProcessSampling.js +3 -1
- package/dist/application/ReconstructionCoverageService.js +2 -1
- package/dist/application/ReconstructionObligationLedgerService.js +2 -1
- package/dist/application/ReferenceSourceImportEntries.js +2 -0
- package/dist/application/ReferenceSourceImportPolicy.js +4 -2
- package/dist/application/ReferenceSourceVcsAdapter.js +35 -4
- package/dist/application/SessionProviderRouter.js +4 -1
- package/dist/application/Setup.js +1 -128
- package/dist/application/SetupClientConfiguration.js +17 -6
- package/dist/application/SetupHost.js +111 -0
- package/dist/application/SetupRegistrationEnvironment.js +1 -2
- package/dist/application/SetupSkill.js +9 -3
- package/dist/application/SetupTypes.js +17 -0
- package/dist/application/StoreFileLock.js +7 -2
- package/dist/application/SupportedClients.js +8 -0
- package/dist/application/Uninstall.js +9 -4
- package/dist/application/UpdateRuntime.js +5 -2
- package/dist/application/WindowsCapabilities.js +7 -7
- package/dist/application/runtime.js +3 -1
- package/dist/artifacts/ArtifactProvider.js +3 -1
- package/dist/artifacts/DirectoryArtifactReader.js +2 -0
- package/dist/artifacts/NativeDmgArtifactReader.js +10 -3
- package/dist/artifacts/NibArchive.js +4 -2
- package/dist/artifacts/SafeOutputTree.js +26 -10
- package/dist/artifacts/ZipArtifactReader.js +1 -0
- package/dist/browser/BrowserProcessStartup.js +3 -1
- package/dist/browser/CdpAuthorizedMainFrame.js +1 -1
- package/dist/browser/CdpBrowserProvider.js +4 -1
- package/dist/browser/CdpCaptureDocuments.js +3 -1
- package/dist/browser/CdpCaptureEventHandlers.js +6 -2
- package/dist/browser/CdpCaptureStorageFingerprints.js +1 -1
- package/dist/browser/CdpCaptureValues.js +6 -2
- package/dist/browser/CdpConnection.js +8 -6
- package/dist/browser/CdpElectronInspection.js +3 -3
- package/dist/browser/CdpElectronProvider.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpEndpoint.js +22 -10
- package/dist/browser/CdpObservationSession.js +2 -1
- package/dist/browser/CdpOptionalCommand.js +1 -1
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpSafeMetadata.js +53 -8
- package/dist/browser/CdpScreenshot.js +1 -1
- package/dist/browser/CdpTargetSession.js +8 -5
- package/dist/browser/CdpWebMcpDiscovery.js +1 -1
- package/dist/browser/ElectronFileScope.js +9 -3
- package/dist/browser/JavaScriptRuntimeScope.js +3 -1
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +3 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +1 -1
- package/dist/browser/PlaywrightElectronActiveProvider.js +6 -2
- package/dist/browser/PlaywrightExecutionBoundary.js +1 -1
- package/dist/browser/PlaywrightScenarioArtifacts.js +10 -5
- package/dist/browser/PlaywrightScenarioBrowser.js +3 -1
- package/dist/browser/PlaywrightScenarioEvents.js +6 -2
- package/dist/browser/PlaywrightScenarioSession.js +5 -2
- package/dist/browser/V8InspectorEndpoint.js +2 -1
- package/dist/browser/V8InspectorProvider.js +6 -1
- package/dist/browser/WebSourceMapFetcher.js +24 -11
- package/dist/cli/androidCommands.js +81 -0
- package/dist/{cliApplicationCommands.js → cli/applicationCommands.js} +18 -16
- package/dist/{cliBrowserAdvancedCommands.js → cli/browserAdvancedCommands.js} +13 -16
- package/dist/{cliBrowserCommands.js → cli/browserCommands.js} +9 -9
- package/dist/cli/commandCancellation.js +24 -0
- package/dist/cli/coreAnalysisCommands.js +110 -17
- package/dist/{cliElectronCommands.js → cli/electronCommands.js} +14 -13
- package/dist/cli/firmwareCommands.js +75 -0
- package/dist/{cliSetup.js → cli/interactiveSetup.js} +1 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/managedCommands.js +1 -1
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/options.js +7 -1
- package/dist/{cliProcessCommands.js → cli/processCommands.js} +3 -3
- package/dist/cli/referenceSourceImportStatus.js +10 -0
- package/dist/cli/setupCommands.js +4 -2
- package/dist/cli/utilityCommands.js +3 -2
- package/dist/cli.js +10 -15
- package/dist/cliBrowserContext.js +1 -1
- package/dist/cliBrowserScenarioCommands.js +2 -1
- package/dist/cliCommandNames.js +11 -2
- package/dist/cliEvidenceCommands.js +2 -1
- package/dist/cliJavaScriptRuntimeCommands.js +2 -1
- package/dist/cliJsonInput.js +26 -11
- package/dist/cliLogging.js +2 -1
- package/dist/cliOutput.js +15 -16
- package/dist/config/environment.js +11 -1
- package/dist/config/parseConfig.js +7 -1
- package/dist/config/parsers.js +1 -1
- package/dist/contracts/androidToolContracts.js +77 -0
- package/dist/contracts/applicationToolContracts.js +32 -5
- package/dist/contracts/applicationWorkflowInputContracts.js +13 -13
- package/dist/contracts/artifactComparisonExample.js +7 -14
- package/dist/contracts/enhancedToolContracts.js +31 -0
- package/dist/contracts/errorSchemas.js +4 -2
- package/dist/contracts/evidenceInputContracts.js +13 -0
- package/dist/contracts/firmwareToolContracts.js +38 -0
- package/dist/contracts/officialToolContracts.js +66 -0
- package/dist/contracts/promptContracts.js +1 -1
- package/dist/contracts/sessionLifecycleInputs.js +4 -0
- package/dist/contracts/sessionToolContracts.js +43 -0
- package/dist/contracts/sessionToolSchemas.js +1 -1
- package/dist/contracts/toolContractExamples.js +5 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +7 -130
- package/dist/contracts/toolEffects.js +43 -0
- package/dist/contracts/toolOutputSchemaGroups.js +4 -0
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -0
- package/dist/doctorRuntime.js +5 -1
- package/dist/domain/analysisErrorBase.js +33 -0
- package/dist/domain/analysisErrorCore.js +60 -0
- package/dist/domain/analysisErrorPresentation.js +22 -2
- package/dist/domain/analysisErrorProjection.js +24 -3
- package/dist/domain/analysisSnapshot.js +1 -0
- package/dist/domain/androidAnalysis.js +141 -0
- package/dist/domain/appleAssetCatalog.js +1 -1
- package/dist/domain/artifactGraph.js +1 -0
- package/dist/domain/artifactInspection.js +19 -17
- package/dist/domain/artifactInventoryEvidence.js +20 -25
- package/dist/domain/artifactOperationError.js +16 -0
- package/dist/domain/browserObservation.js +12 -4
- package/dist/domain/browserObservationError.js +23 -0
- package/dist/domain/browserScenario.js +1 -1
- package/dist/domain/browserScenarioCapture.js +1 -1
- package/dist/domain/browserScenarioDiff.js +1 -1
- package/dist/domain/browserScenarioNormalization.js +6 -11
- package/dist/domain/browserScenarioValues.js +3 -1
- package/dist/domain/callPath.js +47 -7
- package/dist/domain/canonicalDigest.js +65 -0
- package/dist/domain/canonicalOrdering.js +11 -0
- package/dist/domain/changedBehavior.js +8 -7
- package/dist/domain/comparisonSemantics.js +2 -4
- package/dist/domain/configurationErrors.js +25 -0
- package/dist/domain/dosCom.js +8 -0
- package/dist/domain/electronActiveObservation.js +3 -1
- package/dist/domain/electronStaticAnalysisBrowser.js +13 -23
- package/dist/domain/electronStaticAnalysisNative.js +2 -1
- package/dist/domain/electronStaticAnalysisValues.js +23 -3
- package/dist/domain/evidence.js +3 -11
- package/dist/domain/evidenceErrors.js +30 -0
- package/dist/domain/firmwareAnalysis.js +121 -0
- package/dist/domain/functionComparison.js +4 -2
- package/dist/domain/functionComparisonDimensions.js +6 -4
- package/dist/domain/functionComparisonNormalization.js +8 -1
- package/dist/domain/functionComparisonResults.js +1 -4
- package/dist/domain/hopperErrors.js +78 -0
- package/dist/domain/hopperValues.js +2 -1
- package/dist/domain/interfaceBuilderGraph.js +3 -1
- package/dist/domain/javascriptApplicationChangeGraph.js +2 -2
- package/dist/domain/javascriptApplicationGraph.js +13 -22
- package/dist/domain/javascriptApplicationVersionComparison.js +3 -11
- package/dist/domain/javascriptApplicationVersionItems.js +3 -3
- package/dist/domain/javascriptApplicationVersionKeys.js +1 -1
- package/dist/domain/javascriptAstFingerprint.js +1 -1
- package/dist/domain/javascriptExportShapeComparison.js +1 -2
- package/dist/domain/javascriptExportShapeSelection.js +1 -1
- package/dist/domain/javascriptExportShapeVariants.js +7 -3
- package/dist/domain/javascriptFeatureSeed.js +29 -9
- package/dist/domain/javascriptFeatureTrace.js +9 -13
- package/dist/domain/javascriptFeatureTraversal.js +2 -1
- package/dist/domain/javascriptNativeHandoff.js +2 -1
- package/dist/domain/javascriptRuntimeLoadState.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationActive.js +3 -10
- package/dist/domain/javascriptRuntimeReconciliationGraph.js +2 -2
- package/dist/domain/javascriptRuntimeReconciliationMatching.js +4 -3
- package/dist/domain/javascriptRuntimeReconciliationParsing.js +8 -14
- package/dist/domain/javascriptRuntimeReconciliationResult.js +4 -4
- package/dist/domain/javascriptRuntimeReconciliationSchemas.js +5 -2
- package/dist/domain/javascriptRuntimeStaticCandidates.js +8 -4
- package/dist/domain/javascriptSemanticAnalysis.js +40 -3
- package/dist/domain/javascriptSemanticCallResolution.js +2 -1
- package/dist/domain/javascriptSemanticChildProcesses.js +2 -1
- package/dist/domain/javascriptSemanticDataEffects.js +2 -1
- package/dist/domain/javascriptSemanticFingerprints.js +1 -1
- package/dist/domain/javascriptSemanticGraph.js +23 -28
- package/dist/domain/javascriptSemanticPrimitives.js +9 -2
- package/dist/domain/javascriptSemanticProjection.js +2 -1
- package/dist/domain/javascriptSemanticPromises.js +2 -1
- package/dist/domain/javascriptSemanticProvenance.js +1 -1
- package/dist/domain/javascriptSemanticQuery.js +7 -8
- package/dist/domain/javascriptSemanticQueryAssessment.js +1 -2
- package/dist/domain/javascriptSemanticQueryIdentity.js +1 -2
- package/dist/domain/javascriptSemanticReturns.js +2 -1
- package/dist/domain/javascriptSemanticValues.js +50 -16
- package/dist/domain/javascriptSourceParser.js +4 -2
- package/dist/domain/javascriptStaticAnalysis.js +1 -1
- package/dist/domain/javascriptStaticAnalysisBundler.js +2 -1
- package/dist/domain/javascriptStaticAnalysisCalls.js +14 -6
- package/dist/domain/javascriptStaticAnalysisHelpers.js +31 -4
- package/dist/domain/jsonShape.js +6 -2
- package/dist/domain/managedMemberComparison.js +1 -0
- package/dist/domain/managedMemberComparisonItems.js +2 -0
- package/dist/domain/managedNativeVerificationMatch.js +5 -3
- package/dist/domain/nativeDataType.js +2 -0
- package/dist/domain/nativeFunctionAnnotations.js +43 -0
- package/dist/domain/nativeLoadImage.js +95 -0
- package/dist/domain/nativeMetadataRecovery.js +55 -0
- package/dist/domain/processCapture.js +0 -1
- package/dist/domain/processEvidenceProvider.js +11 -0
- package/dist/domain/processTraceComparison.js +1 -1
- package/dist/domain/providerAdapterError.js +17 -0
- package/dist/domain/providerCleanupError.js +1 -1
- package/dist/domain/providerSelectionError.js +44 -0
- package/dist/domain/reconstructionUnknowns.js +1 -1
- package/dist/domain/reconstructionVerification.js +22 -8
- package/dist/domain/referenceSourceClassification.js +5 -6
- package/dist/domain/referenceSourceGraph.js +9 -17
- package/dist/domain/referenceSourceImportParsing.js +38 -23
- package/dist/domain/runtimeIdentification.js +1 -1
- package/dist/domain/runtimeVersion.js +4 -7
- package/dist/domain/safeJson.js +13 -0
- package/dist/domain/sourceToBundleComparison.js +5 -7
- package/dist/domain/sourceToBundleSignals.js +6 -6
- package/dist/domain/staticRuntimeCorrelation.js +9 -7
- package/dist/domain/unknownRegistryError.js +10 -0
- package/dist/domain/webBundleAnalyzerAst.js +22 -5
- package/dist/domain/webBundleAnalyzerInspection.js +20 -14
- package/dist/dotnet/ManagedMemberRows.js +1 -1
- package/dist/dotnet/ManagedMetadataHeaps.js +3 -2
- package/dist/dotnet/ManagedMetadataInventoryRows.js +4 -2
- package/dist/dotnet/ManagedMethodBodyReader.js +8 -1
- package/dist/dotnet/ManagedStaticProvider.js +3 -1
- package/dist/firmware/FirmwareCommand.js +163 -0
- package/dist/firmware/FirmwareFiles.js +190 -0
- package/dist/firmware/FirmwareProvider.js +258 -0
- package/dist/firmware/FirmwarePublication.js +84 -0
- package/dist/firmware/FirmwareRelease.js +32 -0
- package/dist/firmware/FirmwareReports.js +223 -0
- package/dist/generatedMcpToolCatalog.js +1 -1
- package/dist/generatedPackageMetadata.js +5 -5
- package/dist/ghidra/GhidraAnalysisProfile.js +37 -8
- package/dist/ghidra/GhidraClient.js +52 -6
- package/dist/ghidra/GhidraDiagnostics.js +3 -0
- package/dist/ghidra/GhidraDoctor.js +38 -14
- package/dist/ghidra/GhidraFunctionValues.js +10 -4
- package/dist/ghidra/GhidraInstallation.js +10 -4
- package/dist/ghidra/GhidraInventoryValues.js +39 -2
- package/dist/ghidra/GhidraLauncher.js +91 -26
- package/dist/ghidra/GhidraLoadImageValues.js +199 -0
- package/dist/ghidra/GhidraProvider.js +129 -13
- package/dist/ghidra/GhidraProviderCapabilities.js +52 -15
- package/dist/ghidra/GhidraRequestQueue.js +2 -2
- package/dist/ghidra/GhidraSessionError.js +31 -4
- package/dist/ghidra/GhidraSessionValues.js +10 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +16 -2
- package/dist/ghidra/GhidraTransport.js +12 -0
- package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
- package/dist/ghidra/extensions/GhidraExtensions.js +170 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +21 -0
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +84 -0
- package/dist/hopper/BridgeLauncher.js +4 -2
- package/dist/hopper/HopperAnalysisProfile.js +7 -2
- package/dist/hopper/HopperCleanup.js +55 -9
- package/dist/hopper/HopperClient.js +14 -4
- package/dist/hopper/HopperProcessDiagnostic.js +1 -1
- package/dist/hopper/HopperProvider.js +8 -4
- package/dist/hopper/HopperRequestQueue.js +7 -3
- package/dist/hopper/HopperSessionValues.js +1 -1
- package/dist/hopper/HopperSocketConnection.js +1 -1
- package/dist/hopper/HopperTargetLease.js +23 -15
- package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +7 -8
- package/dist/hopper/LinuxPrivateDisplayProbe.js +6 -2
- package/dist/hopper/protocol.js +8 -8
- package/dist/ida/IdaConfiguration.js +56 -0
- package/dist/ida/IdaDoctor.js +53 -0
- package/dist/ida/IdaInput.js +62 -0
- package/dist/ida/IdaMcpConnection.js +111 -0
- package/dist/ida/IdaOperationRunner.js +299 -0
- package/dist/ida/IdaProtocolValues.js +178 -0
- package/dist/ida/IdaProvider.js +126 -0
- package/dist/ida/IdaProviderCapabilities.js +60 -0
- package/dist/ida/IdaSessionClient.js +306 -0
- package/dist/ida/IdaWorkspace.js +54 -0
- package/dist/main/shutdown.js +21 -1
- package/dist/main/startup.js +1 -1
- package/dist/main/transport.js +8 -4
- package/dist/main.js +5 -2
- package/dist/native/AppleDispatchMetadata.js +31 -10
- package/dist/native/NativeMacOSProvider.js +87 -15
- package/dist/native/NativeMachoInspection.js +42 -12
- package/dist/native/NativeUiHelperRuntime.js +7 -1
- package/dist/native/NativeUiObservation.js +6 -2
- package/dist/native/parsers/demangle.js +1 -1
- package/dist/native/parsers/dyldInfo.js +3 -3
- package/dist/native/parsers/otool.js +4 -1
- package/dist/native/parsers/plist.js +11 -3
- package/dist/process/PrivateRuntimeRoot.js +13 -3
- package/dist/process/ProcessOwnership.js +5 -73
- package/dist/process/ProcessOwnershipObservation.js +62 -2
- package/dist/process/ProcessOwnershipProcessTree.js +13 -0
- package/dist/process/ProviderProcess.js +24 -7
- package/dist/process/ProviderRunLineage.js +1 -1
- package/dist/process/WindowsAuthority.js +20 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +1 -0
- package/dist/server/createServer.js +25 -2
- package/dist/server/mcpProgress.js +2 -1
- package/dist/server/promptCompletion.js +3 -3
- package/dist/server/registerAndroidTools.js +30 -0
- package/dist/server/registerApplicationTools/compareExportShapes.js +5 -1
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +7 -2
- package/dist/server/registerApplicationTools/compareVersions.js +5 -1
- package/dist/server/registerApplicationTools/traceFeature.js +7 -2
- package/dist/server/registerApplicationTools/traceSemantics.js +7 -2
- package/dist/server/registerEnhancedTools.js +28 -1
- package/dist/server/registerFirmwareTools.js +22 -0
- package/dist/server/registerFunctionComparisonTool.js +1 -1
- package/dist/server/registerInvestigationTools/helpers.js +2 -1
- package/dist/server/registerManagedTools.js +1 -1
- package/dist/server/registerManagedWorkflowTools/evidence.js +1 -1
- package/dist/server/registerOfficialTools.js +4 -1
- package/dist/server/registerProcessComparisonTool.js +5 -2
- package/dist/server/registerSessionTools.js +3 -1
- package/dist/server/runDerivedOperation.js +1 -1
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/sessionEvidence.js +1 -1
- package/dist/server/toolResult.js +2 -1
- package/dist/windows/WindowsNativeLoader.js +108 -0
- package/dist/windows/WindowsOwnedProcess.js +168 -0
- package/dist/windows/WindowsPrivateRuntime.js +137 -0
- package/install.sh +4 -6
- package/native/windows/README.md +102 -0
- package/native/windows/build/manifest.json +9 -0
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +38 -24
- package/scripts/rea.mjs +1 -1
- package/scripts/verify-windows-native-artifact.mjs +39 -0
- package/skills/reverse-engineer-anything/SKILL.md +92 -24
- package/skills/reverse-engineer-anything/references/android-applications.md +31 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +19 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +52 -4
- package/dist/browser/CdpCanonicalJsonDigest.js +0 -9
- package/dist/domain/errors.js +0 -324
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** Generated from package.json and package-lock.json; do not edit. */
|
|
2
2
|
export const PACKAGE_METADATA = {
|
|
3
3
|
name: "rea-agents",
|
|
4
|
-
version: "4.
|
|
5
|
-
serverSdkVersion: "2.
|
|
6
|
-
clientSdkVersion: "2.
|
|
7
|
-
coreSdkVersion: "2.
|
|
8
|
-
skillVersion: "
|
|
4
|
+
version: "4.1.0", // x-release-please-version
|
|
5
|
+
serverSdkVersion: "2.3.1",
|
|
6
|
+
clientSdkVersion: "2.3.1",
|
|
7
|
+
coreSdkVersion: "2.3.1",
|
|
8
|
+
skillVersion: "26",
|
|
9
9
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createAnalysisProfile } from "../domain/analysisProfile.js";
|
|
2
|
-
import { AnalysisCancelledError
|
|
2
|
+
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
|
3
|
+
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
|
4
|
+
import {} from "../domain/analysisErrorBase.js";
|
|
3
5
|
import { err, ok } from "../domain/result.js";
|
|
4
6
|
/** Resolve version-bound, deterministic semantics before Ghidra imports a target. */
|
|
5
7
|
export const resolveGhidraAnalysisProfile = (target, identity, installation, signal) => {
|
|
@@ -11,6 +13,8 @@ export const resolveGhidraAnalysisProfile = (target, identity, installation, sig
|
|
|
11
13
|
return Promise.resolve(err(new ProviderAdapterError(identity.id, "resolve_analysis_profile")));
|
|
12
14
|
const provider = { ...identity, version: installation.providerVersion };
|
|
13
15
|
const dosMz = target.format === "dos-mz";
|
|
16
|
+
const dosCom = target.format === "dos-com";
|
|
17
|
+
const dos = dosMz || dosCom;
|
|
14
18
|
return Promise.resolve(ok({
|
|
15
19
|
profile: createAnalysisProfile(provider, {
|
|
16
20
|
target_kind: target.kind,
|
|
@@ -19,24 +23,49 @@ export const resolveGhidraAnalysisProfile = (target, identity, installation, sig
|
|
|
19
23
|
available_architectures: [
|
|
20
24
|
...(target.availableArchitectures ?? []),
|
|
21
25
|
].sort(),
|
|
22
|
-
import_mode: "ephemeral-
|
|
26
|
+
import_mode: "ephemeral-source-immutable",
|
|
27
|
+
annotation_policy: "atomic-function-entry-metadata-v1",
|
|
28
|
+
load_image_observations: "source-mappings-entry-context-v2",
|
|
23
29
|
function_body_evidence: "complete-inclusive-ranges-v1",
|
|
30
|
+
...(dos
|
|
31
|
+
? {
|
|
32
|
+
load_image_evidence: dosCom
|
|
33
|
+
? "independent-com-mapping-context-v1"
|
|
34
|
+
: "independent-mz-mapping-relocations-v1",
|
|
35
|
+
}
|
|
36
|
+
: {}),
|
|
24
37
|
jump_table_evidence: "typed-case-default-blocks-v1",
|
|
25
38
|
decompiler_jump_loads: true,
|
|
26
|
-
loader: dosMz
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
loader: dosMz
|
|
40
|
+
? "MzLoader"
|
|
41
|
+
: dosCom
|
|
42
|
+
? "BinaryLoader"
|
|
43
|
+
: "auto-from-header",
|
|
44
|
+
language_id: dos ? "x86:LE:16:Real Mode" : "auto-from-header",
|
|
45
|
+
compiler_spec_id: dos ? "default" : "auto-default",
|
|
46
|
+
...(dos
|
|
30
47
|
? {
|
|
31
48
|
load_segment: "0x1000",
|
|
32
49
|
address_coordinates: "linear-byte-offset",
|
|
33
50
|
}
|
|
34
51
|
: {}),
|
|
52
|
+
...(dosCom
|
|
53
|
+
? {
|
|
54
|
+
entry_offset: "0x100",
|
|
55
|
+
register_context: {
|
|
56
|
+
CS: "0x1000",
|
|
57
|
+
DS: "0x1000",
|
|
58
|
+
ES: "0x1000",
|
|
59
|
+
SS: "0x1000",
|
|
60
|
+
},
|
|
61
|
+
entry_seed: "external-entry-and-function-before-analysis-v1",
|
|
62
|
+
}
|
|
63
|
+
: {}),
|
|
35
64
|
analyzer_preset: "ghidra-default",
|
|
36
65
|
}),
|
|
37
66
|
compatibility: {
|
|
38
|
-
languageId:
|
|
39
|
-
compilerSpecId:
|
|
67
|
+
languageId: dos ? "x86:LE:16:Real Mode" : "auto",
|
|
68
|
+
compilerSpecId: dos ? "default" : "auto",
|
|
40
69
|
},
|
|
41
70
|
}));
|
|
42
71
|
};
|
|
@@ -16,12 +16,13 @@ import { GhidraRequestQueue } from "./GhidraRequestQueue.js";
|
|
|
16
16
|
import { bindGhidraSessionFailure, GhidraSessionError, } from "./GhidraSessionError.js";
|
|
17
17
|
import { isGhidraShutdownAcknowledgement, parseGhidraSessionInfo, } from "./GhidraSessionValues.js";
|
|
18
18
|
import { createGhidraTargetSnapshot } from "./GhidraTargetSnapshot.js";
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
19
20
|
import { connectGhidraSocket } from "./GhidraSocketConnection.js";
|
|
20
21
|
import { GhidraWire } from "./GhidraClientWire.js";
|
|
21
22
|
import { completeGhidraStartupHandshake } from "./GhidraClientStartup.js";
|
|
22
23
|
const SHUTDOWN_TIMEOUT_MS = 10_000;
|
|
23
24
|
const SESSION_ROOT = tmpdir();
|
|
24
|
-
/** Owns
|
|
25
|
+
/** Owns an authenticated private Ghidra session with transport-bound mutation authority. */
|
|
25
26
|
export class GhidraClient {
|
|
26
27
|
#options;
|
|
27
28
|
#logger;
|
|
@@ -32,7 +33,10 @@ export class GhidraClient {
|
|
|
32
33
|
#process;
|
|
33
34
|
#runtimeRoot;
|
|
34
35
|
#snapshotPath;
|
|
36
|
+
#targetAdmission;
|
|
35
37
|
#token;
|
|
38
|
+
// Retain authentication identities for diagnostics from late request settlement.
|
|
39
|
+
#authenticationTokens = new Set();
|
|
36
40
|
#runId;
|
|
37
41
|
#lineage = new ProviderRunLineage();
|
|
38
42
|
#nextId = 1;
|
|
@@ -42,7 +46,7 @@ export class GhidraClient {
|
|
|
42
46
|
#startupController;
|
|
43
47
|
#startPromise;
|
|
44
48
|
#closePromise;
|
|
45
|
-
#failure = bindGhidraSessionFailure(() => this.#diagnostics());
|
|
49
|
+
#failure = bindGhidraSessionFailure(() => this.#diagnostics(), (value) => this.#redactAuthentication(value));
|
|
46
50
|
#wire;
|
|
47
51
|
#requestQueue;
|
|
48
52
|
#responseRouter = new GhidraResponseRouter({
|
|
@@ -68,6 +72,7 @@ export class GhidraClient {
|
|
|
68
72
|
this.#options = {
|
|
69
73
|
...options,
|
|
70
74
|
startupTimeoutMs: options.startupTimeoutMs ?? GHIDRA_STARTUP_TIMEOUT_MS,
|
|
75
|
+
platform: options.platform ?? process.platform,
|
|
71
76
|
transport: options.transport ?? "unix-socket",
|
|
72
77
|
};
|
|
73
78
|
this.#logger = options.logger ?? silentLogger;
|
|
@@ -108,7 +113,10 @@ export class GhidraClient {
|
|
|
108
113
|
signal?.removeEventListener("abort", onAbort);
|
|
109
114
|
if (!result.ok)
|
|
110
115
|
reset();
|
|
111
|
-
},
|
|
116
|
+
}, (cause) => {
|
|
117
|
+
this.#logger.debug({ error: cause instanceof Error ? cause.message : String(cause) }, "Ghidra startup promise rejected during bookkeeping");
|
|
118
|
+
reset();
|
|
119
|
+
});
|
|
112
120
|
return started;
|
|
113
121
|
}
|
|
114
122
|
/** Revalidate live bridge, provider, run, and profile metadata. */
|
|
@@ -128,6 +136,17 @@ export class GhidraClient {
|
|
|
128
136
|
return started;
|
|
129
137
|
return this.#requestQueue.run(operation, parameters, options.signal === undefined ? {} : { signal: options.signal });
|
|
130
138
|
}
|
|
139
|
+
/** Read the private immutable source for independent import verification. */
|
|
140
|
+
async readTargetSnapshot() {
|
|
141
|
+
if (this.#snapshotPath === undefined)
|
|
142
|
+
return err(this.#failure("protocol", "Ghidra target snapshot is unavailable before startup or after close"));
|
|
143
|
+
try {
|
|
144
|
+
return ok(await readFile(this.#snapshotPath));
|
|
145
|
+
}
|
|
146
|
+
catch (cause) {
|
|
147
|
+
return err(this.#failure("protocol", "Ghidra target snapshot could not be read for load-image verification", cause));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
131
150
|
/** Stop the owned process group and remove all project/runtime artifacts. */
|
|
132
151
|
close() {
|
|
133
152
|
return this.#requestClose(false);
|
|
@@ -171,6 +190,7 @@ export class GhidraClient {
|
|
|
171
190
|
this.#runtimeRoot = await PrivateRuntimeRoot.create({
|
|
172
191
|
parent: SESSION_ROOT,
|
|
173
192
|
prefix: "rea-ghidra-",
|
|
193
|
+
platform: this.#options.platform,
|
|
174
194
|
});
|
|
175
195
|
}
|
|
176
196
|
catch (cause) {
|
|
@@ -185,10 +205,13 @@ export class GhidraClient {
|
|
|
185
205
|
: "bridge-endpoint.json"),
|
|
186
206
|
};
|
|
187
207
|
try {
|
|
188
|
-
const snapshot = await createGhidraTargetSnapshot(this.#options.targetPath, this.#runtimeRoot.path, this.#options.targetSha256);
|
|
208
|
+
const snapshot = await createGhidraTargetSnapshot(this.#options.targetPath, this.#runtimeRoot.path, this.#options.targetSha256, { signal: deadline.signal, platform: this.#options.platform });
|
|
189
209
|
this.#snapshotPath = snapshot.path;
|
|
210
|
+
this.#targetAdmission = snapshot.admission;
|
|
190
211
|
}
|
|
191
212
|
catch (cause) {
|
|
213
|
+
if (deadline.signal.aborted)
|
|
214
|
+
return this.#startupInterrupted(deadline);
|
|
192
215
|
const failure = this.#failure("start", "Ghidra target snapshot failed admission", cause);
|
|
193
216
|
await this.#cleanup();
|
|
194
217
|
return err(failure);
|
|
@@ -196,6 +219,7 @@ export class GhidraClient {
|
|
|
196
219
|
if (deadline.signal.aborted)
|
|
197
220
|
return this.#startupInterrupted(deadline);
|
|
198
221
|
this.#token = randomBytes(32).toString("hex");
|
|
222
|
+
this.#authenticationTokens.add(this.#token);
|
|
199
223
|
this.#lineage.reset();
|
|
200
224
|
this.#runId = this.#options.runId ?? randomUUID();
|
|
201
225
|
const launched = await this.#options.launcher
|
|
@@ -270,9 +294,13 @@ export class GhidraClient {
|
|
|
270
294
|
return err(this.#failure("protocol", "Ghidra run identity is missing"));
|
|
271
295
|
const parsed = parseGhidraSessionInfo(value, {
|
|
272
296
|
runId,
|
|
297
|
+
expectedReadOnly: this.#options.transport === "authenticated-loopback-tcp",
|
|
273
298
|
providerVersion: this.#options.providerVersion,
|
|
274
299
|
profileDigest: this.#options.profileDigest,
|
|
275
300
|
targetSha256: this.#options.targetSha256,
|
|
301
|
+
...(this.#targetAdmission === undefined
|
|
302
|
+
? {}
|
|
303
|
+
: { targetAdmission: this.#targetAdmission }),
|
|
276
304
|
...(this.#options.expectedLanguageId === undefined
|
|
277
305
|
? {}
|
|
278
306
|
: { expectedLanguageId: this.#options.expectedLanguageId }),
|
|
@@ -286,6 +314,7 @@ export class GhidraClient {
|
|
|
286
314
|
}
|
|
287
315
|
async #close(starting, controller, forceStop) {
|
|
288
316
|
try {
|
|
317
|
+
// best-effort cleanup: a rejected startup must not mask close/cleanup.
|
|
289
318
|
await starting?.catch(() => undefined);
|
|
290
319
|
await this.#cleanup(forceStop);
|
|
291
320
|
}
|
|
@@ -306,9 +335,18 @@ export class GhidraClient {
|
|
|
306
335
|
if (!forceStop && socket !== undefined && !socket.destroyed) {
|
|
307
336
|
const shutdown = await this.#wire
|
|
308
337
|
.request("shutdown", {}, { timeoutMs: SHUTDOWN_TIMEOUT_MS })
|
|
309
|
-
.catch(() => err(this.#failure("process", "Ghidra shutdown request failed")));
|
|
338
|
+
.catch((cause) => err(this.#failure("process", "Ghidra shutdown request failed", cause)));
|
|
310
339
|
if (!shutdown.ok || !isGhidraShutdownAcknowledgement(shutdown.value))
|
|
311
|
-
this.#logger.warn({
|
|
340
|
+
this.#logger.warn({
|
|
341
|
+
status: shutdown.ok ? "invalid-acknowledgement" : "failed",
|
|
342
|
+
...(shutdown.ok
|
|
343
|
+
? {}
|
|
344
|
+
: {
|
|
345
|
+
kind: shutdown.error.kind,
|
|
346
|
+
message: shutdown.error.message,
|
|
347
|
+
diagnostics: shutdown.error.diagnostics,
|
|
348
|
+
}),
|
|
349
|
+
}, "Ghidra bridge shutdown was not confirmed");
|
|
312
350
|
}
|
|
313
351
|
this.#failAll(this.#failure("process", "Ghidra session closed"));
|
|
314
352
|
this.#detachSocket?.();
|
|
@@ -355,6 +393,11 @@ export class GhidraClient {
|
|
|
355
393
|
this.#closing = false;
|
|
356
394
|
}
|
|
357
395
|
}
|
|
396
|
+
#redactAuthentication(value) {
|
|
397
|
+
for (const token of this.#authenticationTokens)
|
|
398
|
+
value = value.replaceAll(token, "[REDACTED]");
|
|
399
|
+
return value;
|
|
400
|
+
}
|
|
358
401
|
#onProcessDiagnostic(event) {
|
|
359
402
|
if (event.type === "output") {
|
|
360
403
|
this.#options.onDiagnostic?.({
|
|
@@ -402,6 +445,9 @@ export class GhidraClient {
|
|
|
402
445
|
return createGhidraDiagnostics({
|
|
403
446
|
targetPath: this.#options.targetPath,
|
|
404
447
|
targetSha256: this.#options.targetSha256,
|
|
448
|
+
...(this.#targetAdmission === undefined
|
|
449
|
+
? {}
|
|
450
|
+
: { targetAdmission: this.#targetAdmission }),
|
|
405
451
|
transport: this.#options.transport,
|
|
406
452
|
providerVersion: this.#options.providerVersion,
|
|
407
453
|
profileDigest: this.#options.profileDigest,
|
|
@@ -11,6 +11,9 @@ export const createGhidraDiagnostics = (options) => {
|
|
|
11
11
|
return {
|
|
12
12
|
target_path: options.targetPath,
|
|
13
13
|
target_sha256: options.targetSha256,
|
|
14
|
+
...(options.targetAdmission === undefined
|
|
15
|
+
? {}
|
|
16
|
+
: { target_admission: options.targetAdmission }),
|
|
14
17
|
transport: options.transport,
|
|
15
18
|
provider_version: options.providerVersion,
|
|
16
19
|
profile_digest: options.profileDigest,
|
|
@@ -1,18 +1,42 @@
|
|
|
1
|
+
import { hasWindowsNativeAuthority, windowsNativeAuthorityUnavailableReason, } from "../process/WindowsAuthority.js";
|
|
1
2
|
import { inspectGhidraInstallation, } from "./GhidraInstallation.js";
|
|
2
|
-
/** Project
|
|
3
|
-
export const projectGhidraDoctorInspection = (inspection) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
/** Project installation and runtime-authority facts into the doctor contract. */
|
|
4
|
+
export const projectGhidraDoctorInspection = (inspection) => {
|
|
5
|
+
const windowsAuthorityUnavailable = inspection.status === "available" &&
|
|
6
|
+
inspection.platform === "win32" &&
|
|
7
|
+
!hasWindowsNativeAuthority(inspection.platform);
|
|
8
|
+
return {
|
|
9
|
+
id: "ghidra",
|
|
10
|
+
configured: inspection.installDir !== null,
|
|
11
|
+
available: inspection.status === "available" && !windowsAuthorityUnavailable,
|
|
12
|
+
providerVersion: inspection.providerVersion,
|
|
13
|
+
registrationEnvironment: inspection.status === "available"
|
|
14
|
+
? {
|
|
15
|
+
GHIDRA_INSTALL_DIR: inspection.installDir,
|
|
16
|
+
JAVA_HOME: inspection.javaHome,
|
|
17
|
+
}
|
|
18
|
+
: {},
|
|
19
|
+
checks: [
|
|
20
|
+
...selectedChecks(inspection).map((check) => projectCheck(check, inspection.installDir !== null)),
|
|
21
|
+
...(inspection.status === "available" && inspection.platform === "win32"
|
|
22
|
+
? [
|
|
23
|
+
{
|
|
24
|
+
name: "native_authority",
|
|
25
|
+
ok: !windowsAuthorityUnavailable,
|
|
26
|
+
code: windowsAuthorityUnavailable ? "unsupported_host" : null,
|
|
27
|
+
detail: windowsAuthorityUnavailable
|
|
28
|
+
? windowsNativeAuthorityUnavailableReason(inspection.platform)
|
|
29
|
+
: "Verified Windows native Job Object, private DACL, and reparse-safe handle controls; local NTFS only.",
|
|
30
|
+
remediation: windowsAuthorityUnavailable
|
|
31
|
+
? "Use the matching Windows x64 REA package with its bundled native addon and a writable local NTFS temporary directory. The native failure above identifies the failed constraint; Ghidra installation or registration changes cannot enable a missing native backend."
|
|
32
|
+
: null,
|
|
33
|
+
classification: "unsupported_host",
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
: []),
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
};
|
|
16
40
|
/** Inspect the process-configured BYO Ghidra installation for `rea doctor`. */
|
|
17
41
|
export const inspectSystemGhidraProvider = () => Promise.resolve(projectGhidraDoctorInspection(inspectGhidraInstallation({
|
|
18
42
|
...(process.env.GHIDRA_INSTALL_DIR === undefined
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { nativeFunctionAnnotationsInputSchema, nativeFunctionAnnotationsSchema, } from "../domain/nativeFunctionAnnotations.js";
|
|
2
3
|
import { nativeDataTypeSchema } from "../domain/nativeDataType.js";
|
|
3
4
|
import { nativeInstructionSchema, nativeCallTargetsSchema, } from "../domain/nativeInstruction.js";
|
|
4
|
-
import { AnalysisInputError, AnalysisOutputError } from "../domain/
|
|
5
|
+
import { AnalysisInputError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
5
6
|
import { functionBodyEntryAgrees, functionInstructionWindowSchema, functionDossierSchema, } from "../domain/hopperValues.js";
|
|
6
|
-
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
|
7
|
+
import { jsonObjectSchema, jsonValueSchema, } from "../domain/jsonValue.js";
|
|
7
8
|
import { nativeApiBoundarySchema } from "../domain/nativeApiBoundary.js";
|
|
8
9
|
import { nativeValueFlowSchema } from "../domain/nativeValueFlow.js";
|
|
9
10
|
import { err, ok } from "../domain/result.js";
|
|
10
11
|
import { ghidraIdentifierSchema, ghidraCanonicalAddressSchema, ghidraFunctionClassificationSchema as classification, ghidraFunctionBodySchema as ghidraFunctionBody, ghidraProcedureIdentitySchema as procedureIdentity, } from "./GhidraInventoryValues.js";
|
|
11
|
-
/**
|
|
12
|
+
/** Function analysis and annotation operations admitted by the Ghidra adapter. */
|
|
12
13
|
export const GHIDRA_FUNCTION_OPERATIONS = [
|
|
14
|
+
"annotate_native_function",
|
|
13
15
|
"inspect_native_data_type",
|
|
14
16
|
"inspect_native_instruction",
|
|
15
17
|
"resolve_native_call_targets",
|
|
@@ -30,6 +32,7 @@ const document = ghidraIdentifierSchema.nullable().default(null);
|
|
|
30
32
|
const procedure = ghidraIdentifierSchema;
|
|
31
33
|
const directProcedure = { document, procedure };
|
|
32
34
|
const inputSchemas = {
|
|
35
|
+
annotate_native_function: nativeFunctionAnnotationsInputSchema,
|
|
33
36
|
inspect_native_data_type: z
|
|
34
37
|
.object({
|
|
35
38
|
document,
|
|
@@ -265,6 +268,9 @@ const ghidraFunctionInstructionWindow = functionInstructionWindowSchema
|
|
|
265
268
|
.extend({ procedure: procedureIdentity })
|
|
266
269
|
.strict();
|
|
267
270
|
const resultSchemas = {
|
|
271
|
+
annotate_native_function: nativeFunctionAnnotationsSchema.safeExtend({
|
|
272
|
+
dossier: ghidraFunctionDossier,
|
|
273
|
+
}),
|
|
268
274
|
analyze_function: ghidraFunctionDossier,
|
|
269
275
|
procedure_assembly: z.string(),
|
|
270
276
|
procedure_callees: z.array(ghidraCanonicalAddressSchema),
|
|
@@ -282,7 +288,7 @@ const resultSchemas = {
|
|
|
282
288
|
export const parseGhidraFunctionResult = (operation, value) => {
|
|
283
289
|
const parsed = resultSchemas[operation].safeParse(value);
|
|
284
290
|
return parsed.success
|
|
285
|
-
? ok(parsed.data)
|
|
291
|
+
? ok(jsonValueSchema.parse(parsed.data))
|
|
286
292
|
: err(new AnalysisOutputError(operation, "Ghidra bridge output did not match the function-analysis contract", { cause: parsed.error }));
|
|
287
293
|
};
|
|
288
294
|
const referenceAddresses = (edge) => [
|
|
@@ -245,7 +245,9 @@ const systemGhidraInstallationHost = () => ({
|
|
|
245
245
|
try {
|
|
246
246
|
return readFileSync(path, "utf8");
|
|
247
247
|
}
|
|
248
|
-
catch {
|
|
248
|
+
catch (cause) {
|
|
249
|
+
// best-effort cleanup: optional install probing; unreadable means unknown.
|
|
250
|
+
void cause;
|
|
249
251
|
return undefined;
|
|
250
252
|
}
|
|
251
253
|
},
|
|
@@ -254,12 +256,14 @@ const systemGhidraInstallationHost = () => ({
|
|
|
254
256
|
accessSync(path, constants.X_OK);
|
|
255
257
|
return true;
|
|
256
258
|
}
|
|
257
|
-
catch {
|
|
259
|
+
catch (cause) {
|
|
260
|
+
// best-effort cleanup: optional executable probing; failure means missing.
|
|
261
|
+
void cause;
|
|
258
262
|
return false;
|
|
259
263
|
}
|
|
260
264
|
},
|
|
261
265
|
probeJava(command, environment) {
|
|
262
|
-
const observed = spawnSync(command, ["-XshowSettings:properties", "-version"], {
|
|
266
|
+
const observed = spawnSync(command, ["-XX:-UsePerfData", "-XshowSettings:properties", "-version"], {
|
|
263
267
|
encoding: "utf8",
|
|
264
268
|
env: environment,
|
|
265
269
|
timeout: 5_000,
|
|
@@ -290,7 +294,9 @@ const executablePath = (path) => {
|
|
|
290
294
|
accessSync(path, constants.X_OK);
|
|
291
295
|
return true;
|
|
292
296
|
}
|
|
293
|
-
catch {
|
|
297
|
+
catch (cause) {
|
|
298
|
+
// best-effort cleanup: optional executable probing; failure means missing.
|
|
299
|
+
void cause;
|
|
294
300
|
return false;
|
|
295
301
|
}
|
|
296
302
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { nativeLoadImageObservationSchema } from "../domain/nativeLoadImage.js";
|
|
3
|
+
import { AnalysisInputError, AnalysisOutputError, } from "../domain/analysisErrorCore.js";
|
|
3
4
|
import { functionBodySchema, functionBodyEntryAgrees, } from "../domain/hopperValues.js";
|
|
5
|
+
import { jsonValueSchema } from "../domain/jsonValue.js";
|
|
4
6
|
import { err, ok } from "../domain/result.js";
|
|
5
7
|
/** Read-only direct inventory operations admitted by the Ghidra adapter. */
|
|
6
8
|
export const GHIDRA_INVENTORY_OPERATIONS = [
|
|
9
|
+
"inspect_native_load_image",
|
|
10
|
+
"read_bytes",
|
|
11
|
+
"address_to_file_offset",
|
|
7
12
|
"address_name",
|
|
8
13
|
"list_documents",
|
|
9
14
|
"list_names",
|
|
@@ -30,6 +35,16 @@ const searchInput = {
|
|
|
30
35
|
document,
|
|
31
36
|
};
|
|
32
37
|
const inputSchemas = {
|
|
38
|
+
inspect_native_load_image: z.strictObject({}),
|
|
39
|
+
read_bytes: z.strictObject({
|
|
40
|
+
document,
|
|
41
|
+
address: explicitAddress,
|
|
42
|
+
length: z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).default(256),
|
|
43
|
+
}),
|
|
44
|
+
address_to_file_offset: z.strictObject({
|
|
45
|
+
document,
|
|
46
|
+
address: explicitAddress,
|
|
47
|
+
}),
|
|
33
48
|
address_name: z.object({ document, address: explicitAddress }).strict(),
|
|
34
49
|
list_documents: z.object({}).strict(),
|
|
35
50
|
list_names: z.object({ document, address: filteredAddress }).strict(),
|
|
@@ -173,6 +188,28 @@ const containingProcedure = z.discriminatedUnion("found", [
|
|
|
173
188
|
.strict(),
|
|
174
189
|
]);
|
|
175
190
|
const resultSchemas = {
|
|
191
|
+
inspect_native_load_image: nativeLoadImageObservationSchema,
|
|
192
|
+
read_bytes: z
|
|
193
|
+
.strictObject({
|
|
194
|
+
address: canonicalAddress,
|
|
195
|
+
requested_bytes: z.number().int().min(1),
|
|
196
|
+
returned_bytes: z.number().int().min(0),
|
|
197
|
+
bytes_hex: z.string().regex(/^(?:[a-f0-9]{2})*$/u),
|
|
198
|
+
complete: z.boolean(),
|
|
199
|
+
})
|
|
200
|
+
.superRefine((value, context) => {
|
|
201
|
+
if (value.returned_bytes * 2 !== value.bytes_hex.length ||
|
|
202
|
+
value.returned_bytes > value.requested_bytes ||
|
|
203
|
+
value.complete !== (value.returned_bytes === value.requested_bytes))
|
|
204
|
+
context.addIssue({
|
|
205
|
+
code: "custom",
|
|
206
|
+
message: "Read-byte length and completeness disagree",
|
|
207
|
+
});
|
|
208
|
+
}),
|
|
209
|
+
address_to_file_offset: z.strictObject({
|
|
210
|
+
address: canonicalAddress,
|
|
211
|
+
file_offset: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
212
|
+
}),
|
|
176
213
|
address_name: z.string().nullable(),
|
|
177
214
|
list_documents: z.array(z.string().min(1)).length(1),
|
|
178
215
|
list_names: z.array(symbolItem),
|
|
@@ -188,6 +225,6 @@ const resultSchemas = {
|
|
|
188
225
|
export const parseGhidraInventoryResult = (operation, value) => {
|
|
189
226
|
const parsed = resultSchemas[operation].safeParse(value);
|
|
190
227
|
return parsed.success
|
|
191
|
-
? ok(parsed.data)
|
|
228
|
+
? ok(jsonValueSchema.parse(parsed.data))
|
|
192
229
|
: err(new AnalysisOutputError(operation, "Ghidra bridge output did not match the inventory contract", { cause: parsed.error }));
|
|
193
230
|
};
|