rea-agents 5.0.0 → 6.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 +168 -655
- package/bridge/android/ReaJadxBridge.java +14 -5
- package/bridge/ghidra/ReaGhidraBridge.java +173 -47
- package/bridge/hopper_bridge.py +310 -128
- package/bridge/mitmproxy/capture.py +208 -0
- package/bridge/native/rea_lldb_tracer.py +839 -0
- package/bridge/process/ProcessRunTokenReader.swift +297 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +147 -0
- package/dist/android/JadxConfiguration.js +196 -33
- package/dist/android/JadxMcpTransport.js +4 -0
- package/dist/android/JadxProtocol.js +6 -0
- package/dist/android/JadxProvider.js +20 -2
- package/dist/android/JadxSession.js +23 -4
- package/dist/application/AnalysisContextQueries.js +8 -35
- package/dist/application/AnalysisDocument.js +32 -0
- package/dist/application/AppBundleExecutable.js +67 -21
- package/dist/application/CallPathTracing.js +19 -3
- package/dist/application/CapabilityInventory.js +27 -3
- package/dist/application/ClientConfigurationDocument.js +871 -6
- package/dist/application/ClientRegistrationIdentity.js +26 -5
- package/dist/application/ClientRegistrationStatus.js +29 -14
- package/dist/application/DirectAnalysis.js +97 -33
- package/dist/application/Doctor.js +4 -2
- package/dist/application/DoctorScope.js +25 -13
- package/dist/application/EnhancedLiteralTracing.js +22 -25
- package/dist/application/EnhancedTools.js +13 -11
- package/dist/application/EvidenceBundleFiles.js +24 -12
- package/dist/application/FunctionAnalysisEvidence.js +2 -3
- package/dist/application/InventoryProjectionEvidence.js +4 -3
- package/dist/application/InvestigationProviders.js +3 -2
- package/dist/application/JsonFiles.js +50 -28
- package/dist/application/ProcedureAddressResolution.js +11 -0
- package/dist/application/ReconstructionCoverageService.js +7 -4
- package/dist/application/ReconstructionObligationCandidates.js +5 -1
- package/dist/application/ReconstructionObligationLedgerService.js +4 -3
- package/dist/application/Setup.js +13 -1
- package/dist/application/SetupClientConfiguration.js +10 -15
- package/dist/application/SetupHost.js +5 -2
- package/dist/application/SetupPlan.js +5 -3
- package/dist/application/SupportedClients.js +34 -1
- package/dist/application/Uninstall.js +4 -3
- package/dist/application/Update.js +18 -3
- package/dist/application/UpdateRuntime.js +46 -25
- package/dist/application/WebModuleTraceService.js +4 -2
- package/dist/application/WebNetworkCapturePort.js +1 -0
- package/dist/application/WebNetworkCaptureService.js +134 -0
- package/dist/application/WebRuntimeService.js +5 -3
- package/dist/application/WebScriptExportService.js +2 -2
- package/dist/application/WebSourceLocationService.js +4 -2
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/WorkflowEvidence.js +82 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +21 -5
- package/dist/application/binary/AnalysisProviderRegistry.js +2 -0
- package/dist/application/binary/AnalysisSnapshotCache.js +52 -12
- package/dist/application/binary/BinarySession.js +131 -76
- package/dist/application/binary/BinarySessionOpen.js +19 -6
- package/dist/application/binary/BinarySessionRecords.js +45 -3
- package/dist/application/binary/BinarySessionStatus.js +17 -1
- package/dist/application/binary/CompositeProvider.js +13 -0
- package/dist/application/binary/LazyAnalysisProvider.js +3 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +59 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +62 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +64 -0
- package/dist/application/investigation/EvidenceLedger.js +21 -7
- package/dist/application/investigation/InvestigationRecords.js +8 -0
- package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +25 -5
- package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +19 -2
- package/dist/application/javascript/JavaScriptApplicationService.js +34 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +5 -5
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +47 -27
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +39 -7
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +26 -2
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +80 -27
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +33 -12
- package/dist/application/javascript/JavaScriptModuleRelationships.js +37 -8
- package/dist/application/javascript/JavaScriptRecoveryService.js +4 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +3 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +149 -72
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +14 -15
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +41 -1
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +7 -7
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -9
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +118 -12
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +3 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +27 -5
- package/dist/application/managed/ManagedApplicationGraphService.js +4 -3
- package/dist/application/managed/ManagedMemberComparisonService.js +7 -4
- package/dist/application/managed/ManagedNativeVerificationService.js +4 -3
- package/dist/application/managed/ManagedReconstructionService.js +4 -3
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +23 -15
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +8 -7
- package/dist/application/workflowInputError.js +18 -0
- package/dist/artifacts/ArtifactProvider.js +42 -5
- package/dist/artifacts/ArtifactProviderMetadata.js +2 -1
- package/dist/artifacts/MachOSliceArtifactReader.js +98 -14
- package/dist/artifacts/NativeDmgArtifactReader.js +13 -6
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +22 -3
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +176 -56
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +195 -0
- package/dist/artifacts/apple/KeyedArchiveReader.js +36 -22
- package/dist/artifacts/apple/MachoLoadCommandReader.js +355 -0
- package/dist/artifacts/apple/NibArchive.js +81 -14
- package/dist/artifacts/apple/NibViewHierarchy.js +10 -3
- package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +16 -11
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +14 -17
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +6 -2
- package/dist/artifacts/readStableArtifact.js +20 -4
- package/dist/browser/CdpCaptureCompleteness.js +2 -0
- package/dist/browser/CdpCaptureEventHandlers.js +165 -12
- package/dist/browser/CdpCaptureEventTypes.js +5 -1
- package/dist/browser/CdpCaptureEvents.js +34 -0
- package/dist/browser/CdpConnection.js +30 -11
- package/dist/browser/CdpOptionalCommand.js +2 -3
- package/dist/browser/CdpPageCapture.js +23 -1
- package/dist/browser/PlaywrightElectronActiveActions.js +32 -23
- package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +130 -122
- package/dist/browser/WebSourceMapFetcher.js +426 -72
- package/dist/browser/assets/LocalWebScriptArtifacts.js +2 -2
- package/dist/browser/history/CaptureFailures.js +137 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +17 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +92 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +188 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/cli/analysisSelector.js +23 -0
- package/dist/cli/applicationCommands.js +2 -3
- package/dist/cli/artifactCommands.js +26 -1
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/coreAnalysisCommands.js +2 -2
- package/dist/cli/coreBinaryCommands.js +78 -20
- package/dist/cli/electronCommands.js +21 -13
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +6 -3
- package/dist/cli/javascriptApplicationAnalysis.js +20 -3
- package/dist/cli/jsonOutput.js +38 -0
- package/dist/cli/nativeCallCommands.js +34 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +2 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +8 -8
- package/dist/cli.js +11 -4
- package/dist/cliBrowserScenarioCommands.js +2 -2
- package/dist/cliCommandNames.js +6 -1
- package/dist/cliJsonInput.js +35 -1
- package/dist/cliOutput.js +21 -6
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/config/environment.js +4 -0
- package/dist/config/ghidraStartupTimeout.js +17 -0
- package/dist/config/mcpResponseBudget.js +22 -0
- package/dist/config/parseConfig.js +2 -1
- package/dist/contracts/artifactToolContracts.js +6 -0
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +5 -3
- package/dist/contracts/enhancedToolContracts.js +3 -3
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +2 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/javascript/electronToolContracts.js +1 -1
- package/dist/contracts/managed/managedToolContracts.js +8 -6
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/native/nativeToolContracts.js +21 -3
- package/dist/contracts/officialToolContracts.js +26 -24
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/promptContracts.js +3 -3
- package/dist/contracts/sessionLifecycleInputs.js +18 -5
- package/dist/contracts/sessionStatusContract.js +8 -2
- package/dist/contracts/sessionToolContracts.js +8 -3
- package/dist/contracts/sessionToolSchemas.js +8 -4
- package/dist/contracts/toolContractExamples.js +1 -2
- package/dist/contracts/toolContractHelpers.js +4 -1
- package/dist/contracts/toolContracts.js +6 -0
- package/dist/contracts/toolEffects.js +30 -1
- package/dist/contracts/toolOutputSchemaGroups.js +33 -28
- package/dist/contracts/toolOutputSchemaPrimitives.js +19 -1
- package/dist/contracts/toolSchemaMetadata.js +69 -10
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/domain/analysisErrorBase.js +22 -2
- package/dist/domain/analysisErrorCore.js +61 -5
- package/dist/domain/analysisErrorPresentation.js +95 -12
- package/dist/domain/analysisErrorProjection.js +148 -19
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/android/androidAnalysis.js +2 -4
- package/dist/domain/android/androidApplication.js +17 -9
- package/dist/domain/apple/appleApplication.js +41 -14
- package/dist/domain/apple/dyldEnvironment.js +73 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +478 -0
- package/dist/domain/apple/dylibResolutionFindings.js +77 -0
- package/dist/domain/apple/interfaceBuilderGraph.js +25 -13
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +13 -3
- package/dist/domain/apple/keyedArchive.js +9 -1
- package/dist/domain/apple/machoContainer.js +54 -0
- package/dist/domain/apple/plistNumbers.js +76 -0
- package/dist/domain/artifactIdentity.js +29 -0
- package/dist/domain/artifactInventoryEvidence.js +19 -24
- package/dist/domain/artifactPathSyntax.js +1 -1
- package/dist/domain/bridgeCandidateProjection.js +71 -0
- package/dist/domain/browserCompleteness.js +1 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +24 -5
- package/dist/domain/browserObservationSchemas.js +13 -0
- package/dist/domain/browserScenarioValues.js +5 -2
- package/dist/domain/bundleComparison.js +3 -2
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/canonicalJsonDigestSteps.js +133 -0
- package/dist/domain/canonicalOrdering.js +9 -5
- package/dist/domain/changedBehavior.js +9 -9
- package/dist/domain/comparisonSourceEvidence.js +40 -0
- package/dist/domain/comparisonStatus.js +2 -30
- package/dist/domain/configurationErrors.js +1 -1
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +78 -11
- package/dist/domain/evidenceBundle.js +42 -1
- package/dist/domain/evidenceErrors.js +12 -1
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +108 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/firmware/firmwareAnalysis.js +10 -4
- package/dist/domain/hopperErrors.js +23 -2
- package/dist/domain/hopperValues.js +51 -8
- package/dist/domain/immutableJson.js +114 -0
- package/dist/domain/inputIssueProjection.js +3 -0
- package/dist/domain/javascript/electronActiveObservation.js +37 -6
- package/dist/domain/javascript/electronStaticAnalysisValues.js +6 -12
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +71 -23
- package/dist/domain/javascript/javascriptApplicationGraph.js +13 -0
- package/dist/domain/javascript/javascriptAstValues.js +20 -0
- package/dist/domain/javascript/javascriptExportShapeComparison.js +21 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +0 -10
- package/dist/domain/javascript/javascriptRecovery.js +3 -8
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +97 -2
- package/dist/domain/javascript/javascriptSemanticCoverage.js +6 -5
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +9 -17
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +22 -5
- package/dist/domain/javascript/javascriptSemanticGraph.js +34 -5
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +25 -17
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +8 -4
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
- package/dist/domain/javascript/javascriptSemanticValues.js +83 -11
- package/dist/domain/javascript/javascriptSourceParser.js +6 -2
- package/dist/domain/javascript/javascriptStaticAnalysis.js +22 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +5 -3
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +14 -4
- package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +66 -7
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +28 -16
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -2
- package/dist/domain/jsonSerialization.js +109 -0
- package/dist/domain/jsonValue.js +91 -3
- package/dist/domain/localPath.js +8 -0
- package/dist/domain/managed/managedApplicationGraph.js +10 -10
- package/dist/domain/managed/managedInspectionEvidence.js +16 -0
- package/dist/domain/managed/managedMemberComparisonMatch.js +5 -9
- package/dist/domain/managed/managedNativeVerification.js +3 -9
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
- package/dist/domain/native/nativeCallObservation.js +186 -0
- package/dist/domain/native/nativeCallPartialObservation.js +33 -0
- package/dist/domain/native/objcSwiftMetadata.js +0 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/{processCapture.js → process/processCapture.js} +143 -2
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +39 -5
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +11 -10
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +1 -1
- package/dist/domain/propertyListXmlText.js +19 -0
- package/dist/domain/providerAdapterError.js +1 -1
- package/dist/domain/providerOperationHealth.js +54 -0
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionVerification.js +9 -46
- package/dist/domain/reconstructionVerificationSchemas.js +3 -3
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/staticRuntimeCorrelation.js +9 -46
- package/dist/domain/webBundleAnalysis.js +20 -8
- package/dist/domain/webBundleAnalyzerInspection.js +13 -8
- package/dist/domain/webBundleAnalyzerResult.js +41 -2
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +19 -5
- package/dist/domain/webSourceLocation.js +1 -0
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +4 -2
- package/dist/dotnet/ManagedMemberInspectorCore.js +38 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +14 -3
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +15 -3
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +3 -1
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareFiles.js +1 -1
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +5 -0
- package/dist/ghidra/GhidraClient.js +47 -14
- package/dist/ghidra/GhidraDiagnostics.js +7 -7
- package/dist/ghidra/GhidraFunctionValues.js +10 -7
- package/dist/ghidra/GhidraInstallation.js +18 -21
- package/dist/ghidra/GhidraInventoryValues.js +14 -4
- package/dist/ghidra/GhidraJavaLaunch.js +62 -0
- package/dist/ghidra/GhidraLauncher.js +34 -16
- package/dist/ghidra/GhidraProvider.js +2 -2
- package/dist/ghidra/GhidraProviderCapabilities.js +15 -3
- package/dist/ghidra/GhidraProviderClient.js +23 -12
- package/dist/ghidra/GhidraSessionError.js +11 -7
- package/dist/ghidra/GhidraTargetSnapshot.js +47 -12
- package/dist/ghidra/GhidraTransport.js +20 -0
- package/dist/hopper/BridgeLauncher.js +33 -11
- package/dist/hopper/HopperAnalysisProfile.js +62 -4
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +222 -14
- package/dist/hopper/HopperFileOffset.js +237 -0
- package/dist/hopper/HopperMachOImage.js +196 -0
- package/dist/hopper/HopperOperationStage.js +6 -0
- package/dist/hopper/HopperProvider.js +63 -9
- package/dist/hopper/HopperProviderCapabilities.js +19 -1
- package/dist/hopper/HopperRegexSearch.js +137 -0
- package/dist/hopper/HopperRegexWorker.js +27 -0
- package/dist/hopper/HopperRequestQueue.js +68 -19
- package/dist/hopper/HopperTargetLease.js +3 -2
- package/dist/hopper/LinuxPrivateDisplayProbe.js +4 -2
- package/dist/inspector/JavaScriptRuntimeScope.js +9 -1
- package/dist/inspector/V8InspectorCaptureProjection.js +8 -3
- package/dist/inspector/V8InspectorProvider.js +47 -11
- package/dist/javascript/recovery/WakaruCommand.js +3 -0
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +17 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +79 -31
- package/dist/javascript/sourceMaps/TraceSourceMap.js +14 -28
- package/dist/mcpDoctor.js +62 -2
- package/dist/native/AppleDispatchCoverage.js +47 -6
- package/dist/native/AppleDispatchDecodeFacts.js +6 -0
- package/dist/native/AppleDispatchMetadata.js +6 -3
- package/dist/native/AppleMachoFixups.js +48 -24
- package/dist/native/AppleMachoSelection.js +32 -16
- package/dist/native/AppleObjcCategories.js +6 -2
- package/dist/native/AppleObjcDispatchFacets.js +5 -2
- package/dist/native/AppleObjcProperties.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +27 -21
- package/dist/native/AppleSwiftVtables.js +21 -15
- package/dist/native/CommandRunner.js +82 -84
- package/dist/native/LldbCallTracer.js +541 -0
- package/dist/native/LldbRetainedObservations.js +178 -0
- package/dist/native/NativeCallObservation.js +194 -0
- package/dist/native/NativeMacOSProvider.js +117 -20
- package/dist/native/NativeMacOSProviderMetadata.js +8 -3
- package/dist/native/SignatureTargetBinding.js +155 -0
- package/dist/native/parsers/lipo.js +71 -1
- package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
- package/dist/process/DarwinProcessRunTokenReader.js +293 -0
- package/dist/process/ExecFileOutput.js +20 -0
- package/dist/process/OwnedCommand.js +118 -0
- package/dist/process/ProcessOwnership.js +431 -51
- package/dist/process/ProcessOwnershipObservation.js +209 -27
- package/dist/process/ProviderProcess.js +68 -10
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +15 -0
- package/dist/{application → process/capture}/ProcessCaptureError.js +18 -2
- package/dist/process/capture/ProcessCaptureLifecycle.js +681 -0
- package/dist/{application → process/capture}/ProcessHarness.js +195 -29
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/server/EvidenceMcpServer.js +146 -0
- package/dist/server/createServer.js +37 -8
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +2 -4
- package/dist/server/registerApplicationTools/helpers.js +2 -4
- package/dist/server/registerArtifactComparisonTool.js +11 -7
- package/dist/server/registerBinaryDiagnosticsTools.js +15 -0
- package/dist/server/registerBrowserScenarioTool.js +2 -4
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +2 -3
- package/dist/server/registerCloseLifecycleTool.js +8 -18
- package/dist/server/registerElectronTools.js +2 -4
- package/dist/server/registerEnhancedTools.js +18 -59
- package/dist/server/registerEvidenceTools.js +3 -5
- package/dist/server/registerEvmTools.js +15 -0
- package/dist/server/registerFirmwareTools.js +2 -4
- package/dist/server/registerFunctionComparisonTool.js +10 -6
- package/dist/server/registerInvestigationTools.js +7 -7
- package/dist/server/registerJavaScriptRecoveryTool.js +2 -4
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -4
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +2 -4
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +2 -4
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -4
- package/dist/server/registerOfficialTools.js +2 -4
- package/dist/server/registerProcessComparisonTool.js +72 -46
- package/dist/server/registerRecordedCrashTools.js +15 -0
- package/dist/server/registerSessionRecordTools.js +5 -6
- package/dist/server/registerSessionStatusTool.js +17 -3
- package/dist/server/registerSessionTools.js +13 -5
- package/dist/server/registerWebModuleTool.js +2 -4
- package/dist/server/registerWebNetworkCaptureTool.js +26 -0
- package/dist/server/registerWebRuntimeTools.js +3 -7
- package/dist/server/registerWebScriptTool.js +2 -4
- package/dist/server/registerWebSourceLocationTool.js +2 -4
- package/dist/server/runDerivedOperation.js +15 -3
- package/dist/server/sessionAvailabilityPolicy.js +3 -1
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolRegistrationOptions.js +2 -2
- package/dist/server/toolResult.js +63 -11
- package/dist/server/toolResultEncoding.js +33 -0
- package/install.sh +1 -1
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +42 -9
- package/scripts/electron-active-hook-boundaries.cjs +18 -20
- package/scripts/electron-active-hook.cjs +241 -37
- package/scripts/rea.mjs +11 -3
- package/skills/reverse-engineer-anything/SKILL.md +32 -4
- package/skills/reverse-engineer-anything/references/javascript-applications.md +8 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +29 -0
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/ghidra/GhidraDefaults.js +0 -2
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/FilesystemSnapshot.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -1,32 +1,60 @@
|
|
|
1
|
-
import { parseProcessCapture } from "
|
|
2
|
-
import { err, ok } from "
|
|
3
|
-
import { AnalysisCapabilityUnavailableError } from "
|
|
4
|
-
import {} from "
|
|
5
|
-
import { ProcessCaptureError, processCaptureCancelled, } from "./ProcessCaptureError.js";
|
|
1
|
+
import { parseProcessCapture } from "../../domain/process/processCapture.js";
|
|
2
|
+
import { err, ok } from "../../domain/result.js";
|
|
3
|
+
import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js";
|
|
4
|
+
import {} from "../../domain/analysisErrorBase.js";
|
|
5
|
+
import { describeProcessCaptureExecutionFailure, ProcessCaptureError, processCaptureCancelled, } from "./ProcessCaptureError.js";
|
|
6
6
|
export { ProcessCaptureError } from "./ProcessCaptureError.js";
|
|
7
7
|
import { startProcessSampler } from "./ProcessSampling.js";
|
|
8
8
|
import { snapshotRoots } from "./FilesystemSnapshot.js";
|
|
9
9
|
import { TerminalRenderer } from "./TerminalRenderer.js";
|
|
10
10
|
import { normalizeProcessText } from "./ProcessNormalization.js";
|
|
11
|
-
import { selectCapturedProcessGroupIds } from "../
|
|
12
|
-
import { awaitTerminalExit, buildCaptureResult, captureTerminalFrames, createRunManifest, observeSettlement, prepareProcessCapture, releaseProcessResources, resolveProcessResult, settleProcessCaptureJournal, } from "./ProcessCaptureLifecycle.js";
|
|
11
|
+
import { selectCapturedProcessGroupIds } from "../ProcessOwnershipProcessTree.js";
|
|
12
|
+
import { awaitTerminalExit, buildCaptureResult, cleanupReportFailure, captureTerminalFrames, createProcessCaptureObservationBuffer, createRunManifest, observeLaunchedExecutable, observeSelectedExecutable, observeSettlement, prepareProcessCapture, releaseProcessResources, resolveProcessResult, settleProcessCaptureJournal, } from "./ProcessCaptureLifecycle.js";
|
|
13
13
|
import { assertNotCancelled, resolveProcessScenarioRuntimePaths, } from "./ProcessScenarioRuntimeValidation.js";
|
|
14
14
|
import { createProcessCaptureJournal, scheduleScenarioInteractions, } from "./ProcessCaptureJournal.js";
|
|
15
15
|
import { makeProcessCaptureEnvironment } from "./ProcessCaptureEnvironment.js";
|
|
16
16
|
import { classifyFilesystemEffects } from "./ProcessFilesystemEffects.js";
|
|
17
17
|
import { processCaptureOwnershipUnavailableReason } from "./ProcessCaptureCapability.js";
|
|
18
|
+
import { DarwinProcessOwnershipInspectionError } from "../DarwinProcessRunTokenReader.js";
|
|
18
19
|
export { probeProcessCaptureCapability } from "./ProcessCaptureCapability.js";
|
|
19
20
|
const cleanupFailedStartup = async (options) => {
|
|
21
|
+
const sampledProcessGroupIds = options.terminal !== undefined &&
|
|
22
|
+
options.observations?.process_samples.state === "available"
|
|
23
|
+
? selectCapturedProcessGroupIds(options.terminal.pid, options.observations.process_samples.value).filter((groupId) => groupId !== options.terminal?.pid)
|
|
24
|
+
: undefined;
|
|
20
25
|
options.terminal?.kill("SIGKILL");
|
|
26
|
+
if (options.observations !== undefined && options.renderer !== undefined) {
|
|
27
|
+
try {
|
|
28
|
+
options.observations.rendered_frames = {
|
|
29
|
+
state: "available",
|
|
30
|
+
value: await options.renderer.frames(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
catch (cause) {
|
|
34
|
+
options.observations.rendered_frames = {
|
|
35
|
+
state: "unavailable",
|
|
36
|
+
reason: `Rendered terminal frame collection failed: ${cause instanceof Error ? cause.message : "unknown failure"}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
21
40
|
const cleanupFailure = await releaseProcessResources({
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
timers: options.timers,
|
|
42
|
+
terminal: options.terminal,
|
|
43
|
+
renderer: options.renderer,
|
|
44
|
+
runId: options.runId,
|
|
45
|
+
captureBaseline: options.captureBaseline,
|
|
46
|
+
...(sampledProcessGroupIds === undefined ? {} : { sampledProcessGroupIds }),
|
|
47
|
+
temporaryRoot: options.temporaryRoot,
|
|
48
|
+
...(options.cleanupHost === undefined ? {} : { host: options.cleanupHost }),
|
|
24
49
|
});
|
|
25
|
-
if (cleanupFailure !== undefined)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
if (cleanupReportFailure(cleanupFailure) !== undefined) {
|
|
51
|
+
resolveProcessResult(undefined, options.cause, cleanupFailure, options.observations, {
|
|
52
|
+
scenario: options.scenario,
|
|
53
|
+
...(options.terminal === undefined
|
|
54
|
+
? {}
|
|
55
|
+
: { rootPid: options.terminal.pid }),
|
|
29
56
|
});
|
|
57
|
+
}
|
|
30
58
|
throw options.cause;
|
|
31
59
|
};
|
|
32
60
|
const createTerminalRenderer = (scenario, temporaryRoot, terminalPid, recordEvent) => new TerminalRenderer({
|
|
@@ -43,6 +71,7 @@ const startCaptureRuntime = async (options) => {
|
|
|
43
71
|
let terminal;
|
|
44
72
|
try {
|
|
45
73
|
const { spawn } = await import("@lydell/node-pty");
|
|
74
|
+
const selectedExecutable = await observeSelectedExecutable(scenario.executable, options.signal);
|
|
46
75
|
const startedAt = new Date();
|
|
47
76
|
const started = Date.now();
|
|
48
77
|
let lastOutput = started;
|
|
@@ -54,6 +83,12 @@ const startCaptureRuntime = async (options) => {
|
|
|
54
83
|
rows: scenario.terminal.rows,
|
|
55
84
|
name: "xterm-256color",
|
|
56
85
|
});
|
|
86
|
+
options.onSpawn(terminal.pid);
|
|
87
|
+
options.observationBuffer.target_pid = {
|
|
88
|
+
state: "available",
|
|
89
|
+
value: scenario.normalization.pids ? 1 : terminal.pid,
|
|
90
|
+
};
|
|
91
|
+
const executableIdentity = observeLaunchedExecutable(scenario.executable, selectedExecutable);
|
|
57
92
|
const framesTruncated = captureTerminalFrames({
|
|
58
93
|
...options,
|
|
59
94
|
terminal,
|
|
@@ -80,6 +115,7 @@ const startCaptureRuntime = async (options) => {
|
|
|
80
115
|
terminal,
|
|
81
116
|
started,
|
|
82
117
|
startedAt,
|
|
118
|
+
executableIdentity,
|
|
83
119
|
lastOutput: () => lastOutput,
|
|
84
120
|
framesTruncated,
|
|
85
121
|
stopSampler,
|
|
@@ -92,22 +128,32 @@ const startCaptureRuntime = async (options) => {
|
|
|
92
128
|
terminal,
|
|
93
129
|
renderer,
|
|
94
130
|
runId: options.runId,
|
|
131
|
+
captureBaseline: options.ownershipBaseline,
|
|
132
|
+
scenario,
|
|
133
|
+
...(options.cleanupHost === undefined
|
|
134
|
+
? {}
|
|
135
|
+
: { cleanupHost: options.cleanupHost }),
|
|
136
|
+
observations: options.observationBuffer,
|
|
95
137
|
temporaryRoot: options.temporaryRoot,
|
|
96
138
|
});
|
|
97
139
|
}
|
|
98
140
|
};
|
|
99
141
|
const finishProcessRun = async (options) => {
|
|
100
142
|
await options.stopSampler();
|
|
101
|
-
const
|
|
143
|
+
const sampledProcessGroupIds = options.runtime === undefined
|
|
144
|
+
? undefined
|
|
145
|
+
: selectCapturedProcessGroupIds(options.runtime.terminal.pid, options.samples).filter((groupId) => groupId !== options.runtime?.terminal.pid);
|
|
146
|
+
const cleanup = await releaseProcessResources({
|
|
102
147
|
timers: options.timers,
|
|
103
148
|
terminal: options.runtime?.terminal,
|
|
104
149
|
renderer: options.runtime?.renderer,
|
|
105
150
|
runId: options.runId,
|
|
151
|
+
captureBaseline: options.captureBaseline,
|
|
152
|
+
...(sampledProcessGroupIds === undefined ? {} : { sampledProcessGroupIds }),
|
|
106
153
|
temporaryRoot: options.temporaryRoot,
|
|
107
|
-
|
|
108
|
-
? []
|
|
109
|
-
: selectCapturedProcessGroupIds(options.runtime.terminal.pid, options.samples),
|
|
154
|
+
...(options.cleanupHost === undefined ? {} : { host: options.cleanupHost }),
|
|
110
155
|
});
|
|
156
|
+
const cleanupFailure = cleanupReportFailure(cleanup);
|
|
111
157
|
let { capture, executionFailure } = options;
|
|
112
158
|
let verifiedCapture;
|
|
113
159
|
if (capture !== undefined && cleanupFailure === undefined) {
|
|
@@ -129,11 +175,18 @@ const finishProcessRun = async (options) => {
|
|
|
129
175
|
executionFailure = new ProcessCaptureError(`process capture validation failed${cause instanceof Error ? `: ${cause.message}` : ""}`, { cause });
|
|
130
176
|
}
|
|
131
177
|
}
|
|
132
|
-
|
|
178
|
+
const rootPid = options.runtime?.terminal.pid ?? options.rootPid;
|
|
179
|
+
const partialContext = rootPid === undefined
|
|
180
|
+
? { scenario: options.scenario }
|
|
181
|
+
: { scenario: options.scenario, rootPid };
|
|
182
|
+
return resolveProcessResult(cleanupFailure === undefined ? verifiedCapture : capture, executionFailure, cleanup, options.observations, partialContext);
|
|
133
183
|
};
|
|
134
|
-
|
|
184
|
+
/** Preserve typed process-inspection preflight failures at the capture boundary. */
|
|
185
|
+
export const normalizeCaptureFailure = (cause, signal) => {
|
|
135
186
|
if (cause instanceof ProcessCaptureError)
|
|
136
187
|
return cause;
|
|
188
|
+
if (cause instanceof DarwinProcessOwnershipInspectionError)
|
|
189
|
+
return new ProcessCaptureError(cause.message, { cause });
|
|
137
190
|
if (signal?.aborted === true &&
|
|
138
191
|
(cause === signal.reason ||
|
|
139
192
|
(cause instanceof Error && cause.name === "AbortError")))
|
|
@@ -141,17 +194,66 @@ const normalizeCaptureFailure = (cause, signal) => {
|
|
|
141
194
|
return cause;
|
|
142
195
|
};
|
|
143
196
|
const completeCapture = async (options) => {
|
|
197
|
+
const unavailableReason = (stage, cause) => `${stage} failed: ${cause instanceof Error ? cause.message : "unknown failure"}`;
|
|
144
198
|
const { runtime, scenario } = options;
|
|
145
199
|
const { reason } = options.exit;
|
|
146
200
|
if (reason === "cancelled")
|
|
147
201
|
throw processCaptureCancelled();
|
|
148
|
-
|
|
202
|
+
let settlement;
|
|
203
|
+
try {
|
|
204
|
+
settlement = await observeSettlement(options.runId, selectCapturedProcessGroupIds(runtime.terminal.pid, options.samples), scenario.settle_ms, options.recordEvent, options.hostPlatform);
|
|
205
|
+
}
|
|
206
|
+
catch (cause) {
|
|
207
|
+
options.observationBuffer.settlement = {
|
|
208
|
+
state: "unavailable",
|
|
209
|
+
reason: unavailableReason("Process settlement observation", cause),
|
|
210
|
+
};
|
|
211
|
+
throw cause;
|
|
212
|
+
}
|
|
213
|
+
options.observationBuffer.settlement = {
|
|
214
|
+
state: "available",
|
|
215
|
+
value: settlement,
|
|
216
|
+
};
|
|
149
217
|
const samplingPartial = (await runtime.stopSampler()).partial;
|
|
150
218
|
await settleProcessCaptureJournal(options.eventJournal);
|
|
151
219
|
assertNotCancelled(options.signal);
|
|
152
|
-
|
|
220
|
+
let after;
|
|
221
|
+
try {
|
|
222
|
+
after = await options.captureSnapshot(scenario, options.signal);
|
|
223
|
+
}
|
|
224
|
+
catch (cause) {
|
|
225
|
+
options.observationBuffer.filesystem_snapshots = {
|
|
226
|
+
...options.observationBuffer.filesystem_snapshots,
|
|
227
|
+
after: {
|
|
228
|
+
state: "unavailable",
|
|
229
|
+
reason: unavailableReason("Final filesystem snapshot", cause),
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
throw cause;
|
|
233
|
+
}
|
|
234
|
+
options.observationBuffer.filesystem_snapshots = {
|
|
235
|
+
...options.observationBuffer.filesystem_snapshots,
|
|
236
|
+
after: {
|
|
237
|
+
state: "available",
|
|
238
|
+
value: { files: after.files, truncated: after.truncated },
|
|
239
|
+
},
|
|
240
|
+
};
|
|
153
241
|
options.recordEvent("filesystem_checkpoints", 1);
|
|
154
|
-
|
|
242
|
+
let renderedFrames;
|
|
243
|
+
try {
|
|
244
|
+
renderedFrames = await runtime.renderer.frames();
|
|
245
|
+
}
|
|
246
|
+
catch (cause) {
|
|
247
|
+
options.observationBuffer.rendered_frames = {
|
|
248
|
+
state: "unavailable",
|
|
249
|
+
reason: unavailableReason("Rendered terminal frame collection", cause),
|
|
250
|
+
};
|
|
251
|
+
throw cause;
|
|
252
|
+
}
|
|
253
|
+
options.observationBuffer.rendered_frames = {
|
|
254
|
+
state: "available",
|
|
255
|
+
value: renderedFrames,
|
|
256
|
+
};
|
|
155
257
|
const checkpoints = [
|
|
156
258
|
{
|
|
157
259
|
name: "before",
|
|
@@ -168,7 +270,18 @@ const completeCapture = async (options) => {
|
|
|
168
270
|
truncated: after.truncated,
|
|
169
271
|
},
|
|
170
272
|
];
|
|
171
|
-
|
|
273
|
+
let manifest;
|
|
274
|
+
try {
|
|
275
|
+
manifest = await createRunManifest(scenario, runtime.startedAt, new Date(), runtime.executableIdentity, { platform: options.hostPlatform, architecture: process.arch });
|
|
276
|
+
}
|
|
277
|
+
catch (cause) {
|
|
278
|
+
options.observationBuffer.manifest = {
|
|
279
|
+
state: "unavailable",
|
|
280
|
+
reason: unavailableReason("Capture manifest creation", cause),
|
|
281
|
+
};
|
|
282
|
+
throw cause;
|
|
283
|
+
}
|
|
284
|
+
options.observationBuffer.manifest = { state: "available", value: manifest };
|
|
172
285
|
const truncated = options.initiallyTruncated ||
|
|
173
286
|
after.truncated ||
|
|
174
287
|
runtime.framesTruncated() ||
|
|
@@ -194,19 +307,27 @@ const completeCapture = async (options) => {
|
|
|
194
307
|
});
|
|
195
308
|
};
|
|
196
309
|
/** Execute one caller-selected scenario and return bounded observations. */
|
|
197
|
-
const runProcessScenario = async (scenario, signal, hostEnvironment = process.env, hostPlatform = process.platform, captureSnapshot = snapshotRoots) => {
|
|
198
|
-
const { temporaryRoot, runId, before } = await prepareProcessCapture(scenario, signal, captureSnapshot);
|
|
310
|
+
const runProcessScenario = async (scenario, signal, hostEnvironment = process.env, hostPlatform = process.platform, captureSnapshot = snapshotRoots, cleanupHost) => {
|
|
311
|
+
const { temporaryRoot, runId, ownershipBaseline, before } = await prepareProcessCapture(scenario, signal, captureSnapshot);
|
|
199
312
|
const frames = [];
|
|
200
313
|
const samples = [];
|
|
314
|
+
const interactions = [];
|
|
201
315
|
const journal = createProcessCaptureJournal();
|
|
202
316
|
const { entries: eventJournal, recordEvent } = journal;
|
|
203
317
|
recordEvent("filesystem_checkpoints", 0);
|
|
318
|
+
const observations = createProcessCaptureObservationBuffer({
|
|
319
|
+
frames,
|
|
320
|
+
interactions,
|
|
321
|
+
samples,
|
|
322
|
+
eventJournal,
|
|
323
|
+
before,
|
|
324
|
+
});
|
|
204
325
|
let runtime;
|
|
326
|
+
let actualRootPid;
|
|
205
327
|
const timers = new Set();
|
|
206
328
|
let capture;
|
|
207
329
|
let executionFailure;
|
|
208
330
|
let stopSampler = async () => ({ partial: false });
|
|
209
|
-
const interactions = [];
|
|
210
331
|
const dispatchedEventIndexes = new Set();
|
|
211
332
|
try {
|
|
212
333
|
runtime = await startCaptureRuntime({
|
|
@@ -214,6 +335,12 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
214
335
|
hostEnvironment,
|
|
215
336
|
temporaryRoot,
|
|
216
337
|
runId,
|
|
338
|
+
ownershipBaseline,
|
|
339
|
+
...(cleanupHost === undefined ? {} : { cleanupHost }),
|
|
340
|
+
observationBuffer: observations,
|
|
341
|
+
onSpawn: (pid) => {
|
|
342
|
+
actualRootPid = pid;
|
|
343
|
+
},
|
|
217
344
|
frames,
|
|
218
345
|
samples,
|
|
219
346
|
interactions,
|
|
@@ -234,6 +361,14 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
234
361
|
dispatchedEventIndexes,
|
|
235
362
|
recordEvent,
|
|
236
363
|
});
|
|
364
|
+
observations.exit = {
|
|
365
|
+
state: "available",
|
|
366
|
+
value: {
|
|
367
|
+
code: exit.reason === "exited" && exit.exitCode >= 0 ? exit.exitCode : null,
|
|
368
|
+
signal: exit.signal ?? null,
|
|
369
|
+
reason: exit.reason,
|
|
370
|
+
},
|
|
371
|
+
};
|
|
237
372
|
capture = await completeCapture({
|
|
238
373
|
scenario,
|
|
239
374
|
hostPlatform,
|
|
@@ -247,6 +382,7 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
247
382
|
exit,
|
|
248
383
|
initiallyTruncated: before.truncated,
|
|
249
384
|
eventJournal,
|
|
385
|
+
observationBuffer: observations,
|
|
250
386
|
recordEvent,
|
|
251
387
|
captureSnapshot,
|
|
252
388
|
...(signal === undefined ? {} : { signal }),
|
|
@@ -255,32 +391,62 @@ const runProcessScenario = async (scenario, signal, hostEnvironment = process.en
|
|
|
255
391
|
catch (cause) {
|
|
256
392
|
runtime?.terminal.kill("SIGKILL");
|
|
257
393
|
executionFailure = normalizeCaptureFailure(cause, signal);
|
|
394
|
+
if (runtime !== undefined &&
|
|
395
|
+
observations.rendered_frames.state === "unavailable" &&
|
|
396
|
+
observations.rendered_frames.reason.startsWith("Rendered terminal frames were not collected")) {
|
|
397
|
+
try {
|
|
398
|
+
observations.rendered_frames = {
|
|
399
|
+
state: "available",
|
|
400
|
+
value: await runtime.renderer.frames(),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
catch (renderCause) {
|
|
404
|
+
const renderFailure = renderCause instanceof Error
|
|
405
|
+
? renderCause.message
|
|
406
|
+
: "unknown failure";
|
|
407
|
+
observations.rendered_frames = {
|
|
408
|
+
state: "unavailable",
|
|
409
|
+
reason: `Rendered terminal frame collection failed: ${renderFailure}`,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
258
413
|
}
|
|
259
414
|
return finishProcessRun({
|
|
260
415
|
runtime,
|
|
261
416
|
timers,
|
|
262
417
|
runId,
|
|
418
|
+
captureBaseline: ownershipBaseline,
|
|
419
|
+
...(cleanupHost === undefined ? {} : { cleanupHost }),
|
|
263
420
|
temporaryRoot,
|
|
421
|
+
scenario,
|
|
264
422
|
samples,
|
|
265
423
|
stopSampler,
|
|
266
424
|
capture,
|
|
267
425
|
executionFailure,
|
|
426
|
+
observations,
|
|
427
|
+
...(actualRootPid === undefined ? {} : { rootPid: actualRootPid }),
|
|
268
428
|
});
|
|
269
429
|
};
|
|
270
430
|
/** Execute one scenario through a typed expected-failure channel. */
|
|
271
|
-
export const captureProcessScenario = async (scenario, signal, platform = process.platform, environment = process.env, captureSnapshot = snapshotRoots) => {
|
|
431
|
+
export const captureProcessScenario = async (scenario, signal, platform = process.platform, environment = process.env, captureSnapshot = snapshotRoots, cleanupHost) => {
|
|
272
432
|
const ownershipReason = processCaptureOwnershipUnavailableReason(platform);
|
|
273
433
|
if (ownershipReason !== undefined)
|
|
274
434
|
return err(new AnalysisCapabilityUnavailableError("rea-process", "capture_process_scenario", ownershipReason, { userMessage: ownershipReason }));
|
|
275
435
|
try {
|
|
276
436
|
assertNotCancelled(signal);
|
|
277
437
|
const resolvedScenario = await resolveProcessScenarioRuntimePaths(scenario, environment);
|
|
278
|
-
return ok(await runProcessScenario(resolvedScenario, signal, environment, platform, captureSnapshot));
|
|
438
|
+
return ok(await runProcessScenario(resolvedScenario, signal, environment, platform, captureSnapshot, cleanupHost));
|
|
279
439
|
}
|
|
280
440
|
catch (cause) {
|
|
281
441
|
const failure = normalizeCaptureFailure(cause, signal);
|
|
442
|
+
const executionFailureReason = describeProcessCaptureExecutionFailure(cause);
|
|
282
443
|
return err(failure instanceof ProcessCaptureError
|
|
283
444
|
? failure
|
|
284
|
-
: new ProcessCaptureError("process capture failed", {
|
|
445
|
+
: new ProcessCaptureError("process capture failed", {
|
|
446
|
+
cause,
|
|
447
|
+
...(executionFailureReason === undefined
|
|
448
|
+
? {}
|
|
449
|
+
: { executionFailure: executionFailureReason }),
|
|
450
|
+
}));
|
|
285
451
|
}
|
|
286
452
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
|
-
import { execFileOutput } from "../
|
|
3
|
-
import { readProcessRunId } from "../
|
|
2
|
+
import { execFileOutput } from "../ExecFileOutput.js";
|
|
3
|
+
import { readProcessRunId } from "../ProcessOwnership.js";
|
|
4
4
|
const PROC_READ_CONCURRENCY = 64;
|
|
5
5
|
/** Prove that forkpty completed session setup and installed the run token. */
|
|
6
6
|
export const isInitializedPtyRoot = (options) => {
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { McpServer, isCallToolResult, isJSONRPCRequest, isJSONRPCNotification, isJSONRPCResultResponse, } from "@modelcontextprotocol/server";
|
|
2
|
+
import { analysisErrorProjectionSchema } from "../contracts/errorSchemas.js";
|
|
3
|
+
import { parseMcpResponseBudget } from "../config/mcpResponseBudget.js";
|
|
4
|
+
import { AnalysisResourceConstraintError } from "../domain/analysisErrorCore.js";
|
|
5
|
+
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
|
6
|
+
import { createEvidence } from "../domain/evidence.js";
|
|
7
|
+
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
|
8
|
+
import { toErrorToolResult } from "./toolResult.js";
|
|
9
|
+
import { encodeToolResult, MCP_RESULT_BUDGET_BYTES, } from "./toolResultEncoding.js";
|
|
10
|
+
/** Bind oversized MCP error recovery to this server's Evidence ledger. */
|
|
11
|
+
export class EvidenceMcpServer extends McpServer {
|
|
12
|
+
recordEvidence;
|
|
13
|
+
constructor(info, options, recordEvidence) {
|
|
14
|
+
super(info, options);
|
|
15
|
+
this.recordEvidence = recordEvidence;
|
|
16
|
+
}
|
|
17
|
+
/** Preserve the SDK transport lifecycle while retaining oversized errors. */
|
|
18
|
+
connect(transport) {
|
|
19
|
+
return super.connect(new ErrorEvidenceTransport(transport, this.recordEvidence));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class ErrorEvidenceTransport {
|
|
23
|
+
transport;
|
|
24
|
+
recordEvidence;
|
|
25
|
+
onclose;
|
|
26
|
+
onerror;
|
|
27
|
+
onmessage;
|
|
28
|
+
hasPerRequestStream;
|
|
29
|
+
pendingTools = new Map();
|
|
30
|
+
constructor(transport, recordEvidence) {
|
|
31
|
+
this.transport = transport;
|
|
32
|
+
this.recordEvidence = recordEvidence;
|
|
33
|
+
if (transport.hasPerRequestStream !== undefined)
|
|
34
|
+
this.hasPerRequestStream = transport.hasPerRequestStream;
|
|
35
|
+
transport.onmessage = (message, extra) => {
|
|
36
|
+
if (isJSONRPCRequest(message) &&
|
|
37
|
+
message.method === "tools/call" &&
|
|
38
|
+
typeof message.params?.["name"] === "string")
|
|
39
|
+
this.pendingTools.set(message.id, message.params["name"]);
|
|
40
|
+
// The SDK suppresses replies after cancellation, so send() cannot release
|
|
41
|
+
// this bookkeeping. Keep transport authentication outside retained data.
|
|
42
|
+
if (isJSONRPCNotification(message) &&
|
|
43
|
+
message.method === "notifications/cancelled") {
|
|
44
|
+
const id = message.params?.["requestId"];
|
|
45
|
+
if (typeof id === "string" || typeof id === "number")
|
|
46
|
+
this.pendingTools.delete(id);
|
|
47
|
+
}
|
|
48
|
+
this.onmessage?.(message, extra);
|
|
49
|
+
};
|
|
50
|
+
transport.onerror = (error) => this.onerror?.(error);
|
|
51
|
+
transport.onclose = () => {
|
|
52
|
+
this.pendingTools.clear();
|
|
53
|
+
this.onclose?.();
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
get sessionId() {
|
|
57
|
+
return this.transport.sessionId;
|
|
58
|
+
}
|
|
59
|
+
set sessionId(value) {
|
|
60
|
+
this.transport.sessionId = value;
|
|
61
|
+
}
|
|
62
|
+
start() {
|
|
63
|
+
return this.transport.start();
|
|
64
|
+
}
|
|
65
|
+
async close() {
|
|
66
|
+
try {
|
|
67
|
+
await this.transport.close();
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
this.pendingTools.clear();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
setProtocolVersion(version) {
|
|
74
|
+
this.transport.setProtocolVersion?.(version);
|
|
75
|
+
}
|
|
76
|
+
setSupportedProtocolVersions(versions) {
|
|
77
|
+
this.transport.setSupportedProtocolVersions?.(versions);
|
|
78
|
+
}
|
|
79
|
+
async send(message, options) {
|
|
80
|
+
const id = "id" in message &&
|
|
81
|
+
(typeof message.id === "string" || typeof message.id === "number")
|
|
82
|
+
? message.id
|
|
83
|
+
: undefined;
|
|
84
|
+
const tool = id === undefined ? undefined : this.pendingTools.get(id);
|
|
85
|
+
try {
|
|
86
|
+
await this.transport.send(this.recoverError(message, tool), options);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
if (!isJSONRPCRequest(message) && id !== undefined)
|
|
90
|
+
this.pendingTools.delete(id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
recoverError(message, tool) {
|
|
94
|
+
if (!isJSONRPCResultResponse(message) ||
|
|
95
|
+
!isCallToolResult(message.result) ||
|
|
96
|
+
message.result.isError !== true ||
|
|
97
|
+
message.result.structuredContent === undefined)
|
|
98
|
+
return message;
|
|
99
|
+
const structured = jsonObjectSchema.parse(message.result.structuredContent);
|
|
100
|
+
const configured = parseMcpResponseBudget(process.env.REA_MCP_MAX_RESPONSE_BYTES);
|
|
101
|
+
const budget = configured.ok && configured.value !== undefined
|
|
102
|
+
? configured.value - 1024
|
|
103
|
+
: MCP_RESULT_BUDGET_BYTES;
|
|
104
|
+
const encoded = encodeToolResult(structured, budget);
|
|
105
|
+
if (encoded.ok)
|
|
106
|
+
return message;
|
|
107
|
+
const operation = tool ?? "mcp_tool_error";
|
|
108
|
+
const originalError = analysisErrorProjectionSchema.safeParse(structured["error"]);
|
|
109
|
+
// Retain the already projected diagnostic. Transport authentication and raw
|
|
110
|
+
// request arguments are deliberately excluded: the application owns their
|
|
111
|
+
// explicit sensitivity policy, and its error projection is authoritative.
|
|
112
|
+
const evidence = createEvidence(undefined, { id: "rea-mcp", name: "REA MCP delivery", version: "1" }, {
|
|
113
|
+
operation: "mcp_tool_error",
|
|
114
|
+
parameters: { tool_name: operation },
|
|
115
|
+
result: structured,
|
|
116
|
+
rawResult: jsonObjectSchema.parse(message.result),
|
|
117
|
+
});
|
|
118
|
+
const recorded = this.recordEvidence?.(evidence);
|
|
119
|
+
const retained = recorded !== undefined && recorded.ok;
|
|
120
|
+
const failure = new AnalysisResourceConstraintError(operation, "transport", "The tool failed, but its complete error response exceeds the MCP response budget.", {
|
|
121
|
+
boundary: "mcp-response",
|
|
122
|
+
...(originalError.success
|
|
123
|
+
? { original_error_code: originalError.data.code }
|
|
124
|
+
: {}),
|
|
125
|
+
result_budget_bytes: budget,
|
|
126
|
+
response_bytes_at_least: encoded.bytesAtLeast,
|
|
127
|
+
constraint: encoded.constraint,
|
|
128
|
+
...(retained
|
|
129
|
+
? {
|
|
130
|
+
evidence_reference: {
|
|
131
|
+
kind: "retained-evidence",
|
|
132
|
+
evidence_id: evidence.evidence_id,
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
: { retention: recorded === undefined ? "unavailable" : "failed" }),
|
|
136
|
+
...(recorded !== undefined && !recorded.ok
|
|
137
|
+
? { retention_error: projectAnalysisError(recorded.error) }
|
|
138
|
+
: {}),
|
|
139
|
+
}, {
|
|
140
|
+
remediationAction: retained
|
|
141
|
+
? "Export the retained original error through export_evidence_bundle to a caller-selected path. The connection remains usable."
|
|
142
|
+
: "Configure a larger REA_MCP_MAX_RESPONSE_BYTES and matching client receive buffer, then retry. The original error could not be retained by this server.",
|
|
143
|
+
});
|
|
144
|
+
return { ...message, result: toErrorToolResult(failure) };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createEvmInterfaceService } from "../composition/evm.js";
|
|
2
|
+
import { registerEvmTools } from "./registerEvmTools.js";
|
|
3
|
+
import { registerRecordedCrashTools } from "./registerRecordedCrashTools.js";
|
|
4
|
+
import { createRecordedCrashService } from "../composition/binaryDiagnostics.js";
|
|
5
|
+
import { registerBinaryDiagnosticsTools } from "./registerBinaryDiagnosticsTools.js";
|
|
6
|
+
import { createBinaryLayoutService } from "../composition/binaryDiagnostics.js";
|
|
7
|
+
import { EvidenceMcpServer } from "./EvidenceMcpServer.js";
|
|
2
8
|
import { isAbsolute } from "node:path";
|
|
3
9
|
import { PRODUCT_IDENTITY } from "../identity.js";
|
|
4
10
|
import { silentLogger } from "../logger.js";
|
|
@@ -13,6 +19,8 @@ import { createWebSourceLocationService } from "../composition/webSourceLocation
|
|
|
13
19
|
import { registerWebSourceLocationTool } from "./registerWebSourceLocationTool.js";
|
|
14
20
|
import { createWebRuntimeService } from "../composition/webRuntime.js";
|
|
15
21
|
import { registerWebRuntimeTools } from "./registerWebRuntimeTools.js";
|
|
22
|
+
import { createWebNetworkCaptureService } from "../composition/webNetworkCaptures.js";
|
|
23
|
+
import { registerWebNetworkCaptureTool } from "./registerWebNetworkCaptureTool.js";
|
|
16
24
|
import { registerJavaScriptRecoveryTool } from "./registerJavaScriptRecoveryTool.js";
|
|
17
25
|
import { JavaScriptRecoveryService } from "../application/javascript/JavaScriptRecoveryService.js";
|
|
18
26
|
import { createJavaScriptRecoveryProvider } from "../composition/javascriptRecovery.js";
|
|
@@ -40,17 +48,24 @@ const installSessionToolAvailability = (server, session, options) => {
|
|
|
40
48
|
const policy = sessionAvailabilityPolicy(options.availabilityPolicy, {
|
|
41
49
|
optionalProviderLoadFailures: options.optionalProviderLoadFailures,
|
|
42
50
|
optionalFeatures: {
|
|
51
|
+
evmInterfaceEnabled: options.evmInterface !== undefined ||
|
|
52
|
+
(process.platform === "linux" && process.arch === "x64"),
|
|
43
53
|
webModuleResolutionEnabled: options.webModuleTrace !== undefined ||
|
|
44
54
|
isAbsolute(process.env.REA_BROWSER_EXECUTABLE ?? ""),
|
|
55
|
+
recordedCrashEnabled: options.recordedCrash !== undefined ||
|
|
56
|
+
(process.platform === "linux" &&
|
|
57
|
+
process.arch === "x64" &&
|
|
58
|
+
isAbsolute(process.env.REA_PWNTOOLS_PYTHON ?? "")),
|
|
59
|
+
binaryLayoutEnabled: options.binaryLayout !== undefined ||
|
|
60
|
+
(process.platform === "linux" &&
|
|
61
|
+
process.arch === "x64" &&
|
|
62
|
+
isAbsolute(process.env.REA_PWNTOOLS_PYTHON ?? "")),
|
|
45
63
|
firmwareInspectionEnabled: options.firmwareAnalysis !== undefined ||
|
|
46
64
|
(process.platform === "linux" &&
|
|
47
65
|
isAbsolute(process.env.REA_BINWALK_COMMAND ?? "")),
|
|
48
66
|
firmwareExtractionEnabled: options.firmwareAnalysis !== undefined ||
|
|
49
67
|
(process.platform === "linux" &&
|
|
50
68
|
isAbsolute(process.env.REA_UNBLOB_COMMAND ?? "")),
|
|
51
|
-
androidAnalysisEnabled: options.androidAnalysis !== undefined ||
|
|
52
|
-
((process.platform === "linux" || process.platform === "darwin") &&
|
|
53
|
-
isAbsolute(process.env.REA_JADX_MCP_JAR ?? "")),
|
|
54
69
|
browserObservationEnabled: options.browserObservation !== undefined,
|
|
55
70
|
javascriptRecoveryEnabled: options.javascriptRecovery !== undefined ||
|
|
56
71
|
(process.platform === "linux" &&
|
|
@@ -66,7 +81,7 @@ const installSessionToolAvailability = (server, session, options) => {
|
|
|
66
81
|
policy,
|
|
67
82
|
};
|
|
68
83
|
};
|
|
69
|
-
const createMcpServer = (session) => new
|
|
84
|
+
const createMcpServer = (session) => new EvidenceMcpServer({
|
|
70
85
|
name: PRODUCT_IDENTITY.mcpServerKey,
|
|
71
86
|
version: PRODUCT_IDENTITY.packageVersion,
|
|
72
87
|
}, {
|
|
@@ -74,7 +89,9 @@ const createMcpServer = (session) => new McpServer({
|
|
|
74
89
|
instructions: session === undefined
|
|
75
90
|
? ACTIVE_TARGET_INSTRUCTIONS
|
|
76
91
|
: TARGET_FREE_INSTRUCTIONS,
|
|
77
|
-
}
|
|
92
|
+
}, session === undefined
|
|
93
|
+
? undefined
|
|
94
|
+
: (evidence) => session.recordEvidence(evidence));
|
|
78
95
|
/**
|
|
79
96
|
* Construct one MCP server without acquiring subprocess resources.
|
|
80
97
|
* Supplying a session adds target lifecycle tools; omitting it retains the
|
|
@@ -84,6 +101,7 @@ export const createServer = (analysis, session, options = {}) => {
|
|
|
84
101
|
const startedAt = new Date().toISOString();
|
|
85
102
|
const logger = options.logger ?? silentLogger;
|
|
86
103
|
const server = createMcpServer(session);
|
|
104
|
+
const android = options.androidAnalysis ?? createAndroidAnalysisProvider();
|
|
87
105
|
const availability = installSessionToolAvailability(server, session, options);
|
|
88
106
|
const toolLogger = logger.child({ layer: "server" });
|
|
89
107
|
const { evidenceById, activeTarget, recordEvidence, recordEvidenceWithUnknown, } = createSessionRecorders(server, session);
|
|
@@ -99,7 +117,6 @@ export const createServer = (analysis, session, options = {}) => {
|
|
|
99
117
|
recordEvidenceWithUnknown,
|
|
100
118
|
};
|
|
101
119
|
registerBinaryAnalysisTools(toolContext);
|
|
102
|
-
const android = options.androidAnalysis ?? createAndroidAnalysisProvider();
|
|
103
120
|
const previousOnclose = server.server.onclose;
|
|
104
121
|
server.server.onclose = () => {
|
|
105
122
|
previousOnclose?.();
|
|
@@ -115,11 +132,15 @@ export const createServer = (analysis, session, options = {}) => {
|
|
|
115
132
|
throw result.reason;
|
|
116
133
|
};
|
|
117
134
|
registerAndroidTools(server, new AndroidAnalysisService(android), toolLogger, recordEvidence);
|
|
135
|
+
registerBinaryDiagnosticsTools(server, options.binaryLayout ?? createBinaryLayoutService(), toolLogger, recordEvidence);
|
|
136
|
+
registerEvmTools(server, options.evmInterface ?? createEvmInterfaceService(), toolLogger, recordEvidence);
|
|
137
|
+
registerRecordedCrashTools(server, options.recordedCrash ?? createRecordedCrashService(), toolLogger, recordEvidence);
|
|
118
138
|
registerFirmwareTools(server, new FirmwareAnalysisService(options.firmwareAnalysis ?? createFirmwareAnalysisProvider()), toolLogger, recordEvidence);
|
|
119
139
|
registerObservationTools(toolContext);
|
|
120
140
|
registerWebModuleTool(server, options.webModuleTrace ?? createWebModuleTraceService(), toolLogger, recordEvidence);
|
|
121
141
|
registerWebSourceLocationTool(server, options.webSourceLocation ?? createWebSourceLocationService(), toolLogger, recordEvidence);
|
|
122
142
|
registerWebRuntimeTools(server, options.webRuntime ?? createWebRuntimeService(), toolLogger, recordEvidence);
|
|
143
|
+
registerWebNetworkCaptureTool(server, options.webNetworkCapture ?? createWebNetworkCaptureService(), toolLogger, recordEvidence);
|
|
123
144
|
registerJavaScriptRecoveryTool(server, new JavaScriptRecoveryService(options.javascriptRecovery ?? createJavaScriptRecoveryProvider()), toolLogger, recordEvidence);
|
|
124
145
|
registerGuidedPrompts(server, analysis, session);
|
|
125
146
|
if (session !== undefined) {
|
|
@@ -128,6 +149,7 @@ export const createServer = (analysis, session, options = {}) => {
|
|
|
128
149
|
...(availability === undefined
|
|
129
150
|
? {}
|
|
130
151
|
: { availabilityPolicy: availability.policy }),
|
|
152
|
+
androidAnalysisAvailability: (signal) => android.inspectAvailability(signal),
|
|
131
153
|
startedAt,
|
|
132
154
|
});
|
|
133
155
|
}
|
|
@@ -136,7 +158,8 @@ export const createServer = (analysis, session, options = {}) => {
|
|
|
136
158
|
const createSessionRecorders = (server, session) => ({
|
|
137
159
|
evidenceById: session === undefined
|
|
138
160
|
? undefined
|
|
139
|
-
: (evidenceId) => session.
|
|
161
|
+
: (evidenceId) => session.evidenceForAnalysis?.(evidenceId) ??
|
|
162
|
+
session.evidenceById(evidenceId),
|
|
140
163
|
activeTarget: session === undefined ? undefined : () => session.activeTarget(),
|
|
141
164
|
recordEvidence: session === undefined
|
|
142
165
|
? undefined
|
|
@@ -165,6 +188,12 @@ const registerBinaryAnalysisTools = ({ server, analysis, session, logger, active
|
|
|
165
188
|
registerEnhancedTools(server, analysis, {
|
|
166
189
|
...analysisOptions,
|
|
167
190
|
analysisProfile: session === undefined ? undefined : () => session.analysisProfile(),
|
|
191
|
+
allowsSnapshotReplay: session === undefined
|
|
192
|
+
? undefined
|
|
193
|
+
: (operation) => session.allowsSnapshotReplay(operation),
|
|
194
|
+
recordWorkflowSnapshot: session === undefined
|
|
195
|
+
? undefined
|
|
196
|
+
: (input) => session.recordWorkflowSnapshot(input),
|
|
168
197
|
});
|
|
169
198
|
const evidenceOptions = { logger, activeTarget, recordEvidence };
|
|
170
199
|
registerNativeTools(server, analysis, evidenceOptions);
|