rea-agents 6.5.0 → 6.7.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 +12 -3
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/bridge/android/ReaJadxBridge.java +167 -23
- package/bridge/cutter/rea_bridge.py +19 -10
- package/bridge/ghidra/ReaGhidraBridge.java +98 -66
- package/bridge/hopper_bridge.py +9 -1
- package/bridge/native/rea_lldb_tracer.py +48 -4
- package/bridge/pwndbg/core_context.py +15 -2
- package/dist/adb/AdbCommand.js +148 -0
- package/dist/adb/AdbConfiguration.js +26 -4
- package/dist/adb/AdbInputSnapshot.js +126 -0
- package/dist/adb/AdbProvider.js +765 -248
- package/dist/adb/AdbShellOutput.js +92 -21
- package/dist/android/AndroidTargetSnapshot.js +7 -7
- package/dist/android/JadxAnalysis.js +27 -32
- package/dist/android/JadxConfiguration.js +173 -125
- package/dist/android/JadxDoctor.js +11 -3
- package/dist/android/JadxFailure.js +154 -0
- package/dist/android/JadxInterruption.js +13 -0
- package/dist/android/JadxJavaProbe.js +246 -0
- package/dist/android/JadxMcpTransport.js +48 -15
- package/dist/android/JadxProtocol.js +29 -2
- package/dist/android/JadxProvider.js +171 -96
- package/dist/android/JadxRelease.js +5 -1
- package/dist/android/JadxSession.js +35 -14
- package/dist/apktool/ApktoolCommandCleanup.js +134 -0
- package/dist/apktool/ApktoolCommandOutput.js +22 -0
- package/dist/apktool/ApktoolConfiguration.js +162 -44
- package/dist/apktool/ApktoolDecodeOutput.js +29 -23
- package/dist/apktool/ApktoolDecodedInventory.js +52 -0
- package/dist/apktool/ApktoolProvider.js +254 -335
- package/dist/apktool/ApktoolStringTables.js +178 -0
- package/dist/apktool/ApktoolWorkspace.js +162 -0
- package/dist/application/AnalysisDocument.js +19 -4
- package/dist/application/AnalysisProvider.js +15 -1
- package/dist/application/AppBundleExecutable.js +11 -4
- package/dist/application/BinaryTargetResolver.js +9 -2
- package/dist/application/BrowserObservationService.js +54 -20
- package/dist/application/BrowserScenarioCaptureService.js +26 -6
- package/dist/application/CapabilityInventory.js +14 -8
- package/dist/application/ClaudeDesktopConfigLocation.js +5 -5
- package/dist/application/ClientConfigurationCleanup.js +73 -0
- package/dist/application/ClientConfigurationDocument.js +170 -128
- package/dist/application/ClientConfigurationPublication.js +167 -0
- package/dist/application/ClientRegistrationEnvironment.js +31 -1
- package/dist/application/ClientRegistrationIdentity.js +54 -39
- package/dist/application/ClientRegistrationStatus.js +123 -48
- package/dist/application/DirectAnalysis.js +15 -2
- package/dist/application/DirectAnalysisCleanup.js +5 -1
- package/dist/application/DirectAnalysisStatus.js +1 -1
- package/dist/application/Doctor.js +83 -9
- package/dist/application/DoctorDiagnostics.js +25 -4
- package/dist/application/DoctorProviderIds.js +7 -1
- package/dist/application/DshCordisPatch.js +1 -1
- package/dist/application/EnhancedTools.js +9 -21
- package/dist/application/HermesClientHome.js +20 -0
- package/dist/application/HermesConfigurationYaml.js +43 -3
- package/dist/application/HopperDownload.js +11 -3
- package/dist/application/HopperReleaseFeed.js +71 -0
- package/dist/application/InvestigationProviders.js +4 -3
- package/dist/application/JsonFiles.js +1 -1
- package/dist/application/LinuxHopper.js +96 -71
- package/dist/application/LinuxHopperPublisher.js +656 -0
- package/dist/application/MacHopper.js +182 -66
- package/dist/application/MipsElfMetadata.js +1 -1
- package/dist/application/MsixPackageStorage.js +13 -6
- package/dist/application/ProviderOperationExecution.js +13 -20
- package/dist/application/ReconstructionObligationCandidates.js +17 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +4 -0
- package/dist/application/ReconstructionObligationLedgerService.js +5 -3
- package/dist/application/ReconstructionObligationOriginalCases.js +8 -0
- package/dist/application/ReferenceSourceImportEntries.js +160 -18
- package/dist/application/ReferenceSourceImportPolicy.js +5 -3
- package/dist/application/ReferenceSourceVcsAdapter.js +3 -1
- package/dist/application/RegularFileRead.js +107 -88
- package/dist/application/Setup.js +23 -11
- package/dist/application/SetupClientConfiguration.js +155 -89
- package/dist/application/SetupClients.js +22 -13
- package/dist/application/SetupHost.js +90 -34
- package/dist/application/SetupInstallFailure.js +18 -3
- package/dist/application/SetupPlan.js +15 -5
- package/dist/application/SetupRecoveryBackup.js +40 -13
- package/dist/application/SetupRegistrationEnvironment.js +12 -0
- package/dist/application/SetupSkill.js +10 -30
- package/dist/application/SourceLimitations.js +35 -0
- package/dist/application/SupportedClients.js +4 -4
- package/dist/application/Uninstall.js +91 -36
- package/dist/application/UpdateCommandProgress.js +66 -0
- package/dist/application/UpdateMaintenance.js +7 -2
- package/dist/application/UpdateRuntime.js +60 -30
- package/dist/application/WebModuleTraceService.js +35 -22
- package/dist/application/WebNetworkCaptureService.js +8 -5
- package/dist/application/WebRuntimeService.js +41 -8
- package/dist/application/WebScriptExportService.js +6 -4
- package/dist/application/WebSourceLocationService.js +3 -4
- package/dist/application/WorkflowEvidence.js +11 -4
- package/dist/application/analysisView/AnalysisViewService.js +9 -52
- package/dist/application/android/AndroidAnalysisService.js +5 -4
- package/dist/application/android/AndroidSearchEvidenceSummary.js +6 -8
- package/dist/application/artifacts/ArtifactComparisonEvidence.js +32 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +14 -11
- package/dist/application/binary/AnalysisProviderRegistry.js +340 -50
- package/dist/application/binary/BinarySession.js +73 -34
- package/dist/application/binary/BinarySessionRecords.js +3 -0
- package/dist/application/binary/BinarySessionStatus.js +3 -4
- package/dist/application/binary/CompositeProvider.js +75 -30
- package/dist/application/binary/LazyAnalysisProvider.js +6 -68
- package/dist/application/binary/SessionProviderRouter.js +11 -2
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +3 -4
- package/dist/application/binaryDiagnostics/PeResourcesService.js +22 -5
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +3 -4
- package/dist/application/captures/PacketCaptureService.js +3 -2
- package/dist/application/closeOwnedWebResources.js +32 -2
- package/dist/application/electron/ElectronFuseService.js +8 -43
- package/dist/application/evm/EvmInterfaceEvidence.js +11 -0
- package/dist/application/evm/EvmInterfaceService.js +4 -15
- package/dist/application/firmware/FirmwareAnalysisService.js +4 -3
- package/dist/application/go/GoBinaryService.js +4 -5
- package/dist/application/investigation/EvidenceLedger.js +3 -4
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +14 -2
- package/dist/application/javascript/ElectronEvidence.js +1 -2
- package/dist/application/javascript/ElectronObservationService.js +41 -7
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +6 -0
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +35 -17
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +30 -1
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +3 -2
- package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +3 -3
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +41 -11
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +18 -8
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +84 -24
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +15 -3
- package/dist/application/javascript/JavaScriptModuleRelationships.js +1 -1
- package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +1 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +33 -10
- package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +4 -5
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +103 -24
- package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +13 -4
- package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +23 -3
- package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +18 -5
- package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +4 -6
- package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +2 -3
- package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +5 -8
- package/dist/application/native/NativeCallRoutes.js +40 -23
- package/dist/application/native/NativeUiActionTrace.js +8 -0
- package/dist/application/native/NativeValueTrace.js +8 -0
- package/dist/application/reverse/ReverseEngineeringService.js +2 -2
- package/dist/application/rust/RustBinaryService.js +6 -4
- package/dist/application/signals/SignalRecordingService.js +3 -2
- package/dist/application/wasm/WasmArtifactService.js +4 -5
- package/dist/artifacts/AnalysisCleanupLease.js +119 -0
- package/dist/artifacts/ArtifactFileOperation.js +150 -0
- package/dist/artifacts/ArtifactHash.js +2 -1
- package/dist/artifacts/ArtifactProvider.js +16 -5
- package/dist/artifacts/ArtifactReader.js +50 -4
- package/dist/artifacts/ArtifactResourceScope.js +80 -6
- package/dist/artifacts/AsarArtifactReader.js +12 -11
- package/dist/artifacts/AsarEntryStream.js +49 -17
- package/dist/artifacts/DirectoryArtifactReader.js +28 -7
- package/dist/artifacts/MachOSliceArtifactReader.js +70 -13
- package/dist/artifacts/NativeDmgArtifactReader.js +112 -13
- package/dist/artifacts/SafeOutputTree.js +5 -3
- package/dist/artifacts/SafeOutputTreeCreationFailure.js +1 -0
- package/dist/artifacts/SafeOutputTreeReadback.js +10 -16
- package/dist/artifacts/ZipArtifactReader.js +34 -14
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +3 -1
- package/dist/artifacts/apple/DylibFileAccess.js +106 -0
- package/dist/artifacts/apple/DylibResolutionReader.js +64 -155
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +52 -9
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +25 -24
- package/dist/artifacts/apple/KeyedArchiveReader.js +20 -11
- package/dist/artifacts/apple/MachoLoadCommandReader.js +17 -2
- package/dist/artifacts/apple/PlistNumberLiterals.js +104 -116
- package/dist/artifacts/extraction/ArtifactExtraction.js +15 -12
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +9 -11
- package/dist/artifacts/inventory/ArtifactInventory.js +2 -2
- package/dist/artifacts/inventory/classify.js +4 -2
- package/dist/artifacts/inventory/hashStableRootArtifact.js +14 -7
- package/dist/artifacts/inventory/scanCanonical.js +3 -4
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +3 -1
- package/dist/artifacts/readArtifactFileChunks.js +9 -0
- package/dist/artifacts/readStableArtifact.js +12 -34
- package/dist/browser/BrowserScenarioPartialObservation.js +14 -48
- package/dist/browser/CdpBrowserProvider.js +81 -30
- package/dist/browser/CdpCaptureDocuments.js +99 -131
- package/dist/browser/CdpCaptureDomSvg.js +31 -60
- package/dist/browser/CdpCaptureValues.js +12 -0
- package/dist/browser/CdpConnection.js +133 -27
- package/dist/browser/CdpElectronInspection.js +60 -60
- package/dist/browser/CdpElectronProvider.js +56 -4
- package/dist/browser/CdpElectronScriptEvents.js +4 -1
- package/dist/browser/CdpElectronScripts.js +2 -5
- package/dist/browser/CdpElectronWorkers.js +13 -2
- package/dist/browser/CdpPageCapture.js +2 -1
- package/dist/browser/CdpPageCaptureScripts.js +14 -10
- package/dist/browser/CdpPageCaptureWorkers.js +45 -14
- package/dist/browser/CdpSafeMetadata.js +23 -19
- package/dist/browser/CdpSnapshotNodes.js +103 -0
- package/dist/browser/CdpSnapshotStrings.js +0 -6
- package/dist/browser/CdpTargetSession.js +52 -10
- package/dist/browser/CdpTargetSessionOwner.js +198 -0
- package/dist/browser/ElectronCaptureCleanup.js +82 -0
- package/dist/browser/ElectronProcessCleanup.js +91 -0
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +71 -16
- package/dist/browser/PlaywrightElectronActiveActions.js +53 -5
- package/dist/browser/PlaywrightElectronActiveFuses.js +86 -0
- package/dist/browser/PlaywrightElectronActiveProjection.js +5 -0
- package/dist/browser/PlaywrightElectronActiveProvider.js +140 -151
- package/dist/browser/PlaywrightExecutionBoundary.js +4 -2
- package/dist/browser/PlaywrightScenarioBrowser.js +236 -90
- package/dist/browser/PlaywrightScenarioEvents.js +135 -48
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +121 -34
- package/dist/browser/PlaywrightScenarioSession.js +95 -22
- package/dist/browser/PlaywrightScenarioStorage.js +15 -7
- package/dist/browser/StructuredFieldToken.js +53 -0
- package/dist/browser/WebArtifactCleanup.js +53 -0
- package/dist/browser/WebSourceMapFetcher.js +19 -10
- package/dist/browser/assets/WebArtifactReads.js +6 -2
- package/dist/browser/assets/WebSourceLocationArtifacts.js +12 -3
- package/dist/browser/execution/CdpRuntimeSession.js +36 -7
- package/dist/browser/execution/CdpWebRuntimeProvider.js +22 -4
- package/dist/browser/history/CaptureFailures.js +7 -2
- package/dist/browser/history/HarCapture.js +42 -11
- package/dist/browser/history/SazMetadata.js +10 -47
- package/dist/browser/modules/NativeModuleResolver.js +108 -58
- package/dist/browser/modules/WebModuleArtifacts.js +12 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +40 -17
- package/dist/browser/network/PlaywrightScenarioNetwork.js +182 -73
- package/dist/captures/TsharkCaptureProvider.js +13 -6
- package/dist/catalogIdentity.js +19 -14
- package/dist/cli/adbCommands.js +18 -19
- package/dist/cli/androidCommands.js +2 -14
- package/dist/cli/apktoolCommands.js +4 -14
- package/dist/cli/binaryDiagnosticsCommands.js +5 -5
- package/dist/cli/browserAdvancedCommands.js +11 -4
- package/dist/cli/browserCommands.js +21 -12
- package/dist/cli/captureCommands.js +4 -4
- package/dist/cli/cliResultOutput.js +175 -89
- package/dist/cli/coreBinaryCommands.js +4 -3
- package/dist/cli/cutterCommands.js +51 -13
- package/dist/cli/electronCommands.js +34 -13
- package/dist/cli/evmCommands.js +6 -15
- package/dist/cli/finishAnalysisCommand.js +10 -2
- package/dist/cli/firmwareCommands.js +6 -14
- package/dist/cli/flutterCommands.js +2 -18
- package/dist/cli/fridaCommands.js +8 -0
- package/dist/cli/goCommands.js +2 -2
- package/dist/cli/javascriptRecoveryCommands.js +14 -26
- package/dist/cli/jebCommands.js +2 -14
- package/dist/cli/options.js +6 -0
- package/dist/cli/pcapCommands.js +2 -20
- package/dist/cli/rustCommands.js +6 -7
- package/dist/cli/setupCommands.js +4 -3
- package/dist/cli/signalCommands.js +4 -4
- package/dist/cli/sqliteCommands.js +17 -44
- package/dist/cli/wasmCommands.js +7 -18
- package/dist/cli/webModuleCommands.js +19 -34
- package/dist/cli/webNetworkCaptureCommands.js +3 -2
- package/dist/cli/webRuntimeCommands.js +15 -6
- package/dist/cli/webSourceLocationCommands.js +14 -33
- package/dist/cli-runtime/AnalysisCleanupLease-CWfTGYKd.js +103 -0
- package/dist/cli-runtime/{AnalysisProvider-D0Us2OTk.js → AnalysisProvider-BGrYaMVo.js} +14 -3
- package/dist/cli-runtime/{AnalysisSnapshotCache-BXS0wRd2.js → AnalysisSnapshotCache-BjRlXeUS.js} +14 -13
- package/dist/cli-runtime/ArtifactFileOperation-Dg4BcoEM.js +122 -0
- package/dist/cli-runtime/{ArtifactReader-BXkffc1D.js → ArtifactReader-DMwm42bk.js} +29 -6
- package/dist/cli-runtime/ArtifactResourceScope-CokZGcII.js +175 -0
- package/dist/cli-runtime/{AsarHeader-CnzOzYEH.js → AsarHeader-BxwU17DJ.js} +1 -1
- package/dist/cli-runtime/{BinarySessionStatus-DnMxMk-r.js → BinarySessionStatus-DRhjr7Vb.js} +4 -3
- package/dist/cli-runtime/{BinaryTargetResolver-CVIJ_s1A.js → BinaryTargetResolver-tuCTjBlQ.js} +38 -108
- package/dist/cli-runtime/{BoundedFileBytes-BU30odTm.js → BoundedFileBytes-DRtiQNAQ.js} +7 -3
- package/dist/cli-runtime/{CdpTargetSession-DGX5pV9w.js → CdpTargetSession-CQ08KHbh.js} +318 -43
- package/dist/cli-runtime/ClientConfigPath-Dn-V_GUf.js +255 -0
- package/dist/cli-runtime/{ClientConfigurationDocument-ffQ9X0Se.js → ClientConfigurationDocument-C9T8MNGc.js} +206 -142
- package/dist/cli-runtime/{ClientRegistrationStatus-DszCyPEU.js → ClientRegistrationStatus-PnD29RTX.js} +112 -36
- package/dist/cli-runtime/{CurrentEntrypointPath-D5FRNdkq.js → CurrentEntrypointPath-m7QCIVN0.js} +1 -1
- package/dist/cli-runtime/{DirectAnalysis-BgvAtpN3.js → DirectAnalysis-C5NyUryV.js} +76 -23
- package/dist/cli-runtime/DirectoryArtifactReader-CokAJ8vo.js +448 -0
- package/dist/cli-runtime/{Doctor-DIpf_I7N.js → Doctor-DrkWsav4.js} +105 -25
- package/dist/cli-runtime/{ElectronFileScope-dpHm2nrS.js → ElectronFileScope-AP7VoVr7.js} +204 -149
- package/dist/cli-runtime/ElectronFuseFailures-DsjXR7Xp.js +609 -0
- package/dist/cli-runtime/{ExecFileOutput-BEQs-lDD.js → ExecFileOutput-D6KLYTve.js} +11 -9
- package/dist/cli-runtime/{InterfaceBuilderDecodeBudget-D4omRUe4.js → InterfaceBuilderDecodeBudget-CW1IO3dG.js} +40 -21
- package/dist/cli-runtime/{InventoryProjectionEvidence-DIsI4DJ6.js → InventoryProjectionEvidence-DTH5QAqL.js} +3 -3
- package/dist/cli-runtime/{InvestigationProviders-DoQRIHii.js → InvestigationProviders-CFh4a64d.js} +3 -2
- package/dist/cli-runtime/{JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js → JavaScriptApplicationEvidenceGraph-gOmPB2L6.js} +6 -6
- package/dist/cli-runtime/{JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js → JavaScriptApplicationWorkflowEvidence-WZgtK_Ok.js} +2 -2
- package/dist/cli-runtime/JebMcpEndpoint-BEalGZh9.js +710 -0
- package/dist/cli-runtime/{JsonFiles-DQa1PRKy.js → JsonFiles-uvd6ZyQi.js} +10 -118
- package/dist/cli-runtime/KunaInstallation-P0j3x851.js +1781 -0
- package/dist/cli-runtime/MacHopperPaths-bGzqjF1Z.js +34 -0
- package/dist/cli-runtime/{MachoLoadCommandReader-C7e074Ze.js → MachoLoadCommandReader-CZm6N5vF.js} +12 -192
- package/dist/cli-runtime/{ManagedSnapshot-rqyBHcdL.js → ManagedSnapshot-CPE9C3OD.js} +406 -110
- package/dist/cli-runtime/OwnedCommandCleanup-BN_V6Erc.js +187 -0
- package/dist/cli-runtime/OwnedRegularFile-D1f5nUCx.js +256 -0
- package/dist/cli-runtime/OwnedStagedOutput-D31dOozz.js +126 -0
- package/dist/cli-runtime/{PrivateRuntimeRoot-DAy0PiBM.js → PrivateRuntimeRoot-Cd23u6jd.js} +39 -6
- package/dist/cli-runtime/ProcessOwnership-CtrNr6ee.js +545 -0
- package/dist/cli-runtime/{ProcessOwnership-DXC5-UWt.js → ProcessOwnershipObservation-C006iCtZ.js} +149 -607
- package/dist/cli-runtime/{ProviderDeadline-8m2pFRDc.js → ProviderDeadline-rSuH4Pm8.js} +27 -1
- package/dist/cli-runtime/ProviderOperationExecution-CmU-XrQr.js +38 -0
- package/dist/cli-runtime/{snapshotEnvironment-D_tWyOub.js → ProviderProcess-D87A7ctp.js} +117 -160
- package/dist/cli-runtime/RegularFileRead-mbgGYtxe.js +125 -0
- package/dist/cli-runtime/{SafeOutputTree-D6U15GXd.js → SafeOutputTree-i904hd_2.js} +21 -20
- package/dist/cli-runtime/{SetupHost-FkYWswsq.js → SetupHost-CMPmPraB.js} +365 -195
- package/dist/cli-runtime/SharedStartupAttempt-BxKyf3Uv.js +1424 -0
- package/dist/cli-runtime/StableFileHash-Ame_h3lY.js +61 -0
- package/dist/cli-runtime/{SupportedClients-DaX6Lt2d.js → SupportedClients-DMafjitv.js} +89 -72
- package/dist/cli-runtime/{Update-CbTC_eg1.js → Update-DAsASWlE.js} +1 -1
- package/dist/cli-runtime/{AbortablePromise-BVBemxbD.js → WindowsBatchCommand-Cx9kaVNf.js} +2 -28
- package/dist/cli-runtime/WindowsNativeLoader-BqyZO0ZD.js +142 -0
- package/dist/cli-runtime/{ZipArtifactReader-B8ZgNe4D.js → ZipArtifactReader-Jed69LEL.js} +20 -16
- package/dist/cli-runtime/{analysisErrorCleanup-Do6YeeoD.js → analysisErrorCleanup-COdAmDsb.js} +4 -3
- package/dist/cli-runtime/{appleArchiveFormat-tVoI2ykA.js → appleArchiveFormat-Bb3G5CCI.js} +13 -7
- package/dist/cli-runtime/{application__DirectAnalysisStatus-DpOejOf0.js → application__DirectAnalysisStatus-F74bu9oy.js} +10 -10
- package/dist/cli-runtime/{application__EnhancedTools-oFE2bOjs.js → application__EnhancedTools-Bg51b0Yp.js} +84 -51
- package/dist/cli-runtime/{application__FunctionAnalysisEvidence-B6osuhvW.js → application__FunctionAnalysisEvidence-DBWIaYCh.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionCoverageService-DN3wTFQj.js → application__ReconstructionCoverageService-AEPNpZqJ.js} +3 -3
- package/dist/cli-runtime/{application__ReconstructionObligationLedgerService-CKcTppX9.js → application__ReconstructionObligationLedgerService-Cl9cPEZf.js} +22 -9
- package/dist/cli-runtime/{application__Setup-XpMaRNjy.js → application__Setup-DwQzEewK.js} +30 -18
- package/dist/cli-runtime/{application__Uninstall-_23pU2yB.js → application__Uninstall-BOf9oyvQ.js} +78 -37
- package/dist/cli-runtime/{application__UpdateRuntime-DPvY8ohd.js → application__UpdateRuntime-CzWkRJHa.js} +119 -29
- package/dist/cli-runtime/{application__android__AndroidApplicationService-CFgIFPM4.js → application__android__AndroidApplicationService-shW_aKlj.js} +3 -3
- package/dist/cli-runtime/{application__apple__AppleApplicationService-Db6QCsun.js → application__apple__AppleApplicationService-DIv6d3wB.js} +3 -3
- package/dist/cli-runtime/{application__harmony__HarmonyApplicationService-CFjocHoK.js → application__harmony__HarmonyApplicationService-OIUFVQFV.js} +3 -3
- package/dist/cli-runtime/{application__javascript__ElectronActiveObservationService-CmVDUI_Z.js → application__javascript__ElectronActiveObservationService-wvCh72hK.js} +3 -3
- package/dist/cli-runtime/application__javascript__ElectronObservationService-SydXPCwM.js +88 -0
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationService-CCkp8KBh.js → application__javascript__JavaScriptApplicationService-o0uEsjEc.js} +1120 -316
- package/dist/cli-runtime/{application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js → application__javascript__JavaScriptApplicationWorkflowService-BAheG_71.js} +51 -44
- package/dist/cli-runtime/{application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js → application__javascript__JavaScriptRuntimeReconciliationService-Cnn4GP8q.js} +5 -5
- package/dist/cli-runtime/{application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js → application__javascript__JavaScriptSemanticTraceService-CmvLfV1A.js} +6 -6
- package/dist/cli-runtime/{artifacts__ArtifactProvider-zXI0QjSL.js → artifacts__ArtifactProvider-wx2K0F2I.js} +377 -359
- package/dist/cli-runtime/{binary-BVOr2mgE.js → binary-CWVNJhAC.js} +8561 -3159
- package/dist/cli-runtime/{catalogIdentity-DLoXgfIR.js → catalogIdentity-DAEEsOdX.js} +260 -81
- package/dist/cli-runtime/cli.js +6177 -3556
- package/dist/cli-runtime/{cliOutput-BC1BdAcB.js → cliOutput-CgSuw782.js} +47 -6
- package/dist/cli-runtime/cliOutput.js +2 -2
- package/dist/cli-runtime/cliResultOutput-10sd6xGx.js +1453 -0
- package/dist/cli-runtime/cliResultOutput.js +2 -1
- package/dist/cli-runtime/{composition__browserScenario-DHXC1a8n.js → composition__browserScenario-BtPb1c1y.js} +843 -356
- package/dist/cli-runtime/{composition__electronObservation-GecK2EID.js → composition__electronObservation-Bk8R6DJo.js} +128 -69
- package/dist/cli-runtime/{composition__electronScenario-CEZnVrAL.js → composition__electronScenario-BVF0qStH.js} +398 -135
- package/dist/cli-runtime/{cutterToolContracts-TZH9EHr5.js → cutterToolContracts-BQtG_Nzo.js} +195 -62
- package/dist/cli-runtime/{doctorRuntime-BE5ZX8it.js → doctorRuntime-B__SIpm-.js} +241 -21
- package/dist/cli-runtime/{dotnet__ManagedStaticProvider-C8_yZCDc.js → dotnet__ManagedStaticProvider-DO5Yzcp4.js} +1 -1
- package/dist/cli-runtime/{errorSchemas-CTRmvMl3.js → errorSchemas-Ixz_q7qt.js} +58 -4
- package/dist/cli-runtime/homeDirectory-DC_DeJIg.js +18 -0
- package/dist/cli-runtime/{javascriptApplicationAnalysis-HgMzVMQw.js → javascriptApplicationAnalysis-Dk6yBV8g.js} +688 -668
- package/dist/cli-runtime/{javascriptExportReturnShapeProjection-Dg00g35t.js → javascriptExportReturnShapeProjection-CObOIiQ6.js} +3 -3
- package/dist/cli-runtime/{javascriptExportShapeComparisonSchemas-BYnoIqIk.js → javascriptExportShapeComparisonSchemas-DpwuBenh.js} +5 -3
- package/dist/cli-runtime/{javascriptRuntimeReconciliation-DNjDoL3S.js → javascriptRuntimeReconciliation-C6ZgWMys.js} +61 -59
- package/dist/cli-runtime/{javascriptRuntimeReconciliationSchemas-BWpGWNcI.js → javascriptRuntimeReconciliationSchemas-D6tZKUQs.js} +2 -2
- package/dist/cli-runtime/{javascriptSemanticTraceSchemas-BTCNcvbc.js → javascriptSemanticTraceSchemas-C7m0b6_w.js} +3 -3
- package/dist/cli-runtime/{lipo-DSWP6fv-.js → lipo-DPQ6qurH.js} +9 -11
- package/dist/cli-runtime/{logger-CQQCI4a2.js → logger-BuDJ9xxO.js} +2 -2
- package/dist/cli-runtime/{machoContainer-C8BIkkq3.js → machoContainer-Cy98bkFm.js} +180 -0
- package/dist/cli-runtime/{managedApplicationGraph-B08jb3jq.js → managedApplicationGraph-BazVqpJv.js} +16 -10
- package/dist/cli-runtime/{managedToolContracts-D60QmIYj.js → managedToolContracts-BuFkMBH5.js} +2 -2
- package/dist/cli-runtime/mcpDoctor.js +8 -6
- package/dist/cli-runtime/mcpStartupPolicy-imCbM3qo.js +28 -0
- package/dist/cli-runtime/{native__NativeMacOSProvider-YBTvUeJO.js → native__NativeMacOSProvider-DTcRhuGA.js} +1384 -757
- package/dist/cli-runtime/{officialToolContracts-CCFF0an9.js → officialToolContracts-CzzVLx8I.js} +74 -53
- package/dist/cli-runtime/peMachine-B9ggfSJJ.js +95 -0
- package/dist/cli-runtime/propertyListKeys-D5dSASEy.js +355 -0
- package/dist/cli-runtime/{providerCleanupError-Ceq8f0wK.js → providerCleanupError-BhsJyAhk.js} +3 -5
- package/dist/cli-runtime/readArtifactFileChunks-BbTL_PtB.js +129 -0
- package/dist/cli-runtime/{reconstructionObligationLedgerSchemas-Bao0xMr-.js → reconstructionObligationLedgerSchemas-Bi6sect1.js} +6329 -3651
- package/dist/cli-runtime/{scanCanonical-KP4T9jSl.js → scanCanonical-CcDFUr-w.js} +233 -363
- package/dist/cli-runtime/snapshotEnvironment-Yvx5qwsl.js +196 -0
- package/dist/cli-runtime/{toolContracts-D2FOG_Nb.js → toolContracts-CJzEyZ38.js} +126 -52
- package/dist/cli-runtime/{toolOutputSchemaGroups-DRiYs1je.js → toolOutputSchemaGroups-BqdSzySu.js} +768 -589
- package/dist/cli-runtime/{workflowInputError-n8Oo-bLA.js → workflowInputError-BP8z9Wxl.js} +2 -2
- package/dist/cli.js +10 -0
- package/dist/cliBrowserScenarioCommands.js +2 -3
- package/dist/cliLogging.js +22 -7
- package/dist/cliObservationOptions.js +3 -0
- package/dist/cliOutput.js +68 -3
- package/dist/composition/binary.js +15 -2
- package/dist/composition/directAnalysis.js +8 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +4 -5
- package/dist/composition/jeb.js +32 -21
- package/dist/config/environment.js +36 -2
- package/dist/config/mcpInputSchemaProfile.js +1 -1
- package/dist/config/parseConfig.js +7 -3
- package/dist/contracts/adb/adbToolContracts.js +2 -2
- package/dist/contracts/analysisViewApiSurfaceExample.js +4 -4
- package/dist/contracts/analysisViewToolContracts.js +42 -1
- package/dist/contracts/android/androidToolContracts.js +1 -1
- package/dist/contracts/apktool/apktoolToolContracts.js +5 -1
- package/dist/contracts/artifactComparisonExample.js +18 -14
- package/dist/contracts/artifactToolContracts.js +2 -1
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +12 -1
- package/dist/contracts/compactInputSchema.js +13 -6
- package/dist/contracts/fridaToolContracts.js +5 -4
- package/dist/contracts/gdbToolContracts.js +2 -3
- package/dist/contracts/inputSchemaPresentation.js +173 -79
- package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +1 -0
- package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +1 -0
- package/dist/contracts/jsonSchemaKeywords.js +29 -0
- package/dist/contracts/managed/managedWorkflowExamples.js +3 -0
- package/dist/contracts/managed/managedWorkflowToolContracts.js +1 -1
- package/dist/contracts/mobileApplicationGraphExamples.js +15 -12
- package/dist/contracts/officialToolContracts.js +2 -2
- package/dist/contracts/rizinDebugToolContracts.js +3 -2
- package/dist/contracts/sessionToolContracts.js +3 -3
- package/dist/contracts/toolEffects.js +6 -2
- package/dist/contracts/toolOutputSchemaGroups.js +7 -4
- package/dist/contracts/toolOutputSchemaPrimitives.js +7 -0
- package/dist/contracts/toolSchemaMetadata.js +99 -27
- package/dist/cutter/CutterBridgeClient.js +206 -67
- package/dist/cutter/CutterBridgeService.js +52 -4
- package/dist/doctorRuntime.js +25 -4
- package/dist/domain/adb/adbDeviceAnalysis.js +19 -1
- package/dist/domain/analysisErrorBase.js +59 -2
- package/dist/domain/analysisErrorCleanup.js +3 -1
- package/dist/domain/analysisErrorCore.js +13 -0
- package/dist/domain/analysisErrorPresentation.js +23 -4
- package/dist/domain/analysisErrorProjection.js +44 -28
- package/dist/domain/analysisSearch.js +26 -0
- package/dist/domain/analysisSnapshot.js +11 -11
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +4 -65
- package/dist/domain/analysisView/analysisView.js +25 -0
- package/dist/domain/analysisView/analysisViewDataAdmission.js +86 -0
- package/dist/domain/analysisView/artifactInventoryView.js +4 -18
- package/dist/domain/analysisView/javascriptApplicationCoverage.js +27 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +100 -27
- package/dist/domain/analysisView/javascriptFactsView.js +92 -0
- package/dist/domain/analysisView/javascriptModuleReferences.js +37 -0
- package/dist/domain/analysisView/managedMemberView.js +6 -0
- package/dist/domain/android/androidApplication.js +8 -7
- package/dist/domain/apktool/apktoolResourceAnalysis.js +52 -2
- package/dist/domain/apple/appleApplication.js +41 -60
- package/dist/domain/apple/appleBundleAnatomy.js +56 -68
- package/dist/domain/apple/dylibResolution.js +5 -1
- package/dist/domain/apple/interfaceBuilderGraph.js +29 -8
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +11 -4
- package/dist/domain/apple/jvmClassFile.js +226 -0
- package/dist/domain/apple/keyedArchive.js +39 -17
- package/dist/domain/apple/machoContainer.js +3 -0
- package/dist/domain/apple/plistNumbers.js +67 -5
- package/dist/domain/apple/plistValue.js +89 -18
- package/dist/domain/artifactComparison.js +7 -5
- package/dist/domain/artifactGraph.js +4 -12
- package/dist/domain/artifactInspection.js +6 -17
- package/dist/domain/artifactInventoryEvidence.js +68 -60
- package/dist/domain/binaryTarget.js +11 -26
- package/dist/domain/binaryTargetTypes.js +10 -0
- package/dist/domain/browserNetworkEvidence.js +20 -3
- package/dist/domain/browserObservation.js +5 -28
- package/dist/domain/browserObservationError.js +4 -4
- package/dist/domain/browserScenarioCapture.js +11 -2
- package/dist/domain/browserScenarioCaptureLimits.js +34 -0
- package/dist/domain/browserScenarioCaptureValues.js +50 -0
- package/dist/domain/browserScenarioDiffEvidence.js +1 -3
- package/dist/domain/browserScenarioValues.js +5 -1
- package/dist/domain/captures/packetCapture.js +2 -1
- package/dist/domain/dosMz.js +14 -5
- package/dist/domain/electron/electronFuseEvidence.js +42 -0
- package/dist/domain/elfFixedHeader.js +24 -0
- package/dist/domain/evidence.js +7 -6
- package/dist/domain/evidenceBundle.js +9 -2
- package/dist/domain/explicitSensitiveFailure.js +3 -0
- package/dist/domain/fileSnapshotObservation.js +25 -0
- package/dist/domain/fixedTupleSchema.js +9 -0
- package/dist/domain/functionCallCoverage.js +6 -6
- package/dist/domain/functionComparisonDimensions.js +38 -11
- package/dist/domain/functionComparisonNormalization.js +17 -9
- package/dist/domain/functionDossierEvidence.js +4 -3
- package/dist/domain/harmony/harmonyApplication.js +8 -8
- package/dist/domain/hopperErrors.js +4 -2
- package/dist/domain/hopperValues.js +27 -4
- package/dist/domain/javascript/electronActiveObservation.js +1 -0
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +80 -20
- package/dist/domain/javascript/electronStaticAnalysisValues.js +0 -20
- package/dist/domain/javascript/electronStaticOptionObjects.js +45 -0
- package/dist/domain/javascript/electronWrappedCallPaths.js +70 -17
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +20 -4
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +4 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +3 -0
- package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +3 -1
- package/dist/domain/javascript/javascriptApplicationVersionItems.js +49 -21
- package/dist/domain/javascript/javascriptAstFingerprint.js +41 -10
- package/dist/domain/javascript/javascriptAstValues.js +83 -5
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +23 -36
- package/dist/domain/javascript/javascriptCommonJsExportReceivers.js +231 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +14 -4
- package/dist/domain/javascript/javascriptFeatureSeed.js +1 -1
- package/dist/domain/javascript/javascriptGraphqlOperations.js +382 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +20 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +7 -11
- package/dist/domain/javascript/javascriptRpcEndpoints.js +7 -171
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +9 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +35 -12
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +50 -45
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +284 -24
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +452 -182
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +37 -20
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +55 -27
- package/dist/domain/javascript/javascriptSemanticCalls.js +4 -4
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +134 -50
- package/dist/domain/javascript/javascriptSemanticCoverage.js +5 -1
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +7 -13
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +33 -10
- package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +1 -1
- package/dist/domain/javascript/javascriptSemanticEvaluationOrder.js +126 -0
- package/dist/domain/javascript/javascriptSemanticExpressionShapes.js +111 -0
- package/dist/domain/javascript/javascriptSemanticGetterQueries.js +147 -0
- package/dist/domain/javascript/javascriptSemanticGetterResults.js +264 -0
- package/dist/domain/javascript/javascriptSemanticGraph.js +18 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +13 -0
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +3 -2
- package/dist/domain/javascript/javascriptSemanticMapOperations.js +51 -0
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +215 -81
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +395 -118
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +241 -328
- package/dist/domain/javascript/javascriptSemanticObjects.js +33 -27
- package/dist/domain/javascript/javascriptSemanticOpaqueEffects.js +163 -0
- package/dist/domain/javascript/javascriptSemanticPrimitives.js +11 -1
- package/dist/domain/javascript/javascriptSemanticProjection.js +44 -67
- package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +2 -1
- package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +1 -1
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +45 -7
- package/dist/domain/javascript/javascriptSemanticResourceLimits.js +3 -19
- package/dist/domain/javascript/javascriptSemanticResources.js +27 -4
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +78 -37
- package/dist/domain/javascript/javascriptSemanticReturns.js +2 -2
- package/dist/domain/javascript/javascriptSemanticState.js +191 -42
- package/dist/domain/javascript/javascriptSemanticValues.js +167 -41
- package/dist/domain/javascript/javascriptSourceParser.js +54 -9
- package/dist/domain/javascript/javascriptStaticAnalysis.js +24 -13
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +276 -16
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +33 -25
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +3 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +1 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +424 -142
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +4 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +12 -1
- package/dist/domain/javascript/sourceToBundleSignals.js +3 -0
- package/dist/domain/managed/managedApplicationGraphNodes.js +14 -9
- package/dist/domain/managed/managedArtifact.js +26 -0
- package/dist/domain/managed/managedMemberComparison.js +3 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +14 -1
- package/dist/domain/managed/managedMemberComparisonItems.js +124 -52
- package/dist/domain/managed/managedMemberComparisonMatch.js +76 -72
- package/dist/domain/managed/managedMemberSignatureIdentity.js +40 -0
- package/dist/domain/managed/managedNativeVerificationMatch.js +5 -5
- package/dist/domain/managed/managedNativeVerificationSchemas.js +2 -2
- package/dist/domain/mobileApplicationGraphProjection.js +33 -18
- package/dist/domain/native/bytePattern.js +21 -0
- package/dist/domain/native/nativeAotPe.js +29 -2
- package/dist/domain/native/nativeAotSnapshotObservation.js +18 -0
- package/dist/domain/native/nativeCallPartialObservation.js +14 -12
- package/dist/domain/native/nativeLoadImage.js +13 -0
- package/dist/domain/native/objcSwiftMetadata.js +15 -8
- package/dist/domain/native/peResources.js +6 -2
- package/dist/domain/peMachine.js +2 -0
- package/dist/domain/process/processComparison.js +3 -3
- package/dist/domain/process/processTraceDimensionProjection.js +1 -1
- package/dist/domain/process/processTraceEvaluation.js +65 -24
- package/dist/domain/propertyListKeys.js +84 -69
- package/dist/domain/propertyListXml.js +149 -0
- package/dist/domain/providerAdapterError.js +2 -0
- package/dist/domain/providerCleanupError.js +2 -4
- package/dist/domain/rawBinary.js +11 -2
- package/dist/domain/reconstructionCoverage.js +35 -23
- package/dist/domain/reconstructionCoverageEvaluation.js +36 -36
- package/dist/domain/reconstructionCoverageEvidence.js +26 -0
- package/dist/domain/reconstructionVerification.js +40 -26
- package/dist/domain/referenceSourceImportParsing.js +4 -0
- package/dist/domain/referenceSourcePathIdentity.js +2 -0
- package/dist/domain/referenceSourceRequireBindings.js +40 -101
- package/dist/domain/relationshipCoverage.js +4 -5
- package/dist/domain/sqlite/sqliteDatabase.js +2 -1
- package/dist/domain/symbolAnalysis.js +9 -8
- package/dist/domain/webBundleAnalyzerInspection.js +65 -25
- package/dist/domain/webCaptureDiff.js +124 -41
- package/dist/domain/webInventory.js +28 -14
- package/dist/domain/webModuleTrace.js +22 -0
- package/dist/domain/webScriptExportError.js +2 -3
- package/dist/domain/xmlDocument.js +41 -0
- package/dist/domain/zipPackageFormat.js +0 -4
- package/dist/dotnet/ManagedArtifactInspector.js +2 -4
- package/dist/dotnet/ManagedDecodeBudget.js +21 -1
- package/dist/dotnet/ManagedMemberInspector.js +31 -6
- package/dist/dotnet/ManagedMemberInspectorCore.js +63 -12
- package/dist/dotnet/ManagedMemberRows.js +8 -8
- package/dist/dotnet/ManagedMetadataHeaps.js +0 -1
- package/dist/dotnet/ManagedMetadataLayout.js +17 -15
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +20 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +7 -8
- package/dist/dotnet/ManagedPeReader.js +5 -0
- package/dist/dotnet/ManagedSnapshot.js +25 -20
- package/dist/dotnet/ManagedTypeNameDigests.js +177 -0
- package/dist/dotnet/ManagedTypeNames.js +6 -46
- package/dist/dotnet/ManagedTypeNesting.js +25 -0
- package/dist/dotnet/ManagedTypeReferences.js +94 -0
- package/dist/electron/ElectronFuseFailures.js +105 -0
- package/dist/electron/ElectronFusePath.js +4 -3
- package/dist/electron/ElectronFuseProvider.js +67 -92
- package/dist/electron/ElectronFuseReader.js +46 -30
- package/dist/evm/EvmoleFailures.js +1 -0
- package/dist/evm/EvmoleInterfaceProvider.js +13 -16
- package/dist/filesystem/OwnedRegularFile.js +116 -0
- package/dist/filesystem/OwnedStagedOutput.js +28 -11
- package/dist/filesystem/RegularFile.js +20 -8
- package/dist/filesystem/StableFileHash.js +56 -38
- package/dist/filesystem/callerPath.js +26 -0
- package/dist/filesystem/readFileHandleChunks.js +55 -5
- package/dist/filesystem/readStableFileBytes.js +85 -0
- package/dist/firmware/FirmwareCommand.js +13 -7
- package/dist/firmware/FirmwareFailures.js +56 -0
- package/dist/firmware/FirmwareFiles.js +128 -98
- package/dist/firmware/FirmwareProvider.js +120 -65
- package/dist/firmware/FirmwarePublication.js +26 -11
- package/dist/flutter/DartElf.js +27 -0
- package/dist/flutter/FlutterBuildProvider.js +44 -4
- package/dist/gdb/GdbSessionManager.js +202 -14
- package/dist/generatedPackageMetadata.js +1 -1
- package/dist/ghidra/GhidraAnalysisProfile.js +24 -10
- package/dist/ghidra/GhidraAnalysisSeeds.js +39 -55
- package/dist/ghidra/GhidraBridgeSources.js +12 -0
- package/dist/ghidra/GhidraClient.js +362 -148
- package/dist/ghidra/GhidraClientStartup.js +5 -3
- package/dist/ghidra/GhidraClientWire.js +5 -2
- package/dist/ghidra/GhidraDiagnostics.js +16 -5
- package/dist/ghidra/GhidraDoctor.js +45 -14
- package/dist/ghidra/GhidraDosSnapshot.js +83 -0
- package/dist/ghidra/GhidraExecutableHeader.js +54 -0
- package/dist/ghidra/GhidraFileArtifacts.js +93 -0
- package/dist/ghidra/GhidraFunctionValues.js +1 -0
- package/dist/ghidra/GhidraInstallation.js +143 -142
- package/dist/ghidra/GhidraInstallationPolicy.js +20 -79
- package/dist/ghidra/GhidraInstallationProperties.js +57 -0
- package/dist/ghidra/GhidraInventoryValues.js +22 -6
- package/dist/ghidra/GhidraJavaLaunch.js +11 -4
- package/dist/ghidra/GhidraJavaProbe.js +267 -0
- package/dist/ghidra/GhidraJavaProperties.js +9 -7
- package/dist/ghidra/GhidraLanguageCatalog.js +12 -7
- package/dist/ghidra/GhidraLauncher.js +128 -65
- package/dist/ghidra/GhidraLoadImageAttest.js +75 -78
- package/dist/ghidra/GhidraLoadImageValues.js +39 -29
- package/dist/ghidra/GhidraMipsProfile.js +13 -5
- package/dist/ghidra/GhidraNativeAotSnapshotOwner.js +221 -0
- package/dist/ghidra/GhidraPeProfile.js +88 -18
- package/dist/ghidra/GhidraProvider.js +219 -32
- package/dist/ghidra/GhidraProviderCapabilities.js +17 -4
- package/dist/ghidra/GhidraProviderClient.js +199 -239
- package/dist/ghidra/GhidraPspExtension.js +104 -34
- package/dist/ghidra/GhidraPspProfile.js +4 -1
- package/dist/ghidra/GhidraRawBinaryLanguage.js +13 -4
- package/dist/ghidra/GhidraReleasePolicy.js +93 -0
- package/dist/ghidra/GhidraRequestQueue.js +64 -40
- package/dist/ghidra/GhidraSessionError.js +152 -19
- package/dist/ghidra/GhidraSessionValues.js +13 -3
- package/dist/ghidra/GhidraSocketConnection.js +25 -11
- package/dist/ghidra/GhidraTargetSnapshot.js +67 -50
- package/dist/ghidra/GhidraTransport.js +86 -63
- package/dist/ghidra/extensions/GhidraExtensions.js +30 -45
- package/dist/go/GoBinaryProvider.js +89 -60
- package/dist/go/GoElfImage.js +3 -3
- package/dist/hopper/BridgeLauncher.js +43 -4
- package/dist/hopper/HopperAnalysisProfile.js +4 -2
- package/dist/hopper/HopperCleanup.js +14 -1
- package/dist/hopper/HopperClient.js +135 -63
- package/dist/hopper/HopperProvider.js +4 -7
- package/dist/hopper/HopperProviderCapabilities.js +2 -1
- package/dist/hopper/HopperRegexSearch.js +21 -60
- package/dist/ida/IdaBusyHealth.js +36 -2
- package/dist/ida/IdaMcpConnection.js +17 -11
- package/dist/ida/IdaNativeProtocol.js +1 -9
- package/dist/ida/IdaOperationRunner.js +8 -26
- package/dist/ida/IdaProtocolValues.js +2 -1
- package/dist/ida/IdaProvider.js +18 -2
- package/dist/ida/IdaSessionClient.js +54 -12
- package/dist/inspector/V8InspectorCaptureProjection.js +7 -0
- package/dist/inspector/V8InspectorProvider.js +2 -0
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +25 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +4 -3
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +3 -2
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +7 -1
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +1 -1
- package/dist/javascript/recovery/RecoveryFiles.js +57 -8
- package/dist/jeb/JebMcpConnection.js +129 -70
- package/dist/jeb/JebMcpConnectionOwner.js +116 -0
- package/dist/jeb/JebMcpDeadline.js +46 -0
- package/dist/jeb/JebProvider.js +77 -51
- package/dist/kuna/KunaAddress.js +11 -0
- package/dist/kuna/KunaCommand.js +217 -0
- package/dist/kuna/KunaConfiguration.js +90 -0
- package/dist/kuna/KunaDoctor.js +198 -0
- package/dist/kuna/KunaInstallation.js +137 -0
- package/dist/kuna/KunaJson.js +23 -0
- package/dist/kuna/KunaJsonStream.js +433 -0
- package/dist/kuna/KunaLimits.js +5 -0
- package/dist/kuna/KunaProjectCache.js +804 -0
- package/dist/kuna/KunaProjectExport.js +202 -0
- package/dist/kuna/KunaProjectFiles.js +191 -0
- package/dist/kuna/KunaProjectReader.js +115 -0
- package/dist/kuna/KunaProvider.js +217 -0
- package/dist/kuna/KunaProviderCapabilities.js +102 -0
- package/dist/kuna/KunaQueryErrors.js +12 -0
- package/dist/kuna/KunaQueryWork.js +113 -0
- package/dist/kuna/KunaReferenceFiles.js +258 -0
- package/dist/kuna/KunaReferenceQueries.js +211 -0
- package/dist/kuna/KunaRelease.js +10 -0
- package/dist/kuna/KunaRunSlots.js +56 -0
- package/dist/kuna/KunaSessionClient.js +1162 -0
- package/dist/kuna/KunaStringInventory.js +145 -0
- package/dist/kuna/KunaStringQueries.js +133 -0
- package/dist/kuna/KunaTargetCommands.js +205 -0
- package/dist/kuna/KunaUnavailable.js +11 -0
- package/dist/main/processShutdown.js +17 -0
- package/dist/main/transport.js +21 -1
- package/dist/main.js +2 -12
- package/dist/mcp/AnalysisProvider-BABWbLoM.js +38 -0
- package/dist/mcp/{AnalysisSnapshotFiles-BAbiJQOc.js → AnalysisSnapshotFiles-BXz0c37-.js} +39 -28
- package/dist/mcp/{ProcessOwnership-Bl_3ejLe.js → ArtifactFileOperation-64cQKI7B.js} +274 -72
- package/dist/mcp/{ArtifactProvider-DViCU_rn.js → ArtifactProvider-Dx6pmil1.js} +371 -354
- package/dist/mcp/ArtifactProviderMetadata-UCJr2oZW.js +167 -0
- package/dist/mcp/{ArtifactReader-OyM03Gjn.js → ArtifactReader-BrnwNaKY.js} +29 -6
- package/dist/mcp/ArtifactResourceScope-zi3Dkqzy.js +175 -0
- package/dist/mcp/{AsarHeader-WsPgoooH.js → AsarHeader-B_IbppTz.js} +1 -1
- package/dist/mcp/{BinarySessionStatus-B4P9gf-S.js → BinarySessionStatus-CZ9nnXMt.js} +5 -4
- package/dist/mcp/{BinaryTargetResolver-BMaE_0H1.js → BinaryTargetResolver-BUncASDP.js} +146 -215
- package/dist/mcp/BoundedFileBytes-DYt5q9G2.js +43 -0
- package/dist/mcp/{CdpCaptureDocuments-HDiF2O7k.js → CdpCaptureDocuments-Y2uFcBpl.js} +194 -145
- package/dist/mcp/{CdpCaptureValues-M-j6CIh1.js → CdpCaptureValues-tNIg-gQK.js} +12 -5
- package/dist/mcp/{CdpConnection-BpDfz4MK.js → CdpEndpoint-BrhMhpSi.js} +352 -281
- package/dist/mcp/{CdpOptionalCommand-BPjRD9Kz.js → CdpOptionalCommand-PZZhlqxv.js} +2 -2
- package/dist/mcp/CdpTargetSession-BmmDC3XO.js +290 -0
- package/dist/mcp/{DirectAnalysis-DrafbXke.js → DirectAnalysis-B9KuCHTG.js} +29 -21
- package/dist/mcp/{DirectAnalysisStatus-CjjeDLzW.js → DirectAnalysisStatus-BgzopkIt.js} +7 -7
- package/dist/mcp/{ElectronFileScope-BPG_YoyU.js → ElectronFileScope-FXtK0d6I.js} +1 -1
- package/dist/mcp/ElectronFuseFailures-uZ_wOV6T.js +610 -0
- package/dist/mcp/MachoLoadCommandReader-C2VGgHA3.js +330 -0
- package/dist/mcp/{ManagedStaticProvider-BthZbKyZ.js → ManagedStaticProvider-CZuoPme2.js} +429 -131
- package/dist/mcp/{NativeMacOSProvider-Bh79k8dI.js → NativeMacOSProvider-CMguKrvN.js} +1376 -748
- package/dist/mcp/{NativeMacOSProviderMetadata-N1lPOaY_.js → NativeMacOSProviderMetadata-B_RH4KXF.js} +97 -7
- package/dist/mcp/{ProviderDeadline-DskQ94YD.js → OwnedCommand-BW1jBSt9.js} +436 -127
- package/dist/mcp/ProcedureAddressResolution-H6Qwpb_Y.js +59 -0
- package/dist/mcp/{WorkflowEvidence-umWrB_wm.js → WorkflowEvidence-CO4C7ALz.js} +16 -9
- package/dist/mcp/analysisErrorCleanup-Q344SnTO.js +34 -0
- package/dist/mcp/analysisErrorCore-BIEP7tvF.js +509 -0
- package/dist/mcp/{analysisErrorProjection-BN0EPM-3.js → analysisErrorProjection-B8teQwwD.js} +80 -30
- package/dist/mcp/{artifactToolContracts-Di4qZlEt.js → artifactToolContracts-C9dRDo-D.js} +6 -4
- package/dist/mcp/{browserObservation-C0s4i8UI.js → browserObservation-DUraZs62.js} +272 -107
- package/dist/mcp/{browserObservationError-CyLugqX4.js → browserObservationError-C5okJ5el.js} +27 -4
- package/dist/mcp/{browserObservationSchemas-tgqjH7aA.js → browserObservationSchemas-DwGGxBpu.js} +3 -3
- package/dist/mcp/{browserScenario-CAQ8Fns9.js → browserScenario-BRUz7yN0.js} +844 -358
- package/dist/mcp/{browserScenarioCapture-CTNFN-FI.js → browserScenarioCapture-CiMAsMx8.js} +127 -11
- package/dist/mcp/{InterfaceBuilderDecodeBudget-5F2AkxJT.js → callerPath-CpPnMZyN.js} +91 -65
- package/dist/mcp/{electronActiveObservation-lDvQTMR0.js → electronActiveObservation-DV0Ffy9X.js} +1 -0
- package/dist/mcp/electronFuses-D5SS7XXw.js +367 -0
- package/dist/mcp/{electronObservation-i7LcILQ-.js → electronObservation-DsN-NqY1.js} +134 -75
- package/dist/mcp/{electronObservation-DFOFEood.js → electronObservation-wOYWwqgF.js} +3 -3
- package/dist/mcp/{electronScenario-nCzE6IfJ.js → electronScenario-CYrt2zBK.js} +395 -135
- package/dist/mcp/{emptyArraySchema-tL6Qymyd.js → emptyArraySchema-C0o2Sxwp.js} +2 -2
- package/dist/mcp/{enhancedInputs-DgdEnzHy.js → enhancedInputs-6CCgB3VB.js} +1 -1
- package/dist/mcp/{javascriptRuntimeObservation-61NhCf7H.js → javascriptRuntimeObservation-BVbhkO2-.js} +12 -9
- package/dist/mcp/{javascriptRuntimeObservation-PIUoLfX6.js → javascriptRuntimeObservation-Cu0Yedqq.js} +2 -2
- package/dist/mcp/{lipo-Bnkoq_6W.js → lipo-DSTgUqL1.js} +11 -118
- package/dist/mcp/{logger-BQY5ulYv.js → logger-BGdGHadX.js} +2 -2
- package/dist/mcp/machoContainer-CMSxUBlK.js +605 -0
- package/dist/mcp/{main-kBXHZ8S5.js → main-Cx-Z7m_n.js} +16788 -5902
- package/dist/mcp/main.js +1 -1
- package/dist/mcp/{managedToolContracts-CK--I_s7.js → managedToolContracts-CSlbKJP-.js} +3 -3
- package/dist/mcp/{nativeValueTrace-DR9UE62L.js → nativeValueTrace-BEZbDieM.js} +2630 -2468
- package/dist/mcp/{officialToolContracts-B67NJ2tC.js → officialToolContracts-CauCcSsc.js} +74 -55
- package/dist/mcp/peMachine-aP1iYnHq.js +95 -0
- package/dist/mcp/propertyListKeys-BfCo0k4w.js +356 -0
- package/dist/mcp/providerCleanupError-DIRHxzWo.js +125 -0
- package/dist/mcp/{providerOperationHealth-CTYa3iLf.js → providerOperationHealth-9DRSGM8N.js} +24 -1
- package/dist/mcp/{scanCanonical-CRXSpule.js → scanCanonical-CF3ATd1V.js} +269 -463
- package/dist/mcp/{serverIdentity-Cio4iFV3.js → serverIdentity-BK0Ejd_Y.js} +262 -83
- package/dist/mcp/{sourceMapEnvelope-C0uJlrOh.js → sourceMapEnvelope-DAaRUIGj.js} +4 -4
- package/dist/mcp/{toolContracts-BW05wpcr.js → toolContracts-BPoHQdlC.js} +541 -327
- package/dist/mcp/{toolOutputSchemaGroups-ColvNZ1r.js → toolOutputSchemaGroups-MJ_f-PMK.js} +2551 -2354
- package/dist/mcp/{webContentArtifact-Dzjc1z-R.js → webContentArtifact-DfGkgDcI.js} +2 -17
- package/dist/mcp/{webRuntime-K__NYzXm.js → webRuntime-ccyhkRru.js} +2 -2
- package/dist/mcp/{webSourceLocation-DbMAT2J9.js → webSourceLocation-DKIum0vJ.js} +6451 -4414
- package/dist/mcpDoctor.js +4 -2
- package/dist/mcpStartupPolicy.js +18 -3
- package/dist/native/AppleDispatchMetadata.js +76 -27
- package/dist/native/AppleMachoFixups.js +20 -10
- package/dist/native/AppleObjcCategories.js +12 -1
- package/dist/native/AppleObjcDispatchFacets.js +21 -12
- package/dist/native/AppleObjcProperties.js +61 -17
- package/dist/native/AppleObjcProtocols.js +25 -7
- package/dist/native/AppleSwiftVtables.js +2 -0
- package/dist/native/CommandRunner.js +13 -9
- package/dist/native/LldbCallTracer.js +232 -178
- package/dist/native/LldbReadbackFiles.js +70 -0
- package/dist/native/LldbRetainedObservations.js +28 -56
- package/dist/native/NativeCallObservation.js +53 -52
- package/dist/native/NativeCallTarget.js +95 -0
- package/dist/native/NativeMacOSProvider.js +240 -171
- package/dist/native/NativeMachoInspection.js +21 -7
- package/dist/native/NativePlistSource.js +179 -0
- package/dist/native/NativeUiCleanupError.js +30 -0
- package/dist/native/NativeUiHelperRuntime.js +48 -35
- package/dist/native/NativeUiObservation.js +67 -45
- package/dist/native/SignatureTargetBinding.js +72 -53
- package/dist/native/parsers/demangle.js +16 -12
- package/dist/native/parsers/machoUuid.js +4 -4
- package/dist/native/parsers/otool.js +57 -17
- package/dist/native/parsers/plist.js +40 -25
- package/dist/native/pe/PeResourceLayout.js +22 -7
- package/dist/native/pe/PeResourceParser.js +10 -9
- package/dist/native/pe/PeResourcesProvider.js +63 -16
- package/dist/native/pwndbg/CoreFileMappingAuthority.js +51 -0
- package/dist/native/pwndbg/PwndbgCoreContext.js +26 -15
- package/dist/native/pwntools/PwntoolsDecoder.js +116 -53
- package/dist/native/pwntools/PwntoolsFailures.js +17 -3
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +11 -1
- package/dist/objdump/ObjdumpCommand.js +5 -2
- package/dist/pcap/PcapOutput.js +38 -2
- package/dist/pcap/PcapProvider.js +45 -15
- package/dist/pcap/PcapSnapshot.js +24 -4
- package/dist/process/ArtifactAnalysisResources.js +145 -52
- package/dist/process/BoundedFileBytes.js +8 -3
- package/dist/process/CurrentEntrypointPath.js +3 -1
- package/dist/process/DarwinProcessRunTokenReader.js +174 -63
- package/dist/process/DetachedPgpSignature.js +57 -0
- package/dist/process/ExecFileOutput.js +14 -11
- package/dist/{hopper/HopperTargetLease.js → process/HopperLease.js} +10 -0
- package/dist/process/LinuxResourceLimits.js +4 -24
- package/dist/process/OwnedCommand.js +109 -14
- package/dist/process/ProviderProcess.js +129 -10
- package/dist/process/RegexMatcher.js +96 -0
- package/dist/process/SharedStartupAttempt.js +59 -0
- package/dist/process/WindowsAuthority.js +1 -1
- package/dist/process/capture/FilesystemSnapshot.js +3 -2
- package/dist/process/capture/ProcessCaptureError.js +55 -17
- package/dist/process/capture/ProcessCaptureLifecycle.js +17 -20
- package/dist/process/capture/ProcessCaptureProgress.js +5 -3
- package/dist/process/capture/ProcessHarness.js +17 -3
- package/dist/process/snapshotEnvironment.js +8 -8
- package/dist/{application/binary → providers}/AnalysisClientCleanup.js +3 -3
- package/dist/providers/AnalysisClientCreation.js +193 -0
- package/dist/providers/AnalysisClientFailure.js +191 -0
- package/dist/providers/DeferredAnalysisClient.js +48 -0
- package/dist/providers/OwnedCommandCleanup.js +65 -0
- package/dist/providers/ProviderInspectionScope.js +10 -0
- package/dist/recordedCatalogDigests.js +2 -0
- package/dist/reference/ReferenceSourceReader.js +64 -0
- package/dist/reference/ReferenceSourceReaderEntries.js +12 -3
- package/dist/reference/ReferenceSourceReaderFile.js +2 -1
- package/dist/rizin/RizinCommand.js +2 -2
- package/dist/rizin/RizinDebugSessionManager.js +249 -210
- package/dist/rust/RustBinaryProvider.js +55 -23
- package/dist/server/EvidenceMcpServer.js +2 -2
- package/dist/server/contractToolHandler.js +17 -11
- package/dist/server/createServer.js +27 -8
- package/dist/server/promptCompletion.js +24 -22
- package/dist/server/registerArtifactComparisonTool.js +13 -2
- package/dist/server/registerBrowserScenarioTool.js +7 -5
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerCutterTools.js +2 -3
- package/dist/server/registerElectronTools.js +2 -13
- package/dist/server/registerFridaTools.js +8 -12
- package/dist/server/registerInvestigationTools.js +20 -20
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +2 -4
- package/dist/server/registerManagedWorkflowTools/evidence.js +14 -7
- package/dist/server/registerProcessComparisonTool.js +3 -0
- package/dist/server/registerSessionStatusTool.js +13 -6
- package/dist/server/registerSessionTools.js +16 -29
- package/dist/server/runDerivedOperation.js +2 -0
- package/dist/signals/SigrokRecordingProvider.js +13 -6
- package/dist/sqlite/SqliteDatabaseFailures.js +25 -12
- package/dist/sqlite/SqliteDatabaseInspection.js +27 -12
- package/dist/sqlite/SqliteDatabaseSnapshot.js +58 -32
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +18 -3
- package/dist/wasm/WabtArtifactProvider.js +64 -42
- package/dist/wasm/WabtFailures.js +19 -1
- package/dist/wasm/WabtRuntime.js +58 -0
- package/dist/wasm/WasmGlueAdapter.js +20 -7
- package/dist/windows/WindowsNativeLoader.js +16 -2
- package/dist/windows/WindowsPrivateRuntime.js +44 -1
- package/licenses/npm-dependencies.txt +146 -1
- package/licenses/npm-runtime-notices.txt +175 -1
- package/native/windows/README.md +44 -7
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +11 -3
- package/scripts/electron-active-hook-boundaries.cjs +15 -2
- package/scripts/electron-active-hook.cjs +408 -46
- package/scripts/hopper-demo-x11.py +12 -10
- package/scripts/rea.mjs +62 -15
- package/skills/reverse-engineer-anything/SKILL.md +21 -7
- package/skills/reverse-engineer-anything/references/android-applications.md +3 -1
- package/skills/reverse-engineer-anything/references/javascript-applications.md +44 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +30 -10
- package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +0 -114
- package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +0 -36
- package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +0 -1094
- package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +0 -428
- package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +0 -434
- package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +0 -112
- package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +0 -139
- package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +0 -125
- package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +0 -497
- package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +0 -63
- package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +0 -27
- package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +0 -40
- package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +0 -780
- package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +0 -21
- package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +0 -248
- package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +0 -25
- package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +0 -38
- package/dist/hopper/HopperRegexWorker.js +0 -27
- package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +0 -76
- package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +0 -162
- package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +0 -68
- package/dist/mcp/CdpTargetSession-BsPoKhEU.js +0 -86
- package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +0 -19
- package/dist/mcp/analysisErrorCore-DXRTvF_m.js +0 -235
- package/dist/mcp/artifactOperationError-CkHMMaf7.js +0 -27
- package/dist/mcp/digests-BFoWUT_-.js +0 -223
- package/dist/mcp/propertyListKeys-DD25WsjI.js +0 -553
- package/dist/mcp/providerAdapterError-sDxToNal.js +0 -25
- package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +0 -26
|
@@ -0,0 +1,1781 @@
|
|
|
1
|
+
import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
|
|
2
|
+
import { err, init_binaryTargetTypes, init_result, isMachOFormat, ok } from "./reconstructionObligationLedgerSchemas-Bi6sect1.js";
|
|
3
|
+
import { AnalysisAccessDeniedError, AnalysisArtifactChangedError, AnalysisCancelledError, AnalysisError, AnalysisResourceConstraintError, ConfigurationError, init_analysisErrorBase, init_analysisErrorCore, init_configurationErrors, init_jsonValue, jsonValueSchema } from "./errorSchemas-Ixz_q7qt.js";
|
|
4
|
+
import { NonRegularFileReadError, RegularFileChangedError, RegularFileCleanupFailure, assertRegularFileActive, init_OwnedRegularFile, init_RegularFile, regularFileCancellation, sameRegularFileState, withOwnedRegularFile } from "./OwnedRegularFile-D1f5nUCx.js";
|
|
5
|
+
import { ArtifactReaderFailure, init_ArtifactReader } from "./ArtifactReader-DMwm42bk.js";
|
|
6
|
+
import { AnalysisCleanupLease, init_AnalysisCleanupLease } from "./AnalysisCleanupLease-CWfTGYKd.js";
|
|
7
|
+
import { ArtifactFileCancelled, ArtifactFileCleanupFailure, artifactFileCancellationCause, artifactFilePrimaryFailure, assertArtifactReadActive, bindArtifactFileCleanup, init_ArtifactFileOperation, mapArtifactFileFailure, withArtifactFileHandle, withArtifactRegularFile } from "./ArtifactFileOperation-Dg4BcoEM.js";
|
|
8
|
+
import { ProviderAdapterError, hopperStartupExitCode, init_analysisErrorProjection, init_hopperStartupFailure, init_providerAdapterError, isHopperStartupFailureCode, projectAnalysisError } from "./cliResultOutput-10sd6xGx.js";
|
|
9
|
+
import { analysisErrorWithCleanupFailure, init_analysisErrorCleanup } from "./analysisErrorCleanup-COdAmDsb.js";
|
|
10
|
+
import { ProviderCleanupError, init_providerCleanupError } from "./providerCleanupError-BhsJyAhk.js";
|
|
11
|
+
import { DarwinProcessOwnershipInspectionError, boundedUtf8Text, init_DarwinProcessRunTokenReader, init_boundedUtf8Text } from "./ProcessOwnershipObservation-C006iCtZ.js";
|
|
12
|
+
import { execFileOutput, execFileOutputFailure, init_ExecFileOutput } from "./ExecFileOutput-D6KLYTve.js";
|
|
13
|
+
import { init_providerStartupTimeout, providerStartupTimeoutSchema } from "./providerStartupTimeout-B2tF2LtZ.js";
|
|
14
|
+
import { init_safeJson, safeParseJson } from "./safeJson-DKKACtdy.js";
|
|
15
|
+
import { ProviderProcessSupervisor, init_ProviderProcess, spawnOwnedProviderProcess } from "./ProviderProcess-D87A7ctp.js";
|
|
16
|
+
import { cleanupOwnedProcessGroup, init_ProcessOwnership } from "./ProcessOwnership-CtrNr6ee.js";
|
|
17
|
+
import { OwnedCommandFailure, init_OwnedCommand, init_snapshotEnvironment, prepareOwnedCommand, runOwnedCommand, snapshotEnvironment } from "./snapshotEnvironment-Yvx5qwsl.js";
|
|
18
|
+
import { homeDirectoryFromEnvironment, init_homeDirectory } from "./homeDirectory-DC_DeJIg.js";
|
|
19
|
+
import { hashStableFile, init_StableFileHash, stableFileHashCause } from "./StableFileHash-Ame_h3lY.js";
|
|
20
|
+
import { init_binaryTarget, parseExecutableHeader } from "./BinaryTargetResolver-tuCTjBlQ.js";
|
|
21
|
+
import { analysisClientFailureForOperation, init_AnalysisClientFailure, init_OwnedCommandCleanup, retainOwnedCommandCleanup } from "./OwnedCommandCleanup-BN_V6Erc.js";
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
import { delimiter, dirname, isAbsolute, join, posix, win32 } from "node:path";
|
|
24
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
25
|
+
import { accessSync, constants, readFileSync, realpathSync, statSync } from "node:fs";
|
|
26
|
+
import { access, lstat, open, realpath, stat } from "node:fs/promises";
|
|
27
|
+
|
|
28
|
+
//#region dist/hopper/LinuxPrivateDisplayDiagnostic.js
|
|
29
|
+
var LINUX_PRIVATE_DISPLAY_DIAGNOSTIC_PREFIX, diagnosticContextSchema, failureCodeSchema, diagnosticSchema, parseLinuxPrivateDisplayDiagnostic;
|
|
30
|
+
function init_LinuxPrivateDisplayDiagnostic() {
|
|
31
|
+
return (init_LinuxPrivateDisplayDiagnostic = __esmMin((() => {
|
|
32
|
+
init_hopperStartupFailure();
|
|
33
|
+
init_safeJson();
|
|
34
|
+
LINUX_PRIVATE_DISPLAY_DIAGNOSTIC_PREFIX = "REA_X11_DIAGNOSTIC=";
|
|
35
|
+
diagnosticContextSchema = z.object({
|
|
36
|
+
component: z.literal("hopper_private_display"),
|
|
37
|
+
operation: z.enum(["probe", "launch"]),
|
|
38
|
+
reason: z.string().regex(/^[a-z0-9_]+$/u),
|
|
39
|
+
socket_directory: z.literal("/tmp/.X11-unix"),
|
|
40
|
+
socket_directory_mode: z.string().regex(/^[0-7]{4}$/u).nullable(),
|
|
41
|
+
mount_read_only: z.boolean().nullable(),
|
|
42
|
+
effective_socket_directory_mode: z.string().regex(/^[0-7]{4}$/u).nullable(),
|
|
43
|
+
effective_mount_read_only: z.boolean().nullable(),
|
|
44
|
+
wsl: z.boolean(),
|
|
45
|
+
strategy: z.enum([
|
|
46
|
+
"direct",
|
|
47
|
+
"user-mount-namespace",
|
|
48
|
+
"unavailable"
|
|
49
|
+
]),
|
|
50
|
+
fallback_reason: z.string().regex(/^[a-z0-9_]+$/u).nullable(),
|
|
51
|
+
xvfb_stderr_bytes: z.number().int().nonnegative().safe()
|
|
52
|
+
});
|
|
53
|
+
failureCodeSchema = z.string().transform((value, context) => {
|
|
54
|
+
if (isHopperStartupFailureCode(value)) return value;
|
|
55
|
+
context.addIssue({
|
|
56
|
+
code: "custom",
|
|
57
|
+
message: "Unknown startup failure code"
|
|
58
|
+
});
|
|
59
|
+
return z.NEVER;
|
|
60
|
+
});
|
|
61
|
+
diagnosticSchema = z.discriminatedUnion("status", [diagnosticContextSchema.extend({
|
|
62
|
+
status: z.literal("ready"),
|
|
63
|
+
failure_code: z.null()
|
|
64
|
+
}).strict(), diagnosticContextSchema.extend({
|
|
65
|
+
status: z.literal("error"),
|
|
66
|
+
failure_code: failureCodeSchema
|
|
67
|
+
}).strict()]);
|
|
68
|
+
parseLinuxPrivateDisplayDiagnostic = (stderr) => {
|
|
69
|
+
const records = stderr.split("\n").filter((line) => line.startsWith(LINUX_PRIVATE_DISPLAY_DIAGNOSTIC_PREFIX));
|
|
70
|
+
if (records.length === 0) return {
|
|
71
|
+
ok: false,
|
|
72
|
+
reason: "diagnostic_missing"
|
|
73
|
+
};
|
|
74
|
+
if (records.length !== 1) return {
|
|
75
|
+
ok: false,
|
|
76
|
+
reason: "diagnostic_multiple"
|
|
77
|
+
};
|
|
78
|
+
const record = records[0];
|
|
79
|
+
if (record === undefined) return {
|
|
80
|
+
ok: false,
|
|
81
|
+
reason: "diagnostic_missing"
|
|
82
|
+
};
|
|
83
|
+
const decoded = safeParseJson(record.slice(LINUX_PRIVATE_DISPLAY_DIAGNOSTIC_PREFIX.length));
|
|
84
|
+
if (!decoded.ok) return {
|
|
85
|
+
ok: false,
|
|
86
|
+
reason: "diagnostic_malformed"
|
|
87
|
+
};
|
|
88
|
+
const parsed = diagnosticSchema.safeParse(decoded.value);
|
|
89
|
+
if (!parsed.success) return {
|
|
90
|
+
ok: false,
|
|
91
|
+
reason: "diagnostic_malformed"
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
ok: true,
|
|
95
|
+
value: parsed.data
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
})))();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region dist/hopper/LinuxPrivateDisplayProbe.js
|
|
103
|
+
var PYTHON_PATH, UNSHARE_PATH, DEFAULT_PROBE_TIMEOUT_MS, isAborted, selectLinuxPrivateDisplayStrategy, runLinuxPrivateDisplayProbe, privateDisplayProbeCommand, evaluatedProbe, exitMatchesDiagnostic, syntheticDiagnostic, unavailable, emptyProcessResult, waitForProbeOutputClose;
|
|
104
|
+
function init_LinuxPrivateDisplayProbe() {
|
|
105
|
+
return (init_LinuxPrivateDisplayProbe = __esmMin((() => {
|
|
106
|
+
init_hopperStartupFailure();
|
|
107
|
+
init_ProcessOwnership();
|
|
108
|
+
init_ProviderProcess();
|
|
109
|
+
init_LinuxPrivateDisplayDiagnostic();
|
|
110
|
+
PYTHON_PATH = "/usr/bin/python3";
|
|
111
|
+
UNSHARE_PATH = "/usr/bin/unshare";
|
|
112
|
+
DEFAULT_PROBE_TIMEOUT_MS = 5e3;
|
|
113
|
+
isAborted = (signal) => signal?.aborted === true;
|
|
114
|
+
selectLinuxPrivateDisplayStrategy = async (options) => {
|
|
115
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
|
|
116
|
+
const runner = options.runProbe ?? runLinuxPrivateDisplayProbe;
|
|
117
|
+
const direct = await evaluatedProbe("direct", options, timeoutMs, runner);
|
|
118
|
+
if (direct.ok) return direct;
|
|
119
|
+
if (direct.diagnostic.failure_code !== "x11_socket_directory_unusable") return unavailable(direct.diagnostic);
|
|
120
|
+
const isolated = await evaluatedProbe("user-mount-namespace", options, timeoutMs, runner);
|
|
121
|
+
if (!isolated.ok) return unavailable({
|
|
122
|
+
...direct.diagnostic,
|
|
123
|
+
strategy: "unavailable",
|
|
124
|
+
reason: "namespace_unavailable",
|
|
125
|
+
fallback_reason: isolated.diagnostic.reason,
|
|
126
|
+
effective_socket_directory_mode: isolated.diagnostic.effective_socket_directory_mode,
|
|
127
|
+
effective_mount_read_only: isolated.diagnostic.effective_mount_read_only,
|
|
128
|
+
xvfb_stderr_bytes: isolated.diagnostic.xvfb_stderr_bytes
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
ok: true,
|
|
132
|
+
strategy: "user-mount-namespace",
|
|
133
|
+
diagnostic: {
|
|
134
|
+
...isolated.diagnostic,
|
|
135
|
+
socket_directory_mode: direct.diagnostic.socket_directory_mode,
|
|
136
|
+
mount_read_only: direct.diagnostic.mount_read_only,
|
|
137
|
+
fallback_reason: null
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
runLinuxPrivateDisplayProbe = async (strategy, options) => {
|
|
142
|
+
if (isAborted(options.signal)) return emptyProcessResult("cancelled");
|
|
143
|
+
const command = privateDisplayProbeCommand(options.helperPath, strategy);
|
|
144
|
+
let started;
|
|
145
|
+
try {
|
|
146
|
+
started = await spawnOwnedProviderProcess({
|
|
147
|
+
command: command.command,
|
|
148
|
+
arguments: command.arguments,
|
|
149
|
+
runId: randomUUID(),
|
|
150
|
+
expectedCommand: null,
|
|
151
|
+
...options.environment === undefined ? {} : { hostEnvironment: options.environment },
|
|
152
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
153
|
+
});
|
|
154
|
+
} catch (cause) {
|
|
155
|
+
void cause;
|
|
156
|
+
return emptyProcessResult(isAborted(options.signal) ? "cancelled" : "launch-failed");
|
|
157
|
+
}
|
|
158
|
+
const launch = {
|
|
159
|
+
process: started.process,
|
|
160
|
+
ownsProcessLifetime: true,
|
|
161
|
+
cleanup: () => cleanupOwnedProcessGroup(started.ownership)
|
|
162
|
+
};
|
|
163
|
+
const supervisor = new ProviderProcessSupervisor(launch);
|
|
164
|
+
const outcome = await waitForProbeOutputClose(supervisor, options.timeoutMs, options.signal);
|
|
165
|
+
let cleanupIncomplete = false;
|
|
166
|
+
if (outcome !== "exit") {
|
|
167
|
+
const stopped = await supervisor.stop();
|
|
168
|
+
cleanupIncomplete = stopped.status === "incomplete";
|
|
169
|
+
} else supervisor.dispose();
|
|
170
|
+
const snapshot = supervisor.snapshot();
|
|
171
|
+
return {
|
|
172
|
+
outcome: outcome === "exit" ? "exited" : outcome === "timeout" ? "timed-out" : "cancelled",
|
|
173
|
+
exitCode: snapshot.exitCode,
|
|
174
|
+
stderr: snapshot.stderr.text,
|
|
175
|
+
stderrBytes: snapshot.stderr.bytes,
|
|
176
|
+
cleanupIncomplete
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
privateDisplayProbeCommand = (helperPath, strategy) => strategy === "direct" ? {
|
|
180
|
+
command: PYTHON_PATH,
|
|
181
|
+
arguments: [
|
|
182
|
+
helperPath,
|
|
183
|
+
"--probe",
|
|
184
|
+
"--strategy",
|
|
185
|
+
"direct"
|
|
186
|
+
]
|
|
187
|
+
} : {
|
|
188
|
+
command: UNSHARE_PATH,
|
|
189
|
+
arguments: [
|
|
190
|
+
"--user",
|
|
191
|
+
"--map-root-user",
|
|
192
|
+
"--mount",
|
|
193
|
+
"--propagation",
|
|
194
|
+
"private",
|
|
195
|
+
PYTHON_PATH,
|
|
196
|
+
helperPath,
|
|
197
|
+
"--probe",
|
|
198
|
+
"--strategy",
|
|
199
|
+
"user-mount-namespace",
|
|
200
|
+
"--mount-private-x11"
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
evaluatedProbe = async (strategy, options, timeoutMs, runner) => {
|
|
204
|
+
let processResult;
|
|
205
|
+
try {
|
|
206
|
+
processResult = await runner(strategy, {
|
|
207
|
+
helperPath: options.helperPath,
|
|
208
|
+
...options.environment === undefined ? {} : { environment: options.environment },
|
|
209
|
+
timeoutMs,
|
|
210
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
211
|
+
});
|
|
212
|
+
} catch (cause) {
|
|
213
|
+
void cause;
|
|
214
|
+
return {
|
|
215
|
+
ok: false,
|
|
216
|
+
diagnostic: syntheticDiagnostic(strategy, "probe_failed")
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (processResult.outcome === "cancelled") return {
|
|
220
|
+
ok: false,
|
|
221
|
+
diagnostic: syntheticDiagnostic(strategy, "cancelled")
|
|
222
|
+
};
|
|
223
|
+
if (processResult.outcome === "timed-out") return {
|
|
224
|
+
ok: false,
|
|
225
|
+
diagnostic: syntheticDiagnostic(strategy, "probe_timeout")
|
|
226
|
+
};
|
|
227
|
+
if (processResult.outcome === "launch-failed") return {
|
|
228
|
+
ok: false,
|
|
229
|
+
diagnostic: syntheticDiagnostic(strategy, "probe_failed")
|
|
230
|
+
};
|
|
231
|
+
if (processResult.cleanupIncomplete) return {
|
|
232
|
+
ok: false,
|
|
233
|
+
diagnostic: syntheticDiagnostic(strategy, "cleanup_incomplete")
|
|
234
|
+
};
|
|
235
|
+
const parsed = parseLinuxPrivateDisplayDiagnostic(processResult.stderr);
|
|
236
|
+
if (!parsed.ok) return {
|
|
237
|
+
ok: false,
|
|
238
|
+
diagnostic: syntheticDiagnostic(strategy, parsed.reason)
|
|
239
|
+
};
|
|
240
|
+
const diagnostic = parsed.value;
|
|
241
|
+
if (diagnostic.strategy !== strategy || diagnostic.operation !== "probe" || !exitMatchesDiagnostic(processResult.exitCode, diagnostic)) return {
|
|
242
|
+
ok: false,
|
|
243
|
+
diagnostic: syntheticDiagnostic(strategy, "diagnostic_malformed")
|
|
244
|
+
};
|
|
245
|
+
return diagnostic.status === "ready" ? {
|
|
246
|
+
ok: true,
|
|
247
|
+
strategy,
|
|
248
|
+
diagnostic
|
|
249
|
+
} : {
|
|
250
|
+
ok: false,
|
|
251
|
+
diagnostic
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
exitMatchesDiagnostic = (exitCode, diagnostic) => diagnostic.status === "ready" ? exitCode === 0 : hopperStartupExitCode(diagnostic.failure_code) === exitCode;
|
|
255
|
+
syntheticDiagnostic = (strategy, reason, failureCode = "private_display_unavailable") => ({
|
|
256
|
+
component: "hopper_private_display",
|
|
257
|
+
operation: "probe",
|
|
258
|
+
status: "error",
|
|
259
|
+
failure_code: failureCode,
|
|
260
|
+
reason,
|
|
261
|
+
socket_directory: "/tmp/.X11-unix",
|
|
262
|
+
socket_directory_mode: null,
|
|
263
|
+
mount_read_only: null,
|
|
264
|
+
effective_socket_directory_mode: null,
|
|
265
|
+
effective_mount_read_only: null,
|
|
266
|
+
wsl: false,
|
|
267
|
+
strategy,
|
|
268
|
+
fallback_reason: null,
|
|
269
|
+
xvfb_stderr_bytes: 0
|
|
270
|
+
});
|
|
271
|
+
unavailable = (diagnostic) => ({
|
|
272
|
+
ok: false,
|
|
273
|
+
strategy: "unavailable",
|
|
274
|
+
exitCode: hopperStartupExitCode(diagnostic.failure_code) ?? 70,
|
|
275
|
+
diagnostic: {
|
|
276
|
+
...diagnostic,
|
|
277
|
+
strategy: "unavailable"
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
emptyProcessResult = (outcome) => ({
|
|
281
|
+
outcome,
|
|
282
|
+
exitCode: undefined,
|
|
283
|
+
stderr: "",
|
|
284
|
+
stderrBytes: 0,
|
|
285
|
+
cleanupIncomplete: false
|
|
286
|
+
});
|
|
287
|
+
waitForProbeOutputClose = async (supervisor, timeoutMs, signal) => {
|
|
288
|
+
if (signal?.aborted === true) return "cancelled";
|
|
289
|
+
let releaseAbort;
|
|
290
|
+
const aborted = new Promise((resolve) => {
|
|
291
|
+
if (signal === undefined) return;
|
|
292
|
+
const listener = () => resolve("cancelled");
|
|
293
|
+
signal.addEventListener("abort", listener, { once: true });
|
|
294
|
+
releaseAbort = () => signal.removeEventListener("abort", listener);
|
|
295
|
+
});
|
|
296
|
+
try {
|
|
297
|
+
return await Promise.race([supervisor.waitForOutputClose(Math.max(1, timeoutMs)).then((closed) => closed ? "exit" : "timeout"), aborted]);
|
|
298
|
+
} finally {
|
|
299
|
+
releaseAbort?.();
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
})))();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region dist/filesystem/readStableFileBytes.js
|
|
307
|
+
var RegularFileCapacityError, readStableFileBytes, readStableFilePrefix, readExtent, assertStableIdentity;
|
|
308
|
+
function init_readStableFileBytes() {
|
|
309
|
+
return (init_readStableFileBytes = __esmMin((() => {
|
|
310
|
+
init_RegularFile();
|
|
311
|
+
RegularFileCapacityError = class extends Error {
|
|
312
|
+
path;
|
|
313
|
+
maximumBytes;
|
|
314
|
+
observedBytes;
|
|
315
|
+
_tag = "RegularFileCapacityError";
|
|
316
|
+
constructor(path, maximumBytes, observedBytes) {
|
|
317
|
+
super(`Selected file must be at most ${maximumBytes} bytes: ${path}`);
|
|
318
|
+
this.path = path;
|
|
319
|
+
this.maximumBytes = maximumBytes;
|
|
320
|
+
this.observedBytes = observedBytes;
|
|
321
|
+
this.name = this._tag;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
readStableFileBytes = async (file, path, maximumBytes, options) => {
|
|
325
|
+
if (!Number.isSafeInteger(maximumBytes) || maximumBytes < 0) throw new RangeError("Maximum file bytes must be a nonnegative safe integer");
|
|
326
|
+
assertRegularFileActive(options.signal);
|
|
327
|
+
const before = await file.stat({ bigint: true });
|
|
328
|
+
if (before.size > BigInt(maximumBytes)) throw new RegularFileCapacityError(path, maximumBytes, before.size);
|
|
329
|
+
const bytes = await readExtent(file, path, Number(before.size), options.signal);
|
|
330
|
+
assertRegularFileActive(options.signal);
|
|
331
|
+
const extra = Buffer.alloc(1);
|
|
332
|
+
if ((await file.read(extra, 0, 1, bytes.length)).bytesRead !== 0) throw new RegularFileChangedError(path);
|
|
333
|
+
await assertStableIdentity(file, path, before, options);
|
|
334
|
+
return bytes;
|
|
335
|
+
};
|
|
336
|
+
readStableFilePrefix = async (file, path, maximumBytes, options) => {
|
|
337
|
+
if (!Number.isSafeInteger(maximumBytes) || maximumBytes < 0) throw new RangeError("Maximum prefix bytes must be a nonnegative safe integer");
|
|
338
|
+
assertRegularFileActive(options.signal);
|
|
339
|
+
const before = await file.stat({ bigint: true });
|
|
340
|
+
const length = Number(before.size < BigInt(maximumBytes) ? before.size : BigInt(maximumBytes));
|
|
341
|
+
const bytes = await readExtent(file, path, length, options.signal);
|
|
342
|
+
await assertStableIdentity(file, path, before, options);
|
|
343
|
+
return {
|
|
344
|
+
bytes,
|
|
345
|
+
size: before.size
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
readExtent = async (file, path, length, signal) => {
|
|
349
|
+
assertRegularFileActive(signal);
|
|
350
|
+
const bytes = Buffer.alloc(length);
|
|
351
|
+
let offset = 0;
|
|
352
|
+
while (offset < bytes.length) {
|
|
353
|
+
assertRegularFileActive(signal);
|
|
354
|
+
const read = await file.read({
|
|
355
|
+
buffer: bytes,
|
|
356
|
+
offset,
|
|
357
|
+
length: bytes.length - offset,
|
|
358
|
+
position: offset
|
|
359
|
+
});
|
|
360
|
+
if (read.bytesRead === 0) throw new RegularFileChangedError(path);
|
|
361
|
+
offset += read.bytesRead;
|
|
362
|
+
}
|
|
363
|
+
assertRegularFileActive(signal);
|
|
364
|
+
return bytes;
|
|
365
|
+
};
|
|
366
|
+
assertStableIdentity = async (file, path, before, options) => {
|
|
367
|
+
assertRegularFileActive(options.signal);
|
|
368
|
+
const named = async () => {
|
|
369
|
+
try {
|
|
370
|
+
return await (options.symlinks === "follow" ? stat : lstat)(path, { bigint: true });
|
|
371
|
+
} catch (cause) {
|
|
372
|
+
if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "ELOOP")) throw new RegularFileChangedError(path, { cause });
|
|
373
|
+
throw cause;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
if (!sameRegularFileState(before, await file.stat({ bigint: true })) || !sameRegularFileState(before, await named())) throw new RegularFileChangedError(path);
|
|
377
|
+
assertRegularFileActive(options.signal);
|
|
378
|
+
};
|
|
379
|
+
})))();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region dist/ghidra/GhidraFileArtifacts.js
|
|
384
|
+
var readGhidraProfileArtifact, writeGhidraProfileArtifact, ghidraFileFailure;
|
|
385
|
+
function init_GhidraFileArtifacts() {
|
|
386
|
+
return (init_GhidraFileArtifacts = __esmMin((() => {
|
|
387
|
+
init_ArtifactReader();
|
|
388
|
+
init_ArtifactFileOperation();
|
|
389
|
+
init_readStableFileBytes();
|
|
390
|
+
init_analysisErrorBase();
|
|
391
|
+
init_analysisErrorCore();
|
|
392
|
+
init_RegularFile();
|
|
393
|
+
init_providerAdapterError();
|
|
394
|
+
init_providerCleanupError();
|
|
395
|
+
init_analysisErrorCleanup();
|
|
396
|
+
readGhidraProfileArtifact = (path, maximumBytes, resources, signal, interpret) => withArtifactRegularFile(path, resources, signal, async (file) => {
|
|
397
|
+
const bytes = await readStableFileBytes(file, path, maximumBytes, {
|
|
398
|
+
symlinks: "reject",
|
|
399
|
+
...signal === undefined ? {} : { signal }
|
|
400
|
+
});
|
|
401
|
+
return interpret(bytes);
|
|
402
|
+
});
|
|
403
|
+
writeGhidraProfileArtifact = async (path, bytes, resources, signal) => {
|
|
404
|
+
assertArtifactReadActive(signal);
|
|
405
|
+
const file = await open(path, "wx", 384);
|
|
406
|
+
await withArtifactFileHandle(path, file, resources, signal, (handle) => handle.writeFile(bytes));
|
|
407
|
+
};
|
|
408
|
+
ghidraFileFailure = (cause, operation, diagnostics = {}) => {
|
|
409
|
+
cause = mapArtifactFileFailure(cause, (primary) => {
|
|
410
|
+
if (primary instanceof RegularFileCapacityError) return new AnalysisResourceConstraintError(operation, "file-size", primary.message, {
|
|
411
|
+
maximum_bytes: primary.maximumBytes,
|
|
412
|
+
observed_bytes: primary.observedBytes.toString()
|
|
413
|
+
}, {
|
|
414
|
+
cause: primary,
|
|
415
|
+
diagnostics,
|
|
416
|
+
retryable: false
|
|
417
|
+
});
|
|
418
|
+
if (primary instanceof RegularFileChangedError) return new AnalysisArtifactChangedError(operation, primary.path, primary.message, {
|
|
419
|
+
cause: primary,
|
|
420
|
+
diagnostics
|
|
421
|
+
});
|
|
422
|
+
if (primary instanceof Error && "code" in primary && (primary.code === "EACCES" || primary.code === "EPERM")) {
|
|
423
|
+
const path = "path" in primary && typeof primary.path === "string" ? primary.path : diagnostics.path;
|
|
424
|
+
if (typeof path === "string") return new AnalysisAccessDeniedError(operation, path, primary.code, {
|
|
425
|
+
cause: primary,
|
|
426
|
+
diagnostics
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
return primary;
|
|
430
|
+
});
|
|
431
|
+
if (cause instanceof AnalysisError) return cause;
|
|
432
|
+
const primary = artifactFilePrimaryFailure(cause);
|
|
433
|
+
const reason = primary instanceof Error ? primary.message : String(primary);
|
|
434
|
+
const cleanup = cause instanceof ArtifactReaderFailure ? cause.cleanup : undefined;
|
|
435
|
+
if (primary instanceof AnalysisError) {
|
|
436
|
+
if (cleanup === undefined) return primary;
|
|
437
|
+
const failure = new ProviderCleanupError("ghidra", cleanup.resources, { reason: cleanup.reason }, { cause });
|
|
438
|
+
bindArtifactFileCleanup(cause, failure);
|
|
439
|
+
return analysisErrorWithCleanupFailure(primary, failure, operation).bindCleanupDependencies([...primary.cleanupIncomplete ? [primary] : [], failure]);
|
|
440
|
+
}
|
|
441
|
+
const error = cause instanceof ArtifactReaderFailure && cause.reason === "cancelled" ? new AnalysisCancelledError(operation, {
|
|
442
|
+
cause: artifactFileCancellationCause(cause),
|
|
443
|
+
cleanup,
|
|
444
|
+
diagnostics
|
|
445
|
+
}) : new ProviderAdapterError("ghidra", operation, {
|
|
446
|
+
cause,
|
|
447
|
+
cleanup,
|
|
448
|
+
diagnostics: {
|
|
449
|
+
...diagnostics,
|
|
450
|
+
...primary instanceof Error && "code" in primary && typeof primary.code === "string" ? { system_code: primary.code } : {},
|
|
451
|
+
...primary instanceof Error && "syscall" in primary && typeof primary.syscall === "string" ? { syscall: primary.syscall } : {},
|
|
452
|
+
reason
|
|
453
|
+
},
|
|
454
|
+
userMessage: reason
|
|
455
|
+
});
|
|
456
|
+
bindArtifactFileCleanup(cause, error);
|
|
457
|
+
return error;
|
|
458
|
+
};
|
|
459
|
+
})))();
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region dist/ghidra/GhidraJavaProbe.js
|
|
464
|
+
var JAVA_PROBE_MAX_OUTPUT_BYTES, JAVA_DIAGNOSTIC_STREAM_BYTES, capturedProbeOutput, executablePath$1, probeGhidraJava, observeGhidraJava, systemCode, probeFailureError, parseGhidraJavaOutput, javaProperty, javaMajor;
|
|
465
|
+
function init_GhidraJavaProbe() {
|
|
466
|
+
return (init_GhidraJavaProbe = __esmMin((() => {
|
|
467
|
+
init_OwnedCommandCleanup();
|
|
468
|
+
init_AnalysisClientFailure();
|
|
469
|
+
init_analysisErrorBase();
|
|
470
|
+
init_analysisErrorCore();
|
|
471
|
+
init_providerAdapterError();
|
|
472
|
+
init_analysisErrorCleanup();
|
|
473
|
+
init_jsonValue();
|
|
474
|
+
init_DarwinProcessRunTokenReader();
|
|
475
|
+
init_OwnedCommand();
|
|
476
|
+
init_boundedUtf8Text();
|
|
477
|
+
init_result();
|
|
478
|
+
JAVA_PROBE_MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
479
|
+
JAVA_DIAGNOSTIC_STREAM_BYTES = 8192;
|
|
480
|
+
capturedProbeOutput = (observed) => {
|
|
481
|
+
const stdout = boundedUtf8Text(observed.stdout.text, JAVA_DIAGNOSTIC_STREAM_BYTES);
|
|
482
|
+
const stderr = boundedUtf8Text(observed.stderr.text, JAVA_DIAGNOSTIC_STREAM_BYTES);
|
|
483
|
+
return {
|
|
484
|
+
stdout: stdout.text,
|
|
485
|
+
stderr: stderr.text,
|
|
486
|
+
truncated: stdout.truncated || stderr.truncated || observed.diagnosticTruncated === true || observed.outputIncomplete === true,
|
|
487
|
+
stdout_bytes: observed.stdout.observedBytes,
|
|
488
|
+
stderr_bytes: observed.stderr.observedBytes,
|
|
489
|
+
exit_code: observed.exitCode ?? null,
|
|
490
|
+
signal: observed.signal ?? null
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
executablePath$1 = (path) => {
|
|
494
|
+
try {
|
|
495
|
+
accessSync(path, constants.X_OK);
|
|
496
|
+
return statSync(path).isFile();
|
|
497
|
+
} catch {
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
probeGhidraJava = async (command, environment, options) => {
|
|
502
|
+
try {
|
|
503
|
+
return await options.resourceOwner.run(() => observeGhidraJava(command, environment, options));
|
|
504
|
+
} catch (cause) {
|
|
505
|
+
return err(analysisClientFailureForOperation(cause, "ghidra", "ghidra:java"));
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
observeGhidraJava = async (command, environment, options) => {
|
|
509
|
+
let interpreted;
|
|
510
|
+
try {
|
|
511
|
+
await prepareOwnedCommand(options.signal);
|
|
512
|
+
await runOwnedCommand({
|
|
513
|
+
command,
|
|
514
|
+
arguments: [
|
|
515
|
+
"-Dstdout.encoding=UTF-8",
|
|
516
|
+
"-Dstderr.encoding=UTF-8",
|
|
517
|
+
"-Dsun.stdout.encoding=UTF-8",
|
|
518
|
+
"-Dsun.stderr.encoding=UTF-8",
|
|
519
|
+
"-XX:-UsePerfData",
|
|
520
|
+
"-XshowSettings:properties",
|
|
521
|
+
"-version"
|
|
522
|
+
],
|
|
523
|
+
runId: randomUUID(),
|
|
524
|
+
expectedCommand: null,
|
|
525
|
+
hostEnvironment: environment,
|
|
526
|
+
sweepTokenOwnedProcesses: true
|
|
527
|
+
}, {
|
|
528
|
+
timeoutMs: options.timeoutMs ?? 5e3,
|
|
529
|
+
diagnosticBytes: JAVA_PROBE_MAX_OUTPUT_BYTES,
|
|
530
|
+
acceptNonZeroExit: true,
|
|
531
|
+
observeCompleted: (snapshot) => {
|
|
532
|
+
interpreted = parseGhidraJavaOutput(command, snapshot);
|
|
533
|
+
}
|
|
534
|
+
}, {
|
|
535
|
+
signal: options.signal,
|
|
536
|
+
...options.launcher === undefined ? {} : { launcher: options.launcher }
|
|
537
|
+
});
|
|
538
|
+
if (interpreted === undefined) throw new Error("Java command completed without an output observation");
|
|
539
|
+
return interpreted;
|
|
540
|
+
} catch (cause) {
|
|
541
|
+
const commandFailure = cause instanceof OwnedCommandFailure ? cause : undefined;
|
|
542
|
+
const preparation = commandFailure?.preparationFailure ?? (cause instanceof DarwinProcessOwnershipInspectionError ? cause : undefined);
|
|
543
|
+
const output = commandFailure?.snapshot === undefined || commandFailure.snapshot === null ? preparation?.capturedOutput : capturedProbeOutput(commandFailure.snapshot);
|
|
544
|
+
if (interpreted !== undefined && !interpreted.ok && commandFailure?.cancellation !== undefined) Object.defineProperty(interpreted.error, "cancellation", { value: commandFailure.cancellation });
|
|
545
|
+
const cleanups = retainOwnedCommandCleanup(cause, options.resourceOwner, "ghidra", "ghidra:java");
|
|
546
|
+
let primary;
|
|
547
|
+
if (interpreted !== undefined && !interpreted.ok) {
|
|
548
|
+
if (cleanups.length === 0) return interpreted;
|
|
549
|
+
primary = probeFailureError(interpreted.error, cause);
|
|
550
|
+
} else if (commandFailure?.reason === "cancelled" && commandFailure.cancellation !== undefined) {
|
|
551
|
+
primary = new AnalysisCancelledError("ghidra:java", {
|
|
552
|
+
cause: commandFailure.cancellation.reason,
|
|
553
|
+
...output === undefined ? {} : { capturedOutput: output },
|
|
554
|
+
...interpreted?.ok === true ? { diagnostics: { java_observation: jsonValueSchema.parse(interpreted.value) } } : {}
|
|
555
|
+
});
|
|
556
|
+
} else if (interpreted?.ok === true && commandFailure?.cleanupOwner !== undefined) {
|
|
557
|
+
primary = new ProviderAdapterError("ghidra", "ghidra:java", {
|
|
558
|
+
cause,
|
|
559
|
+
...output === undefined ? {} : { capturedOutput: output },
|
|
560
|
+
diagnostics: {
|
|
561
|
+
java_observation: jsonValueSchema.parse(interpreted.value),
|
|
562
|
+
stage: "cleanup",
|
|
563
|
+
...commandFailure.cancellation === undefined ? {} : { cancellation_observed: true }
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
} else if (preparation !== undefined) {
|
|
567
|
+
primary = new ProviderAdapterError("ghidra", "ghidra:java", {
|
|
568
|
+
cause,
|
|
569
|
+
...output === undefined ? {} : { capturedOutput: output },
|
|
570
|
+
diagnostics: {
|
|
571
|
+
stage: "ownership_preparation",
|
|
572
|
+
...preparation.compilerOutcome === undefined ? {} : { compiler_outcome: jsonValueSchema.parse(preparation.compilerOutcome) }
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
} else if (cause instanceof AnalysisError) {
|
|
576
|
+
primary = cause;
|
|
577
|
+
}
|
|
578
|
+
if (primary === undefined) {
|
|
579
|
+
const code = commandFailure?.reason === "timeout" ? "ETIMEDOUT" : commandFailure?.reason === "output-limit" ? "ENOBUFS" : systemCode(commandFailure?.processError ?? cause);
|
|
580
|
+
const failed = {
|
|
581
|
+
_tag: "GhidraJavaProbeFailure",
|
|
582
|
+
code: code === "ENOENT" ? "runtime_missing" : "runtime_unavailable",
|
|
583
|
+
detail: `${command}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
584
|
+
...code === undefined ? {} : { processErrorCode: code },
|
|
585
|
+
...output === undefined ? {} : { output }
|
|
586
|
+
};
|
|
587
|
+
if (commandFailure?.cancellation !== undefined) Object.defineProperty(failed, "cancellation", { value: commandFailure.cancellation });
|
|
588
|
+
if (cleanups.length === 0) return err(failed);
|
|
589
|
+
primary = probeFailureError(failed, cause);
|
|
590
|
+
}
|
|
591
|
+
for (const cleanup of cleanups) primary = analysisErrorWithCleanupFailure(primary, cleanup, "ghidra:java").bindCleanupDependencies([primary, cleanup]);
|
|
592
|
+
return err(primary);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
systemCode = (cause) => cause instanceof Error && "code" in cause && typeof cause.code === "string" ? cause.code : undefined;
|
|
596
|
+
probeFailureError = (failure, cause) => {
|
|
597
|
+
const { output, ...facts } = failure;
|
|
598
|
+
return new ProviderAdapterError("ghidra", "ghidra:java", {
|
|
599
|
+
cause,
|
|
600
|
+
...output === undefined ? {} : { capturedOutput: output },
|
|
601
|
+
diagnostics: {
|
|
602
|
+
java_probe_failure: jsonValueSchema.parse(facts),
|
|
603
|
+
...failure.cancellation === undefined ? {} : { cancellation_observed: true }
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
};
|
|
607
|
+
parseGhidraJavaOutput = (command, observed) => {
|
|
608
|
+
if (observed.exitCode !== 0 || observed.signal !== null) return err({
|
|
609
|
+
_tag: "GhidraJavaProbeFailure",
|
|
610
|
+
code: "runtime_unavailable",
|
|
611
|
+
detail: `${command}: Java exited ${String(observed.exitCode)}${observed.signal == null ? "" : ` (${observed.signal})`}`,
|
|
612
|
+
output: capturedProbeOutput(observed)
|
|
613
|
+
});
|
|
614
|
+
const output = `${observed.stdout.text}\n${observed.stderr.text}`;
|
|
615
|
+
const version = javaProperty(output, "java.version") || null;
|
|
616
|
+
const home = javaProperty(output, "java.home") || null;
|
|
617
|
+
const vmName = javaProperty(output, "java.vm.name");
|
|
618
|
+
const osArch = javaProperty(output, "os.arch");
|
|
619
|
+
const osName = javaProperty(output, "os.name");
|
|
620
|
+
const reportedBits = javaProperty(output, "sun.arch.data.model");
|
|
621
|
+
const parsedBits = reportedBits !== null && /^\d+$/.test(reportedBits) ? Number(reportedBits) : null;
|
|
622
|
+
const bits = parsedBits !== null && Number.isSafeInteger(parsedBits) ? parsedBits : null;
|
|
623
|
+
const major = version === null ? undefined : javaMajor(version);
|
|
624
|
+
if (version === null || home === null || major === undefined) return err({
|
|
625
|
+
_tag: "GhidraJavaProbeFailure",
|
|
626
|
+
code: "version_unresolved",
|
|
627
|
+
detail: `${command}: successful Java probe did not establish a valid java.version and nonempty java.home`,
|
|
628
|
+
output: capturedProbeOutput(observed),
|
|
629
|
+
properties: {
|
|
630
|
+
version,
|
|
631
|
+
home,
|
|
632
|
+
vmName,
|
|
633
|
+
osArch,
|
|
634
|
+
osName,
|
|
635
|
+
bits
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
return ok({
|
|
639
|
+
version,
|
|
640
|
+
major,
|
|
641
|
+
home,
|
|
642
|
+
...vmName === null ? {} : { vmName },
|
|
643
|
+
...osArch === null ? {} : { osArch },
|
|
644
|
+
...osName === null ? {} : { osName },
|
|
645
|
+
bits,
|
|
646
|
+
...reportedBits === null || bits !== null ? {} : { unparsedBits: reportedBits },
|
|
647
|
+
runtime: executablePath$1((process.platform === "win32" ? win32 : posix).join(home, "bin", process.platform === "win32" ? "javac.exe" : "javac")) ? "jdk" : "jre"
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
javaProperty = (output, name) => new RegExp(`^[ \\t]*${name.replaceAll(".", "\\.")}[ \\t]*=[ \\t]*([^\\r\\n]*?)[ \\t]*\\r?$`, "mu").exec(output)?.[1] ?? null;
|
|
651
|
+
javaMajor = (version) => {
|
|
652
|
+
const legacy = /^1\.([1-8])(?:\.[0-9]+)*(?:_[0-9]+)?(?:-[-a-zA-Z0-9.]+)?$/u.exec(version);
|
|
653
|
+
if (legacy?.[1] !== undefined) return Number(legacy[1]);
|
|
654
|
+
const modern = /^(?<number>[1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:(?:-[a-zA-Z0-9]+)?\+(?<build>0|[1-9][0-9]*)(?:-[-a-zA-Z0-9.]+)?|-[a-zA-Z0-9]+(?:-[-a-zA-Z0-9.]+)?|\+-[-a-zA-Z0-9.]+)?$/u.exec(version);
|
|
655
|
+
const number = modern?.groups?.number;
|
|
656
|
+
if (number === undefined) return undefined;
|
|
657
|
+
const parts = number.split(".").map(Number);
|
|
658
|
+
const build = modern?.groups?.build;
|
|
659
|
+
if ([...parts, ...build === undefined ? [] : [Number(build)]].some((value) => !Number.isSafeInteger(value) || value > 2147483647)) return undefined;
|
|
660
|
+
return parts[0];
|
|
661
|
+
};
|
|
662
|
+
})))();
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region dist/ghidra/GhidraExecutableHeader.js
|
|
667
|
+
var GHIDRA_EXECUTABLE_HEADER_BYTES, readGhidraExecutableHeader;
|
|
668
|
+
function init_GhidraExecutableHeader() {
|
|
669
|
+
return (init_GhidraExecutableHeader = __esmMin((() => {
|
|
670
|
+
init_result();
|
|
671
|
+
init_analysisErrorCore();
|
|
672
|
+
init_ArtifactFileOperation();
|
|
673
|
+
init_readStableFileBytes();
|
|
674
|
+
init_GhidraFileArtifacts();
|
|
675
|
+
GHIDRA_EXECUTABLE_HEADER_BYTES = 4096;
|
|
676
|
+
readGhidraExecutableHeader = async (path, options) => {
|
|
677
|
+
let completedHeader;
|
|
678
|
+
try {
|
|
679
|
+
return ok(await options.resourceOwner.run(() => withArtifactRegularFile(path, { retain: (resource) => options.resourceOwner.retain({ close: () => resource.lease.release() }, resource.resource) }, options.signal, async (file) => {
|
|
680
|
+
const observed = await readStableFilePrefix(file, path, GHIDRA_EXECUTABLE_HEADER_BYTES, {
|
|
681
|
+
symlinks: "follow",
|
|
682
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
683
|
+
});
|
|
684
|
+
if (observed.size > BigInt(Number.MAX_SAFE_INTEGER)) throw new AnalysisResourceConstraintError("ghidra:installation", "file-size", "Executable extent cannot be represented exactly by the header parser", {
|
|
685
|
+
maximum_bytes: Number.MAX_SAFE_INTEGER,
|
|
686
|
+
observed_bytes: observed.size.toString()
|
|
687
|
+
}, {
|
|
688
|
+
diagnostics: {
|
|
689
|
+
path,
|
|
690
|
+
stage: "native_decompiler_header"
|
|
691
|
+
},
|
|
692
|
+
retryable: false
|
|
693
|
+
});
|
|
694
|
+
completedHeader = {
|
|
695
|
+
bytes: observed.bytes,
|
|
696
|
+
size: Number(observed.size)
|
|
697
|
+
};
|
|
698
|
+
return completedHeader;
|
|
699
|
+
}, "follow")));
|
|
700
|
+
} catch (cause) {
|
|
701
|
+
return err(ghidraFileFailure(cause, "ghidra:installation", {
|
|
702
|
+
path,
|
|
703
|
+
stage: "native_decompiler_header",
|
|
704
|
+
...completedHeader === undefined ? {} : { completed_header: {
|
|
705
|
+
file_bytes: completedHeader.size,
|
|
706
|
+
examined_bytes: completedHeader.bytes.length,
|
|
707
|
+
prefix_sha256: createHash("sha256").update(completedHeader.bytes).digest("hex")
|
|
708
|
+
} }
|
|
709
|
+
}));
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
})))();
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region dist/ghidra/GhidraJavaProperties.js
|
|
717
|
+
/** Join odd-backslash continuations while stripping leading continuation space. */
|
|
718
|
+
function* logicalPropertyLines(content) {
|
|
719
|
+
let physicalStart = 0;
|
|
720
|
+
let logical = "";
|
|
721
|
+
let continuing = false;
|
|
722
|
+
while (physicalStart <= content.length) {
|
|
723
|
+
let physicalEnd = physicalStart;
|
|
724
|
+
while (physicalEnd < content.length && content[physicalEnd] !== "\n" && content[physicalEnd] !== "\r") physicalEnd += 1;
|
|
725
|
+
let line = content.slice(physicalStart, physicalEnd);
|
|
726
|
+
let leading = 0;
|
|
727
|
+
while (isPropertyWhitespace(line[leading])) leading += 1;
|
|
728
|
+
const comment = !continuing && (line[leading] === "#" || line[leading] === "!");
|
|
729
|
+
if (continuing) line = line.slice(leading);
|
|
730
|
+
let continued = false;
|
|
731
|
+
if (!comment) {
|
|
732
|
+
let slashes = 0;
|
|
733
|
+
for (let index = line.length - 1; index >= 0 && line[index] === "\\"; index -= 1) slashes += 1;
|
|
734
|
+
continued = slashes % 2 === 1;
|
|
735
|
+
logical += continued ? line.slice(0, -1) : line;
|
|
736
|
+
}
|
|
737
|
+
if (!continued) {
|
|
738
|
+
yield logical;
|
|
739
|
+
logical = "";
|
|
740
|
+
}
|
|
741
|
+
continuing = continued;
|
|
742
|
+
if (physicalEnd === content.length) break;
|
|
743
|
+
physicalStart = content[physicalEnd] === "\r" && content[physicalEnd + 1] === "\n" ? physicalEnd + 2 : physicalEnd + 1;
|
|
744
|
+
}
|
|
745
|
+
if (continuing) yield logical;
|
|
746
|
+
}
|
|
747
|
+
var parseGhidraJavaProperties, isPropertyWhitespace, decodePropertyEscapes;
|
|
748
|
+
function init_GhidraJavaProperties() {
|
|
749
|
+
return (init_GhidraJavaProperties = __esmMin((() => {
|
|
750
|
+
parseGhidraJavaProperties = (content) => {
|
|
751
|
+
const values = new Map();
|
|
752
|
+
for (const line of logicalPropertyLines(content)) {
|
|
753
|
+
let start = 0;
|
|
754
|
+
while (isPropertyWhitespace(line[start])) start += 1;
|
|
755
|
+
if (start === line.length || line[start] === "#" || line[start] === "!") continue;
|
|
756
|
+
let end = start;
|
|
757
|
+
let escaped = false;
|
|
758
|
+
while (end < line.length) {
|
|
759
|
+
const character = line[end];
|
|
760
|
+
if (!escaped && (character === "=" || character === ":" || isPropertyWhitespace(character))) break;
|
|
761
|
+
if (character === "\\") escaped = !escaped;
|
|
762
|
+
else escaped = false;
|
|
763
|
+
end += 1;
|
|
764
|
+
}
|
|
765
|
+
let valueStart = end;
|
|
766
|
+
while (isPropertyWhitespace(line[valueStart])) valueStart += 1;
|
|
767
|
+
if (line[valueStart] === "=" || line[valueStart] === ":") valueStart += 1;
|
|
768
|
+
while (isPropertyWhitespace(line[valueStart])) valueStart += 1;
|
|
769
|
+
const key = decodePropertyEscapes(line.slice(start, end));
|
|
770
|
+
if (!key.ok) return key;
|
|
771
|
+
const value = decodePropertyEscapes(line.slice(valueStart));
|
|
772
|
+
if (!value.ok) return value;
|
|
773
|
+
values.set(key.value, value.value);
|
|
774
|
+
}
|
|
775
|
+
return {
|
|
776
|
+
ok: true,
|
|
777
|
+
value: values
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
isPropertyWhitespace = (value) => value === " " || value === " " || value === "\f";
|
|
781
|
+
decodePropertyEscapes = (value) => {
|
|
782
|
+
let result = "";
|
|
783
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
784
|
+
const character = value[index];
|
|
785
|
+
if (character !== "\\") {
|
|
786
|
+
result += character;
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
const escaped = value[++index];
|
|
790
|
+
if (escaped === undefined) return {
|
|
791
|
+
ok: false,
|
|
792
|
+
error: "Trailing escape in Java properties value"
|
|
793
|
+
};
|
|
794
|
+
if (escaped === "t") result += " ";
|
|
795
|
+
else if (escaped === "n") result += "\n";
|
|
796
|
+
else if (escaped === "r") result += "\r";
|
|
797
|
+
else if (escaped === "f") result += "\f";
|
|
798
|
+
else if (escaped === "u") {
|
|
799
|
+
const digits = value.slice(index + 1, index + 5);
|
|
800
|
+
if (digits.length !== 4 || !/^[0-9a-f]{4}$/iu.test(digits)) return {
|
|
801
|
+
ok: false,
|
|
802
|
+
error: "Malformed Unicode escape in Java properties file"
|
|
803
|
+
};
|
|
804
|
+
result += String.fromCharCode(Number.parseInt(digits, 16));
|
|
805
|
+
index += 4;
|
|
806
|
+
} else result += escaped;
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
ok: true,
|
|
810
|
+
value: result
|
|
811
|
+
};
|
|
812
|
+
};
|
|
813
|
+
})))();
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region dist/ghidra/GhidraReleasePolicy.js
|
|
818
|
+
var SUPPORTED_GHIDRA_VERSION, SUPPORTED_GHIDRA_JAVA_MAJOR, GHIDRA_RELEASE_PATTERN, ghidraReleaseCompatibility, unverifiedGhidraBuildLimitation, ghidraReleaseLine, ghidraVersionDetail, ghidraReleaseAccepted, verifiedGhidraRelease, parseGhidraRelease, ghidraConfigurationVersion, integerGroup;
|
|
819
|
+
function init_GhidraReleasePolicy() {
|
|
820
|
+
return (init_GhidraReleasePolicy = __esmMin((() => {
|
|
821
|
+
SUPPORTED_GHIDRA_VERSION = "12.1.4";
|
|
822
|
+
SUPPORTED_GHIDRA_JAVA_MAJOR = 21;
|
|
823
|
+
GHIDRA_RELEASE_PATTERN = /^(\d+)\.(\d+)(?:\.(\d+))?([-+].*)?$/u;
|
|
824
|
+
ghidraReleaseCompatibility = (raw) => {
|
|
825
|
+
if (raw === null || raw === undefined) return {
|
|
826
|
+
status: "unresolved",
|
|
827
|
+
raw: null
|
|
828
|
+
};
|
|
829
|
+
const version = parseGhidraRelease(raw);
|
|
830
|
+
if (version === undefined) return {
|
|
831
|
+
status: "unresolved",
|
|
832
|
+
raw
|
|
833
|
+
};
|
|
834
|
+
if (raw === "12.1.4") return {
|
|
835
|
+
status: "verified",
|
|
836
|
+
version,
|
|
837
|
+
raw
|
|
838
|
+
};
|
|
839
|
+
const verified = verifiedGhidraRelease();
|
|
840
|
+
return version.major === verified.major && version.minor === verified.minor ? {
|
|
841
|
+
status: "compatible",
|
|
842
|
+
version,
|
|
843
|
+
raw
|
|
844
|
+
} : {
|
|
845
|
+
status: "unsupported",
|
|
846
|
+
version,
|
|
847
|
+
raw
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
unverifiedGhidraBuildLimitation = (providerVersion) => {
|
|
851
|
+
const compatibility = ghidraReleaseCompatibility(providerVersion);
|
|
852
|
+
if (compatibility.status !== "compatible") return undefined;
|
|
853
|
+
return `This session uses Ghidra ${providerVersion}. The bridge is verified against ${SUPPORTED_GHIDRA_VERSION}; other ${ghidraReleaseLine()} builds are accepted and the observed version is reported.`;
|
|
854
|
+
};
|
|
855
|
+
ghidraReleaseLine = () => {
|
|
856
|
+
const verified = verifiedGhidraRelease();
|
|
857
|
+
return `${String(verified.major)}.${String(verified.minor)}.x`;
|
|
858
|
+
};
|
|
859
|
+
ghidraVersionDetail = (raw) => {
|
|
860
|
+
const compatibility = ghidraReleaseCompatibility(raw);
|
|
861
|
+
switch (compatibility.status) {
|
|
862
|
+
case "unresolved": return compatibility.raw ?? "unknown";
|
|
863
|
+
case "verified": return compatibility.raw;
|
|
864
|
+
case "compatible": return `${compatibility.raw}; compatible ${ghidraReleaseLine()} release (verified build ${SUPPORTED_GHIDRA_VERSION})`;
|
|
865
|
+
case "unsupported": return `${compatibility.raw}; accepted releases are ${ghidraReleaseLine()} (verified build ${SUPPORTED_GHIDRA_VERSION})`;
|
|
866
|
+
default: {
|
|
867
|
+
const unreachable = compatibility;
|
|
868
|
+
return unreachable;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
ghidraReleaseAccepted = (raw) => {
|
|
873
|
+
const status = ghidraReleaseCompatibility(raw).status;
|
|
874
|
+
return status === "verified" || status === "compatible";
|
|
875
|
+
};
|
|
876
|
+
verifiedGhidraRelease = () => {
|
|
877
|
+
const version = parseGhidraRelease(SUPPORTED_GHIDRA_VERSION);
|
|
878
|
+
if (version === undefined) throw new TypeError(`SUPPORTED_GHIDRA_VERSION ${SUPPORTED_GHIDRA_VERSION} is not a Ghidra release`);
|
|
879
|
+
return version;
|
|
880
|
+
};
|
|
881
|
+
parseGhidraRelease = (raw) => {
|
|
882
|
+
const match = GHIDRA_RELEASE_PATTERN.exec(raw);
|
|
883
|
+
const major = integerGroup(match?.[1]);
|
|
884
|
+
const minor = integerGroup(match?.[2]);
|
|
885
|
+
if (match === null || major === undefined || minor === undefined) return undefined;
|
|
886
|
+
const patch = match[3] === undefined ? 0 : integerGroup(match[3]);
|
|
887
|
+
return patch === undefined ? undefined : {
|
|
888
|
+
major,
|
|
889
|
+
minor,
|
|
890
|
+
patch,
|
|
891
|
+
suffix: match[4] ?? ""
|
|
892
|
+
};
|
|
893
|
+
};
|
|
894
|
+
ghidraConfigurationVersion = (raw) => {
|
|
895
|
+
const version = parseGhidraRelease(raw);
|
|
896
|
+
if (version === undefined || version.suffix.startsWith("+")) return undefined;
|
|
897
|
+
const patch = version.patch === 0 ? "" : `.${String(version.patch)}`;
|
|
898
|
+
const suffix = version.suffix === "-" ? "" : version.suffix;
|
|
899
|
+
return `${String(version.major)}.${String(version.minor)}${patch}${suffix}`;
|
|
900
|
+
};
|
|
901
|
+
integerGroup = (value) => {
|
|
902
|
+
if (value === undefined) return undefined;
|
|
903
|
+
const parsed = Number(value);
|
|
904
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
905
|
+
};
|
|
906
|
+
})))();
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region dist/ghidra/GhidraInstallationPolicy.js
|
|
911
|
+
var ghidraApplicationProperties, ghidraJavaRequirement, ghidraJavaRangeLabel, ghidraJavaMajorAccepted, parseJavaBound, parseJavaMaximum, parseJavaInteger, javaDecimalDigit, unresolvedJavaRequirement;
|
|
912
|
+
function init_GhidraInstallationPolicy() {
|
|
913
|
+
return (init_GhidraInstallationPolicy = __esmMin((() => {
|
|
914
|
+
init_GhidraJavaProperties();
|
|
915
|
+
init_GhidraReleasePolicy();
|
|
916
|
+
ghidraApplicationProperties = (content) => {
|
|
917
|
+
const parsed = parseGhidraJavaProperties(content);
|
|
918
|
+
if (!parsed.ok) return {
|
|
919
|
+
providerVersion: null,
|
|
920
|
+
configurationDirectoryName: null,
|
|
921
|
+
javaMinimum: {
|
|
922
|
+
status: "unresolved",
|
|
923
|
+
raw: parsed.error
|
|
924
|
+
},
|
|
925
|
+
javaMaximum: {
|
|
926
|
+
status: "unresolved",
|
|
927
|
+
raw: parsed.error
|
|
928
|
+
},
|
|
929
|
+
parseError: parsed.error
|
|
930
|
+
};
|
|
931
|
+
const providerVersion = parsed.value.get("application.version");
|
|
932
|
+
const releaseName = parsed.value.get("application.release.name")?.replaceAll(/[ \t\n\r\f\v]/gu, "").toUpperCase();
|
|
933
|
+
const configurationVersion = providerVersion === undefined ? undefined : ghidraConfigurationVersion(providerVersion);
|
|
934
|
+
const configurationDirectoryName = providerVersion !== undefined && configurationVersion !== undefined && releaseName !== undefined && /^[A-Za-z0-9][A-Za-z0-9._+-]*$/u.test(providerVersion) && /^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(releaseName) ? `ghidra_${configurationVersion}_${releaseName}` : null;
|
|
935
|
+
const minimum = parsed.value.get("application.java.min");
|
|
936
|
+
const maximum = parsed.value.get("application.java.max");
|
|
937
|
+
return {
|
|
938
|
+
providerVersion: providerVersion ?? null,
|
|
939
|
+
configurationDirectoryName,
|
|
940
|
+
javaMinimum: minimum === undefined ? { status: "absent" } : parseJavaBound(minimum),
|
|
941
|
+
javaMaximum: parseJavaMaximum(maximum),
|
|
942
|
+
parseError: null
|
|
943
|
+
};
|
|
944
|
+
};
|
|
945
|
+
ghidraJavaRequirement = (properties) => {
|
|
946
|
+
if (properties?.parseError !== null && properties?.parseError !== undefined) return unresolvedJavaRequirement(`application.properties parse failed: ${properties.parseError}`);
|
|
947
|
+
if (properties === undefined) return unresolvedJavaRequirement("application.properties is unavailable");
|
|
948
|
+
const minimum = properties.javaMinimum;
|
|
949
|
+
const maximum = properties.javaMaximum;
|
|
950
|
+
if (minimum.status === "unresolved") return unresolvedJavaRequirement(`application.java.min=${minimum.raw}`);
|
|
951
|
+
if (minimum.status === "absent") return unresolvedJavaRequirement("application.java.min is missing");
|
|
952
|
+
if (maximum.status === "unresolved") return unresolvedJavaRequirement(`application.java.max=${maximum.raw}`);
|
|
953
|
+
const minimumMajor = minimum.major;
|
|
954
|
+
const maximumMajor = maximum.status === "major" ? maximum.major : null;
|
|
955
|
+
if (maximumMajor !== null && maximumMajor < minimumMajor) return unresolvedJavaRequirement(`application.java.max=${String(maximumMajor)} is below application.java.min=${String(minimumMajor)}`);
|
|
956
|
+
return {
|
|
957
|
+
minimumMajor,
|
|
958
|
+
maximumMajor,
|
|
959
|
+
unresolved: null
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
ghidraJavaRangeLabel = (requirement) => {
|
|
963
|
+
if (requirement.unresolved !== null) return "a 64-bit full JDK matching the installation's declared Java bounds";
|
|
964
|
+
if (requirement.maximumMajor === null) return `a 64-bit full JDK ${String(requirement.minimumMajor)} or newer`;
|
|
965
|
+
if (requirement.maximumMajor === requirement.minimumMajor) return `a 64-bit full JDK ${String(requirement.minimumMajor)}`;
|
|
966
|
+
return `a 64-bit full JDK ${String(requirement.minimumMajor)} through ${String(requirement.maximumMajor)}`;
|
|
967
|
+
};
|
|
968
|
+
ghidraJavaMajorAccepted = (major, requirement) => requirement.unresolved === null && major >= requirement.minimumMajor && (requirement.maximumMajor === null || major <= requirement.maximumMajor);
|
|
969
|
+
parseJavaBound = (raw) => {
|
|
970
|
+
const major = parseJavaInteger(raw);
|
|
971
|
+
return major === undefined ? {
|
|
972
|
+
status: "unresolved",
|
|
973
|
+
raw
|
|
974
|
+
} : {
|
|
975
|
+
status: "major",
|
|
976
|
+
major
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
parseJavaMaximum = (raw) => {
|
|
980
|
+
if (raw === undefined || raw === "") return { status: "absent" };
|
|
981
|
+
const bound = parseJavaBound(raw);
|
|
982
|
+
return bound.status === "major" && bound.major === 0 ? { status: "absent" } : bound;
|
|
983
|
+
};
|
|
984
|
+
parseJavaInteger = (raw) => {
|
|
985
|
+
let index = 0;
|
|
986
|
+
let sign = 1;
|
|
987
|
+
if (raw[index] === "+" || raw[index] === "-") {
|
|
988
|
+
if (raw[index] === "-") sign = -1;
|
|
989
|
+
index += 1;
|
|
990
|
+
}
|
|
991
|
+
if (index === raw.length) return undefined;
|
|
992
|
+
const limit = sign < 0 ? 2147483648 : 2147483647;
|
|
993
|
+
let value = 0;
|
|
994
|
+
for (; index < raw.length; index += 1) {
|
|
995
|
+
const character = raw[index];
|
|
996
|
+
if (character === undefined) return undefined;
|
|
997
|
+
const digit = javaDecimalDigit(character);
|
|
998
|
+
if (digit === undefined) return undefined;
|
|
999
|
+
if (value > Math.floor((limit - digit) / 10)) return undefined;
|
|
1000
|
+
value = value * 10 + digit;
|
|
1001
|
+
}
|
|
1002
|
+
return sign * value;
|
|
1003
|
+
};
|
|
1004
|
+
javaDecimalDigit = (character) => {
|
|
1005
|
+
const code = character.charCodeAt(0);
|
|
1006
|
+
if (code >= 48 && code <= 57) return code - 48;
|
|
1007
|
+
if (!/^\p{Decimal_Number}$/u.test(character)) return undefined;
|
|
1008
|
+
let blockStart = code;
|
|
1009
|
+
while (blockStart > 0 && /^\p{Decimal_Number}$/u.test(String.fromCharCode(blockStart - 1))) blockStart -= 1;
|
|
1010
|
+
return (code - blockStart) % 10;
|
|
1011
|
+
};
|
|
1012
|
+
unresolvedJavaRequirement = (unresolved) => ({ unresolved });
|
|
1013
|
+
})))();
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region dist/ghidra/GhidraInstallationProperties.js
|
|
1018
|
+
var MAX_GHIDRA_INSTALLATION_PROPERTIES_BYTES, readGhidraInstallationProperties;
|
|
1019
|
+
function init_GhidraInstallationProperties() {
|
|
1020
|
+
return (init_GhidraInstallationProperties = __esmMin((() => {
|
|
1021
|
+
init_ArtifactFileOperation();
|
|
1022
|
+
init_jsonValue();
|
|
1023
|
+
init_RegularFile();
|
|
1024
|
+
init_readStableFileBytes();
|
|
1025
|
+
init_GhidraInstallationPolicy();
|
|
1026
|
+
init_GhidraFileArtifacts();
|
|
1027
|
+
MAX_GHIDRA_INSTALLATION_PROPERTIES_BYTES = 1024 * 1024;
|
|
1028
|
+
readGhidraInstallationProperties = async (path, options) => {
|
|
1029
|
+
try {
|
|
1030
|
+
return await options.resourceOwner.run(() => withArtifactRegularFile(path, { retain: (resource) => options.resourceOwner.retain({ close: () => resource.lease.release() }, resource.resource) }, options.signal, async (file) => (await readStableFileBytes(file, path, MAX_GHIDRA_INSTALLATION_PROPERTIES_BYTES, {
|
|
1031
|
+
symlinks: "follow",
|
|
1032
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1033
|
+
})).toString("latin1"), "follow"));
|
|
1034
|
+
} catch (cause) {
|
|
1035
|
+
const physical = artifactFilePrimaryFailure(cause);
|
|
1036
|
+
if (!(cause instanceof ArtifactFileCleanupFailure) && physical instanceof Error && "code" in physical && "syscall" in physical && physical.syscall === "open" && (physical.code === "ENOENT" || physical.code === "ENOTDIR")) return undefined;
|
|
1037
|
+
const completed = cause instanceof ArtifactFileCancelled ? cause.fileCancellation.outcome.value : cause instanceof ArtifactFileCleanupFailure && cause.fileCleanupFailure.outcome.kind === "completed" ? cause.fileCleanupFailure.outcome.value : undefined;
|
|
1038
|
+
const diagnostics = {
|
|
1039
|
+
path,
|
|
1040
|
+
stage: "installation_properties",
|
|
1041
|
+
...physical instanceof NonRegularFileReadError ? { system_code: physical.code } : {},
|
|
1042
|
+
...typeof completed !== "string" ? {} : { completed_properties: {
|
|
1043
|
+
bytes: Buffer.byteLength(completed, "latin1"),
|
|
1044
|
+
sha256: createHash("sha256").update(completed, "latin1").digest("hex"),
|
|
1045
|
+
properties: jsonValueSchema.parse(ghidraApplicationProperties(completed))
|
|
1046
|
+
} }
|
|
1047
|
+
};
|
|
1048
|
+
throw ghidraFileFailure(cause, "ghidra:installation", diagnostics);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
})))();
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region dist/ghidra/GhidraInstallation.js
|
|
1056
|
+
var NATIVE_PLATFORMS, NATIVE_TOOL_FORMATS, NATIVE_ARCHITECTURES, assessNativeDecompiler, inspectGhidraInstallation, availableInstallation, installationCoordinates, installationChecks, configurationCheck, ghidraInstallationDiagnostics, ghidraJavaEnvironment, installationCheck, nativeDecompilerCheck, jvmOsNameMatchesPlatform, jvmOsArchNativeDirectory, versionCheck, javaCheck, javaRemediation, systemGhidraInstallationHost, discoverGhidraInstallationOnPath, executablePath;
|
|
1057
|
+
function init_GhidraInstallation() {
|
|
1058
|
+
return (init_GhidraInstallation = __esmMin((() => {
|
|
1059
|
+
init_analysisErrorBase();
|
|
1060
|
+
init_analysisErrorCore();
|
|
1061
|
+
init_GhidraJavaProbe();
|
|
1062
|
+
init_result();
|
|
1063
|
+
init_analysisErrorProjection();
|
|
1064
|
+
init_GhidraExecutableHeader();
|
|
1065
|
+
init_snapshotEnvironment();
|
|
1066
|
+
init_GhidraInstallationProperties();
|
|
1067
|
+
init_binaryTarget();
|
|
1068
|
+
init_binaryTargetTypes();
|
|
1069
|
+
init_GhidraInstallationPolicy();
|
|
1070
|
+
init_GhidraReleasePolicy();
|
|
1071
|
+
NATIVE_PLATFORMS = {
|
|
1072
|
+
linux: {
|
|
1073
|
+
x64: "linux_x86_64",
|
|
1074
|
+
arm64: "linux_arm_64"
|
|
1075
|
+
},
|
|
1076
|
+
darwin: {
|
|
1077
|
+
x64: "mac_x86_64",
|
|
1078
|
+
arm64: "mac_arm_64"
|
|
1079
|
+
},
|
|
1080
|
+
win32: { x64: "win_x86_64" }
|
|
1081
|
+
};
|
|
1082
|
+
NATIVE_TOOL_FORMATS = {
|
|
1083
|
+
linux: "elf",
|
|
1084
|
+
darwin: "mach-o",
|
|
1085
|
+
win32: "pe"
|
|
1086
|
+
};
|
|
1087
|
+
NATIVE_ARCHITECTURES = [
|
|
1088
|
+
{
|
|
1089
|
+
node: "x64",
|
|
1090
|
+
binary: "x86_64"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
node: "ia32",
|
|
1094
|
+
binary: "x86"
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
node: "arm",
|
|
1098
|
+
binary: "arm"
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
node: "arm64",
|
|
1102
|
+
binary: "arm64"
|
|
1103
|
+
}
|
|
1104
|
+
];
|
|
1105
|
+
assessNativeDecompiler = (path, platform, architecture, probe) => {
|
|
1106
|
+
const expectedFormat = NATIVE_TOOL_FORMATS[platform];
|
|
1107
|
+
const expectedArchitecture = NATIVE_ARCHITECTURES.find(({ node }) => node === architecture)?.binary;
|
|
1108
|
+
if (expectedFormat === undefined || expectedArchitecture === undefined) return {
|
|
1109
|
+
status: "unknown",
|
|
1110
|
+
detail: `${path} is executable, but no native tool format is defined for ${platform}/${architecture}`
|
|
1111
|
+
};
|
|
1112
|
+
let parsed = probe === undefined ? undefined : parseExecutableHeader(probe.bytes, architecture, probe.size);
|
|
1113
|
+
if (probe !== undefined && parsed !== undefined && !parsed.ok) {
|
|
1114
|
+
for (const { node } of NATIVE_ARCHITECTURES) {
|
|
1115
|
+
if (node === architecture) continue;
|
|
1116
|
+
const alternative = parseExecutableHeader(probe.bytes, node, probe.size);
|
|
1117
|
+
if (alternative.ok && !alternative.value.availableArchitectures.some((available) => available === expectedArchitecture)) {
|
|
1118
|
+
parsed = alternative;
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
if (parsed === undefined || !parsed.ok) return {
|
|
1124
|
+
status: "unknown",
|
|
1125
|
+
detail: `${path} is executable, but its executable format for ${platform}/${architecture} could not be established`
|
|
1126
|
+
};
|
|
1127
|
+
const observed = `${parsed.value.format} ${parsed.value.architecture}`;
|
|
1128
|
+
const expected = `${expectedFormat} ${expectedArchitecture}`;
|
|
1129
|
+
const formatMatches = isMachOFormat(expectedFormat) ? isMachOFormat(parsed.value.format) : parsed.value.format === expectedFormat;
|
|
1130
|
+
if (formatMatches && parsed.value.architecture === expectedArchitecture) return {
|
|
1131
|
+
status: "compatible",
|
|
1132
|
+
detail: `${path} reports ${observed}, which matches ${platform}/${architecture}`
|
|
1133
|
+
};
|
|
1134
|
+
const nativeDirectory = NATIVE_PLATFORMS[platform]?.[architecture];
|
|
1135
|
+
const executable = platform === "win32" ? "decompile.exe" : "decompile";
|
|
1136
|
+
return {
|
|
1137
|
+
status: "incompatible",
|
|
1138
|
+
detail: `${path} reports ${observed}, but ${platform}/${architecture} requires ${expected}`,
|
|
1139
|
+
remediation: `Provide an executable Ghidra/Features/Decompiler/os/${nativeDirectory ?? "<platform>"}/${executable} built for ${expected}, or its build/os equivalent. REA does not build or install native tools.`
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
inspectGhidraInstallation = async (options, host = systemGhidraInstallationHost()) => {
|
|
1143
|
+
if (options.signal?.aborted) throw new AnalysisCancelledError("ghidra:installation", { cause: options.signal.reason });
|
|
1144
|
+
const platform = options.platform ?? process.platform;
|
|
1145
|
+
const architecture = options.architecture ?? process.arch;
|
|
1146
|
+
const coordinates = await installationCoordinates(options, platform, architecture, host);
|
|
1147
|
+
const checks = installationChecks({
|
|
1148
|
+
coordinates,
|
|
1149
|
+
platform,
|
|
1150
|
+
architecture,
|
|
1151
|
+
javaHome: options.javaHome,
|
|
1152
|
+
host
|
|
1153
|
+
});
|
|
1154
|
+
const failed = checks.find((check) => check.status === "failed");
|
|
1155
|
+
const javaObservation = coordinates.java ?? coordinates.javaProbeFailure?.properties;
|
|
1156
|
+
const observation = {
|
|
1157
|
+
platform,
|
|
1158
|
+
architecture,
|
|
1159
|
+
applicationPropertiesPath: coordinates.applicationPropertiesPath,
|
|
1160
|
+
configurationDirectoryName: coordinates.properties?.configurationDirectoryName ?? null,
|
|
1161
|
+
nativeDecompilerPath: coordinates.nativeDecompilerPath,
|
|
1162
|
+
...coordinates.nativeDecompilerHeader.ok ? {} : { nativeDecompilerHeaderFailure: coordinates.nativeDecompilerHeader.error },
|
|
1163
|
+
javaCommand: coordinates.javaCommand,
|
|
1164
|
+
...coordinates.javaProbeFailure === undefined ? {} : { javaProbeFailure: coordinates.javaProbeFailure },
|
|
1165
|
+
...javaObservation?.vmName == null ? {} : { javaVmName: javaObservation.vmName },
|
|
1166
|
+
...javaObservation?.osArch == null ? {} : { javaOsArch: javaObservation.osArch },
|
|
1167
|
+
...javaObservation?.osName == null ? {} : { javaOsName: javaObservation.osName },
|
|
1168
|
+
checks
|
|
1169
|
+
};
|
|
1170
|
+
if (failed !== undefined) return {
|
|
1171
|
+
status: "unavailable",
|
|
1172
|
+
...observation,
|
|
1173
|
+
installDir: coordinates.installDir,
|
|
1174
|
+
analyzeHeadlessPath: coordinates.analyzeHeadlessPath,
|
|
1175
|
+
providerVersion: coordinates.properties?.providerVersion ?? null,
|
|
1176
|
+
javaHome: javaObservation?.home ?? options.javaHome ?? null,
|
|
1177
|
+
javaVersion: javaObservation?.version ?? null,
|
|
1178
|
+
rejection: {
|
|
1179
|
+
code: failed.code,
|
|
1180
|
+
reason: failed.remediation
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
if (options.signal?.aborted) throw new AnalysisCancelledError("ghidra:installation", {
|
|
1184
|
+
cause: options.signal.reason,
|
|
1185
|
+
diagnostics: ghidraInstallationDiagnostics(availableInstallation(coordinates, observation))
|
|
1186
|
+
});
|
|
1187
|
+
return availableInstallation(coordinates, observation);
|
|
1188
|
+
};
|
|
1189
|
+
availableInstallation = (coordinates, observation) => {
|
|
1190
|
+
const providerVersion = coordinates.properties?.providerVersion;
|
|
1191
|
+
if (coordinates.installDir === null || coordinates.applicationPropertiesPath === null || coordinates.analyzeHeadlessPath === null || providerVersion === null || providerVersion === undefined || coordinates.java === undefined) throw new TypeError("Passing Ghidra installation checks produced incomplete coordinates");
|
|
1192
|
+
return {
|
|
1193
|
+
status: "available",
|
|
1194
|
+
...observation,
|
|
1195
|
+
installDir: coordinates.installDir,
|
|
1196
|
+
analyzeHeadlessPath: coordinates.analyzeHeadlessPath,
|
|
1197
|
+
applicationPropertiesPath: coordinates.applicationPropertiesPath,
|
|
1198
|
+
providerVersion,
|
|
1199
|
+
javaHome: coordinates.java.home,
|
|
1200
|
+
javaVersion: coordinates.java.version
|
|
1201
|
+
};
|
|
1202
|
+
};
|
|
1203
|
+
installationCoordinates = async (options, platform, architecture, host) => {
|
|
1204
|
+
const path = platform === "win32" ? win32 : posix;
|
|
1205
|
+
const installDir = options.installDir ?? host.discoverInstallDirOnPath?.(options.environment, platform) ?? null;
|
|
1206
|
+
const applicationPropertiesPath = installDir === null ? null : path.join(installDir, "Ghidra", "application.properties");
|
|
1207
|
+
const analyzeHeadlessPath = installDir === null ? null : path.join(installDir, "support", platform === "win32" ? "analyzeHeadless.bat" : "analyzeHeadless");
|
|
1208
|
+
const decompilerPlatform = NATIVE_PLATFORMS[platform]?.[architecture];
|
|
1209
|
+
const decompilerExecutable = platform === "win32" ? "decompile.exe" : "decompile";
|
|
1210
|
+
const nativeDecompilerPath = installDir === null || decompilerPlatform === undefined ? null : [path.join(installDir, "Ghidra", "Features", "Decompiler", "os", decompilerPlatform, decompilerExecutable), path.join(installDir, "Ghidra", "Features", "Decompiler", "build", "os", decompilerPlatform, decompilerExecutable)].find((candidate) => host.executable(candidate)) ?? null;
|
|
1211
|
+
const properties = applicationPropertiesPath === null ? undefined : await host.readText(applicationPropertiesPath, {
|
|
1212
|
+
resourceOwner: options.resourceOwner,
|
|
1213
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1214
|
+
});
|
|
1215
|
+
const nativeDecompilerHeader = nativeDecompilerPath === null || host.executableHeader === undefined ? ok(undefined) : await host.executableHeader(nativeDecompilerPath, {
|
|
1216
|
+
resourceOwner: options.resourceOwner,
|
|
1217
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1218
|
+
});
|
|
1219
|
+
if (!nativeDecompilerHeader.ok && (nativeDecompilerHeader.error instanceof AnalysisCancelledError || nativeDecompilerHeader.error.cleanupIncomplete)) throw nativeDecompilerHeader.error;
|
|
1220
|
+
const javaCommand = (() => {
|
|
1221
|
+
if (options.javaHome !== undefined) return path.join(options.javaHome, "bin", platform === "win32" ? "java.exe" : "java");
|
|
1222
|
+
if (platform !== "darwin") return platform === "win32" ? "java.exe" : "java";
|
|
1223
|
+
const javaOnPath = options.environment.PATH?.split(":").some((directory) => path.isAbsolute(directory) && host.executable(path.join(directory, "java")));
|
|
1224
|
+
if (javaOnPath) return "java";
|
|
1225
|
+
const prefixes = architecture === "arm64" ? ["/opt/homebrew", "/usr/local"] : ["/usr/local", "/opt/homebrew"];
|
|
1226
|
+
return prefixes.map((prefix) => path.join(prefix, "opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/java")).find((candidate) => host.executable(candidate)) ?? "java";
|
|
1227
|
+
})();
|
|
1228
|
+
const javaProbe = options.javaHome === undefined || path.isAbsolute(options.javaHome) ? await host.probeJava(javaCommand, ghidraJavaEnvironment(options.javaHome, options.environment, platform), {
|
|
1229
|
+
resourceOwner: options.resourceOwner,
|
|
1230
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1231
|
+
}) : undefined;
|
|
1232
|
+
if (javaProbe !== undefined && !javaProbe.ok && javaProbe.error instanceof AnalysisError) throw javaProbe.error;
|
|
1233
|
+
return {
|
|
1234
|
+
installDir,
|
|
1235
|
+
applicationPropertiesPath,
|
|
1236
|
+
analyzeHeadlessPath,
|
|
1237
|
+
nativeDecompilerPath,
|
|
1238
|
+
nativeDecompilerHeader,
|
|
1239
|
+
properties: properties === undefined ? undefined : ghidraApplicationProperties(properties),
|
|
1240
|
+
javaCommand,
|
|
1241
|
+
java: javaProbe?.ok === true ? javaProbe.value : undefined,
|
|
1242
|
+
javaProbeFailure: javaProbe !== undefined && !javaProbe.ok && !(javaProbe.error instanceof AnalysisError) ? javaProbe.error : undefined
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
installationChecks = ({ coordinates, platform, architecture, javaHome, host }) => [
|
|
1246
|
+
configurationCheck(coordinates.installDir, javaHome, platform),
|
|
1247
|
+
installationCheck({
|
|
1248
|
+
name: "platform",
|
|
1249
|
+
passed: NATIVE_PLATFORMS[platform] !== undefined,
|
|
1250
|
+
code: "unsupported_host",
|
|
1251
|
+
detail: platform,
|
|
1252
|
+
remediation: "Use Linux or macOS x64/arm64, or Windows x64 with matching native Ghidra tools."
|
|
1253
|
+
}),
|
|
1254
|
+
installationCheck({
|
|
1255
|
+
name: "architecture",
|
|
1256
|
+
passed: NATIVE_PLATFORMS[platform]?.[architecture] !== undefined,
|
|
1257
|
+
code: "unsupported_host",
|
|
1258
|
+
detail: architecture,
|
|
1259
|
+
remediation: "Use x64/arm64 on Linux or macOS, or x64 on Windows."
|
|
1260
|
+
}),
|
|
1261
|
+
installationCheck({
|
|
1262
|
+
name: "installation",
|
|
1263
|
+
passed: coordinates.properties !== undefined,
|
|
1264
|
+
code: "executable_missing",
|
|
1265
|
+
detail: coordinates.applicationPropertiesPath ?? "Ghidra application properties unavailable",
|
|
1266
|
+
remediation: "Point GHIDRA_INSTALL_DIR at the root of an extracted official Ghidra release."
|
|
1267
|
+
}),
|
|
1268
|
+
versionCheck(coordinates.properties),
|
|
1269
|
+
installationCheck({
|
|
1270
|
+
name: "headless",
|
|
1271
|
+
passed: coordinates.analyzeHeadlessPath !== null && host.executable(coordinates.analyzeHeadlessPath),
|
|
1272
|
+
code: "executable_missing",
|
|
1273
|
+
detail: coordinates.analyzeHeadlessPath ?? "analyzeHeadless unavailable",
|
|
1274
|
+
remediation: "Restore support/analyzeHeadless or support/analyzeHeadless.bat from the official Ghidra release."
|
|
1275
|
+
}),
|
|
1276
|
+
nativeDecompilerCheck({
|
|
1277
|
+
coordinates,
|
|
1278
|
+
platform,
|
|
1279
|
+
architecture
|
|
1280
|
+
}),
|
|
1281
|
+
javaCheck(coordinates.java, coordinates.javaCommand, javaHome, coordinates.properties, platform, coordinates.javaProbeFailure)
|
|
1282
|
+
];
|
|
1283
|
+
configurationCheck = (installDir, javaHome, platform) => {
|
|
1284
|
+
const { isAbsolute } = platform === "win32" ? win32 : posix;
|
|
1285
|
+
const relative = [...installDir !== null && !isAbsolute(installDir) ? ["GHIDRA_INSTALL_DIR"] : [], ...javaHome !== undefined && !isAbsolute(javaHome) ? ["JAVA_HOME"] : []];
|
|
1286
|
+
if (installDir === null || relative.length === 0) return installationCheck({
|
|
1287
|
+
name: "configuration",
|
|
1288
|
+
passed: installDir !== null,
|
|
1289
|
+
code: "not_configured",
|
|
1290
|
+
detail: installDir ?? "GHIDRA_INSTALL_DIR is not set",
|
|
1291
|
+
remediation: `Set GHIDRA_INSTALL_DIR to an extracted Ghidra ${ghidraReleaseLine()} release directory.`
|
|
1292
|
+
});
|
|
1293
|
+
const settings = relative.join(" and ");
|
|
1294
|
+
return installationCheck({
|
|
1295
|
+
name: "configuration",
|
|
1296
|
+
passed: false,
|
|
1297
|
+
code: "not_configured",
|
|
1298
|
+
detail: `${settings} must be absolute`,
|
|
1299
|
+
remediation: `Set ${settings} to ${relative.length === 1 ? "an absolute path" : "absolute paths"}. REA's analysis and MCP server reject relative paths even when they resolve from the current directory.`
|
|
1300
|
+
});
|
|
1301
|
+
};
|
|
1302
|
+
ghidraInstallationDiagnostics = (inspection) => ({
|
|
1303
|
+
install_dir: inspection.installDir,
|
|
1304
|
+
analyze_headless_path: inspection.analyzeHeadlessPath,
|
|
1305
|
+
native_decompiler_path: inspection.nativeDecompilerPath,
|
|
1306
|
+
...inspection.nativeDecompilerHeaderFailure === undefined ? {} : { native_decompiler_header_failure: projectAnalysisError(inspection.nativeDecompilerHeaderFailure) },
|
|
1307
|
+
application_properties_path: inspection.applicationPropertiesPath,
|
|
1308
|
+
provider_version: inspection.providerVersion,
|
|
1309
|
+
java_command: inspection.javaCommand,
|
|
1310
|
+
...inspection.javaProbeFailure === undefined ? {} : { java_probe_failure: {
|
|
1311
|
+
code: inspection.javaProbeFailure.code,
|
|
1312
|
+
...inspection.javaProbeFailure.processErrorCode === undefined ? {} : { process_error_code: inspection.javaProbeFailure.processErrorCode },
|
|
1313
|
+
detail: inspection.javaProbeFailure.detail,
|
|
1314
|
+
...inspection.javaProbeFailure.cancellation === undefined ? {} : { cancellation_observed: true },
|
|
1315
|
+
...inspection.javaProbeFailure.properties === undefined ? {} : { properties: { ...inspection.javaProbeFailure.properties } },
|
|
1316
|
+
...inspection.javaProbeFailure.output === undefined ? {} : { output: { ...inspection.javaProbeFailure.output } }
|
|
1317
|
+
} },
|
|
1318
|
+
java_home: inspection.javaHome,
|
|
1319
|
+
java_version: inspection.javaVersion,
|
|
1320
|
+
java_vm_name: inspection.javaVmName ?? null,
|
|
1321
|
+
java_os_arch: inspection.javaOsArch ?? null,
|
|
1322
|
+
java_os_name: inspection.javaOsName ?? null,
|
|
1323
|
+
platform: inspection.platform,
|
|
1324
|
+
architecture: inspection.architecture,
|
|
1325
|
+
checks: inspection.checks.map((check) => ({
|
|
1326
|
+
name: check.name,
|
|
1327
|
+
ok: check.status === "passed",
|
|
1328
|
+
code: check.status === "failed" ? check.code : null,
|
|
1329
|
+
detail: check.detail
|
|
1330
|
+
}))
|
|
1331
|
+
});
|
|
1332
|
+
ghidraJavaEnvironment = (javaHome, environment, platform = process.platform) => {
|
|
1333
|
+
const selectedEnvironment = snapshotEnvironment(environment, platform);
|
|
1334
|
+
const boundedEnvironment = {
|
|
1335
|
+
...selectedEnvironment,
|
|
1336
|
+
_JAVA_OPTIONS: "",
|
|
1337
|
+
JAVA_TOOL_OPTIONS: "",
|
|
1338
|
+
JDK_JAVA_OPTIONS: "",
|
|
1339
|
+
GHIDRA_JAVA_OPTIONS: ""
|
|
1340
|
+
};
|
|
1341
|
+
return javaHome === undefined ? boundedEnvironment : {
|
|
1342
|
+
...boundedEnvironment,
|
|
1343
|
+
JAVA_HOME: javaHome,
|
|
1344
|
+
PATH: `${(platform === "win32" ? win32 : posix).join(javaHome, "bin")}${platform === "win32" ? win32.delimiter : posix.delimiter}${selectedEnvironment.PATH ?? ""}`
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1347
|
+
installationCheck = (options) => options.passed ? {
|
|
1348
|
+
status: "passed",
|
|
1349
|
+
name: options.name,
|
|
1350
|
+
detail: options.detail
|
|
1351
|
+
} : {
|
|
1352
|
+
status: "failed",
|
|
1353
|
+
name: options.name,
|
|
1354
|
+
code: options.code,
|
|
1355
|
+
detail: options.detail,
|
|
1356
|
+
remediation: options.remediation
|
|
1357
|
+
};
|
|
1358
|
+
nativeDecompilerCheck = ({ coordinates, platform, architecture }) => {
|
|
1359
|
+
const path = coordinates.nativeDecompilerPath;
|
|
1360
|
+
const compatibility = path === null ? undefined : !coordinates.nativeDecompilerHeader.ok ? {
|
|
1361
|
+
status: "unknown",
|
|
1362
|
+
detail: `${path} header is unknown: ${coordinates.nativeDecompilerHeader.error.message}`
|
|
1363
|
+
} : assessNativeDecompiler(path, platform, architecture, coordinates.nativeDecompilerHeader.value);
|
|
1364
|
+
const osArch = coordinates.java?.osArch ?? coordinates.javaProbeFailure?.properties?.osArch ?? undefined;
|
|
1365
|
+
const osName = coordinates.java?.osName ?? coordinates.javaProbeFailure?.properties?.osName ?? undefined;
|
|
1366
|
+
const selectedDirectory = jvmOsArchNativeDirectory(platform, osArch);
|
|
1367
|
+
const validatedDirectory = NATIVE_PLATFORMS[platform]?.[architecture];
|
|
1368
|
+
if (coordinates.java !== undefined) {
|
|
1369
|
+
if (selectedDirectory === undefined) return installationCheck({
|
|
1370
|
+
name: "native_decompiler",
|
|
1371
|
+
passed: false,
|
|
1372
|
+
code: "executable_missing",
|
|
1373
|
+
detail: osArch === undefined ? "The Java probe did not report os.arch; the JVM-selected native decompiler directory is unknown and cannot be matched to the validated host directory" : `JVM reports unrecognized os.arch=${osArch}; its selected native decompiler directory is unknown and cannot be matched to the validated host directory`,
|
|
1374
|
+
remediation: `Point JAVA_HOME at a JDK whose reported architecture maps to the validated Ghidra decompiler (${validatedDirectory ?? "unsupported host"}). REA does not build or install native tools.`
|
|
1375
|
+
});
|
|
1376
|
+
if (validatedDirectory !== undefined && selectedDirectory !== validatedDirectory && path !== null) return installationCheck({
|
|
1377
|
+
name: "native_decompiler",
|
|
1378
|
+
passed: false,
|
|
1379
|
+
code: "executable_missing",
|
|
1380
|
+
detail: `JVM reports os.arch=${osArch}, so Ghidra selects its native decompiler from os/${selectedDirectory}, but the validated decompiler targets ${validatedDirectory} (host ${platform}/${architecture})`,
|
|
1381
|
+
remediation: `Point JAVA_HOME at a JDK whose architecture matches the built decompiler (${validatedDirectory}). REA does not build or install native tools.`
|
|
1382
|
+
});
|
|
1383
|
+
if (osName === undefined) return installationCheck({
|
|
1384
|
+
name: "native_decompiler",
|
|
1385
|
+
passed: false,
|
|
1386
|
+
code: "executable_missing",
|
|
1387
|
+
detail: "The Java probe did not report os.name; the JVM-selected native decompiler OS directory is unknown and cannot be matched to the validated host platform",
|
|
1388
|
+
remediation: `Point JAVA_HOME at a JDK whose reported operating system matches the host platform (${platform}). REA does not build or install native tools.`
|
|
1389
|
+
});
|
|
1390
|
+
if (!jvmOsNameMatchesPlatform(platform, osName) && path !== null) return installationCheck({
|
|
1391
|
+
name: "native_decompiler",
|
|
1392
|
+
passed: false,
|
|
1393
|
+
code: "executable_missing",
|
|
1394
|
+
detail: `JVM reports os.name=${osName}, which does not match the validated host platform ${platform} (host ${platform}/${architecture})`,
|
|
1395
|
+
remediation: `Point JAVA_HOME at a JDK whose reported operating system matches the host platform (${platform}). REA does not build or install native tools.`
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
return installationCheck({
|
|
1399
|
+
name: "native_decompiler",
|
|
1400
|
+
passed: path !== null && compatibility?.status !== "incompatible",
|
|
1401
|
+
code: "executable_missing",
|
|
1402
|
+
detail: compatibility?.detail ?? `Matching native decompiler for ${platform}/${architecture} was not found`,
|
|
1403
|
+
remediation: compatibility?.status === "incompatible" ? compatibility.remediation : `Provide an executable Ghidra/Features/Decompiler/os/${NATIVE_PLATFORMS[platform]?.[architecture] ?? "<platform>"}/${platform === "win32" ? "decompile.exe" : "decompile"}, or its build/os equivalent. REA does not build or install native tools.`
|
|
1404
|
+
});
|
|
1405
|
+
};
|
|
1406
|
+
jvmOsNameMatchesPlatform = (platform, osName) => {
|
|
1407
|
+
const normalized = osName.toLowerCase();
|
|
1408
|
+
if (platform === "win32") return normalized.startsWith("windows");
|
|
1409
|
+
if (platform === "darwin") return normalized.startsWith("mac") || normalized.startsWith("darwin");
|
|
1410
|
+
if (platform === "linux") return normalized.startsWith("linux");
|
|
1411
|
+
return false;
|
|
1412
|
+
};
|
|
1413
|
+
jvmOsArchNativeDirectory = (platform, osArch) => {
|
|
1414
|
+
if (osArch === undefined) return undefined;
|
|
1415
|
+
const normalized = osArch.toLowerCase();
|
|
1416
|
+
const node = normalized === "x86_64" || normalized === "amd64" || normalized === "x64" ? "x64" : normalized === "aarch64" || normalized === "arm64" ? "arm64" : undefined;
|
|
1417
|
+
return node === undefined ? undefined : NATIVE_PLATFORMS[platform]?.[node];
|
|
1418
|
+
};
|
|
1419
|
+
versionCheck = (properties) => {
|
|
1420
|
+
const raw = properties?.providerVersion;
|
|
1421
|
+
const parseError = properties?.parseError;
|
|
1422
|
+
return installationCheck({
|
|
1423
|
+
name: "version",
|
|
1424
|
+
passed: parseError == null && ghidraReleaseAccepted(raw),
|
|
1425
|
+
code: parseError != null ? "version_unresolved" : ghidraReleaseCompatibility(raw).status === "unsupported" ? "unsupported_version" : "version_unresolved",
|
|
1426
|
+
detail: parseError == null ? ghidraVersionDetail(raw) : `application.properties could not be parsed: ${parseError}`,
|
|
1427
|
+
remediation: `Install a Ghidra ${ghidraReleaseLine()} release (verified with ${SUPPORTED_GHIDRA_VERSION}), or update REA for another Ghidra line.`
|
|
1428
|
+
});
|
|
1429
|
+
};
|
|
1430
|
+
javaCheck = (observation, command, configuredHome, properties, platform, failure) => {
|
|
1431
|
+
const requirement = ghidraJavaRequirement(properties);
|
|
1432
|
+
const range = ghidraJavaRangeLabel(requirement);
|
|
1433
|
+
const supported = observation !== undefined && ghidraJavaMajorAccepted(observation.major, requirement) && observation.bits === 64 && observation.runtime === "jdk";
|
|
1434
|
+
const bitness = observation === undefined ? undefined : observation.bits === null ? `bitness unknown${observation.unparsedBits === undefined ? "" : ` (sun.arch.data.model = ${JSON.stringify(observation.unparsedBits)})`}` : `${String(observation.bits)}-bit`;
|
|
1435
|
+
const knownMismatch = observation !== undefined && (!ghidraJavaMajorAccepted(observation.major, requirement) || observation.bits !== null && observation.bits !== 64 || observation.runtime !== "jdk");
|
|
1436
|
+
const detail = observation === undefined ? requirement.unresolved === null ? failure?.detail ?? `${command}: Java probe was not attempted` : `${failure?.detail ?? command}; ${requirement.unresolved}` : `${observation.version}; ${bitness}; ${observation.runtime === "jdk" ? "JDK" : "runtime only"}; ${observation.home}; accepted ${range}`;
|
|
1437
|
+
return installationCheck({
|
|
1438
|
+
name: "java",
|
|
1439
|
+
passed: supported,
|
|
1440
|
+
code: requirement.unresolved !== null ? "version_unresolved" : observation === undefined ? failure?.code ?? "version_unresolved" : knownMismatch ? "unsupported_version" : "version_unresolved",
|
|
1441
|
+
detail,
|
|
1442
|
+
remediation: javaRemediation(requirement, configuredHome, range, platform)
|
|
1443
|
+
});
|
|
1444
|
+
};
|
|
1445
|
+
javaRemediation = (requirement, configuredHome, range, platform) => {
|
|
1446
|
+
if (requirement.unresolved !== null) return `The Ghidra installation's Java bounds could not be read (${requirement.unresolved}). Install a 64-bit full JDK inside the declared application.java.min and application.java.max.`;
|
|
1447
|
+
return configuredHome === undefined ? `Select ${range} on PATH, or set JAVA_HOME to its installation root before starting REA.${platform === "darwin" ? " Homebrew OpenJDK can be keg-only: set JAVA_HOME to the selected formula's libexec/openjdk.jdk/Contents/Home (for example /opt/homebrew/opt/openjdk/libexec/openjdk.jdk/Contents/Home or /usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home). The installed JDK must satisfy the declared Ghidra Java bounds." : ""}` : `Update JAVA_HOME to the root of ${range} installation.`;
|
|
1448
|
+
};
|
|
1449
|
+
systemGhidraInstallationHost = () => ({
|
|
1450
|
+
readText: readGhidraInstallationProperties,
|
|
1451
|
+
executableHeader: readGhidraExecutableHeader,
|
|
1452
|
+
executable(path) {
|
|
1453
|
+
try {
|
|
1454
|
+
accessSync(path, constants.X_OK);
|
|
1455
|
+
return statSync(path).isFile();
|
|
1456
|
+
} catch (cause) {
|
|
1457
|
+
void cause;
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
probeJava: probeGhidraJava,
|
|
1462
|
+
discoverInstallDirOnPath: discoverGhidraInstallationOnPath
|
|
1463
|
+
});
|
|
1464
|
+
discoverGhidraInstallationOnPath = (environment, platform) => {
|
|
1465
|
+
if (platform !== process.platform) return undefined;
|
|
1466
|
+
const path = platform === "win32" ? win32 : posix;
|
|
1467
|
+
const pathValue = environment.PATH;
|
|
1468
|
+
if (pathValue === undefined || pathValue.length === 0) return undefined;
|
|
1469
|
+
const launchers = platform === "win32" ? [
|
|
1470
|
+
"ghidra.bat",
|
|
1471
|
+
"ghidraRun.bat",
|
|
1472
|
+
"ghidra.exe",
|
|
1473
|
+
"ghidraRun.exe"
|
|
1474
|
+
] : ["ghidra", "ghidraRun"];
|
|
1475
|
+
for (const directory of pathValue.split(delimiter)) {
|
|
1476
|
+
if (directory.length === 0) continue;
|
|
1477
|
+
for (const launcher of launchers) {
|
|
1478
|
+
let resolved;
|
|
1479
|
+
try {
|
|
1480
|
+
const candidate = path.resolve(directory, launcher);
|
|
1481
|
+
if (!executablePath(candidate)) continue;
|
|
1482
|
+
resolved = realpathSync(candidate);
|
|
1483
|
+
} catch (cause) {
|
|
1484
|
+
void cause;
|
|
1485
|
+
continue;
|
|
1486
|
+
}
|
|
1487
|
+
const root = dirname(resolved);
|
|
1488
|
+
const properties = path.join(root, "Ghidra", "application.properties");
|
|
1489
|
+
const headless = path.join(root, "support", platform === "win32" ? "analyzeHeadless.bat" : "analyzeHeadless");
|
|
1490
|
+
try {
|
|
1491
|
+
if (statSync(properties).isFile() && executablePath(headless)) return root;
|
|
1492
|
+
} catch (cause) {
|
|
1493
|
+
void cause;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
return undefined;
|
|
1498
|
+
};
|
|
1499
|
+
executablePath = (path) => {
|
|
1500
|
+
try {
|
|
1501
|
+
accessSync(path, constants.X_OK);
|
|
1502
|
+
return statSync(path).isFile();
|
|
1503
|
+
} catch (cause) {
|
|
1504
|
+
void cause;
|
|
1505
|
+
return false;
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
})))();
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
//#endregion
|
|
1512
|
+
//#region dist/ida/IdaConfiguration.js
|
|
1513
|
+
var common, registrationSchema, idaProtocol, readIdaConfiguration, idaConfigurationError;
|
|
1514
|
+
function init_IdaConfiguration() {
|
|
1515
|
+
return (init_IdaConfiguration = __esmMin((() => {
|
|
1516
|
+
init_configurationErrors();
|
|
1517
|
+
init_result();
|
|
1518
|
+
common = {
|
|
1519
|
+
mode: z.enum(["attached", "headless"]).default("attached"),
|
|
1520
|
+
protocol: z.literal("native").optional(),
|
|
1521
|
+
timeoutMs: z.number().int().positive().max(2147483647).default(3e5),
|
|
1522
|
+
workspaceRoot: z.string().refine(isAbsolute, "workspaceRoot must be absolute on the REA host").optional()
|
|
1523
|
+
};
|
|
1524
|
+
registrationSchema = z.union([z.object({
|
|
1525
|
+
...common,
|
|
1526
|
+
type: z.literal("stdio").optional(),
|
|
1527
|
+
command: z.string().min(1),
|
|
1528
|
+
args: z.array(z.string()).default([]),
|
|
1529
|
+
env: z.record(z.string(), z.string()).default({})
|
|
1530
|
+
}).strict(), z.object({
|
|
1531
|
+
...common,
|
|
1532
|
+
type: z.literal("http").optional(),
|
|
1533
|
+
url: z.url().refine((value) => {
|
|
1534
|
+
const url = new URL(value);
|
|
1535
|
+
return ["http:", "https:"].includes(url.protocol) && [
|
|
1536
|
+
"localhost",
|
|
1537
|
+
"127.0.0.1",
|
|
1538
|
+
"[::1]"
|
|
1539
|
+
].includes(url.hostname) && url.username === "" && url.password === "";
|
|
1540
|
+
}, "IDA MCP must use a local HTTP endpoint without URL credentials"),
|
|
1541
|
+
headers: z.record(z.string(), z.string()).default({})
|
|
1542
|
+
}).strict()]).refine((config) => config.protocol !== "native" || config.mode === "attached", "The native IDA MCP protocol requires attached mode");
|
|
1543
|
+
idaProtocol = (config) => config.protocol ?? (config.mode === "attached" ? "legacy" : "modern");
|
|
1544
|
+
readIdaConfiguration = (path) => {
|
|
1545
|
+
try {
|
|
1546
|
+
if (statSync(path).size > 65536) return err(idaConfigurationError("REA_IDA_MCP_CONFIG exceeds the 64 KiB registration size."));
|
|
1547
|
+
const input = JSON.parse(readFileSync(path, "utf8"));
|
|
1548
|
+
const envelope = z.object({ mcpServers: z.object({ "ida-pro-mcp": z.unknown() }) }).safeParse(input);
|
|
1549
|
+
const parsed = registrationSchema.safeParse(envelope.success ? envelope.data.mcpServers["ida-pro-mcp"] : input);
|
|
1550
|
+
return parsed.success ? ok(parsed.data) : err(idaConfigurationError("REA_IDA_MCP_CONFIG must contain an IDA MCP command/args or local url registration; see docs/ida-provider.md.", parsed.error));
|
|
1551
|
+
} catch (cause) {
|
|
1552
|
+
return err(idaConfigurationError(`Cannot read IDA MCP registration ${path}; provide a readable JSON configuration.`, cause));
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
idaConfigurationError = (constraint, cause) => new ConfigurationError(constraint, {
|
|
1556
|
+
...cause === undefined ? {} : { cause },
|
|
1557
|
+
settings: [{
|
|
1558
|
+
setting: "REA_IDA_MCP_CONFIG",
|
|
1559
|
+
constraint
|
|
1560
|
+
}]
|
|
1561
|
+
});
|
|
1562
|
+
})))();
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region dist/kuna/KunaRelease.js
|
|
1567
|
+
var KUNA_VERIFIED_VERSION, KUNA_PROVIDER_ID, KUNA_COMMAND_REMEDIATION, KUNA_UNSUPPORTED_HOST_REMEDIATION, KUNA_VERSION_PROBE_REMEDIATION;
|
|
1568
|
+
function init_KunaRelease() {
|
|
1569
|
+
return (init_KunaRelease = __esmMin((() => {
|
|
1570
|
+
KUNA_VERIFIED_VERSION = "1.833";
|
|
1571
|
+
KUNA_PROVIDER_ID = "kuna";
|
|
1572
|
+
KUNA_COMMAND_REMEDIATION = `Set REA_KUNA_COMMAND to the absolute path of a caller-supplied kuna executable (verified with ${KUNA_VERIFIED_VERSION}). REA does not download, install or update Kuna.`;
|
|
1573
|
+
KUNA_UNSUPPORTED_HOST_REMEDIATION = "Use Linux or macOS for the Kuna provider. Windows process-tree ownership for Kuna is not verified.";
|
|
1574
|
+
KUNA_VERSION_PROBE_REMEDIATION = "Run the selected executable with --version: it must exit promptly and print `kuna <major>.<minor>`.";
|
|
1575
|
+
})))();
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
//#endregion
|
|
1579
|
+
//#region dist/kuna/KunaConfiguration.js
|
|
1580
|
+
var MAX_KUNA_JOBS, DEFAULT_PROJECT_TIMEOUT_MS, DEFAULT_FUNCTION_TIMEOUT_MS, DEFAULT_JOBS, DEFAULT_CACHE_MAX_BYTES, MIN_CACHE_MAX_BYTES, kunaFunctionDeadline, kunaProjectDeadline, failure$1, positiveInteger, defaultCacheRoot, readKunaConfiguration;
|
|
1581
|
+
function init_KunaConfiguration() {
|
|
1582
|
+
return (init_KunaConfiguration = __esmMin((() => {
|
|
1583
|
+
init_homeDirectory();
|
|
1584
|
+
init_providerStartupTimeout();
|
|
1585
|
+
init_result();
|
|
1586
|
+
init_KunaRelease();
|
|
1587
|
+
MAX_KUNA_JOBS = 32;
|
|
1588
|
+
DEFAULT_PROJECT_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
1589
|
+
DEFAULT_FUNCTION_TIMEOUT_MS = 12e4;
|
|
1590
|
+
DEFAULT_JOBS = 1;
|
|
1591
|
+
DEFAULT_CACHE_MAX_BYTES = 4 * 1024 ** 3;
|
|
1592
|
+
MIN_CACHE_MAX_BYTES = 1024 ** 2;
|
|
1593
|
+
kunaFunctionDeadline = (configuration) => ({
|
|
1594
|
+
setting: "REA_KUNA_TIMEOUT_MS",
|
|
1595
|
+
ms: configuration.functionTimeoutMs
|
|
1596
|
+
});
|
|
1597
|
+
kunaProjectDeadline = (configuration) => ({
|
|
1598
|
+
setting: "REA_KUNA_PROJECT_TIMEOUT_MS",
|
|
1599
|
+
ms: configuration.projectTimeoutMs
|
|
1600
|
+
});
|
|
1601
|
+
failure$1 = (code, reason, setting = null) => err({
|
|
1602
|
+
code,
|
|
1603
|
+
reason,
|
|
1604
|
+
setting
|
|
1605
|
+
});
|
|
1606
|
+
positiveInteger = (value) => /^[1-9]\d*$/u.test(value) && Number.isSafeInteger(Number(value)) ? Number(value) : undefined;
|
|
1607
|
+
defaultCacheRoot = (environment, platform) => {
|
|
1608
|
+
const home = homeDirectoryFromEnvironment(environment, platform);
|
|
1609
|
+
if (platform === "darwin") return join(home, "Library", "Caches", "rea", "kuna");
|
|
1610
|
+
const xdg = environment.XDG_CACHE_HOME;
|
|
1611
|
+
return join(xdg !== undefined && isAbsolute(xdg) ? xdg : join(home, ".cache"), "rea", "kuna");
|
|
1612
|
+
};
|
|
1613
|
+
readKunaConfiguration = (environment, platform = process.platform) => {
|
|
1614
|
+
const command = environment.REA_KUNA_COMMAND;
|
|
1615
|
+
if (command === undefined || command.length === 0) return failure$1("not_configured", KUNA_COMMAND_REMEDIATION);
|
|
1616
|
+
if (!isAbsolute(command)) return failure$1("open_options_invalid", `REA_KUNA_COMMAND must be an absolute path; received ${command}. ${KUNA_COMMAND_REMEDIATION}`, "REA_KUNA_COMMAND");
|
|
1617
|
+
if (platform !== "darwin" && platform !== "linux") return failure$1("unsupported_host", KUNA_UNSUPPORTED_HOST_REMEDIATION);
|
|
1618
|
+
const cacheRoot = environment.REA_KUNA_CACHE_DIR;
|
|
1619
|
+
if (cacheRoot !== undefined && !isAbsolute(cacheRoot)) return failure$1("open_options_invalid", `REA_KUNA_CACHE_DIR must be an absolute directory; received ${cacheRoot}.`, "REA_KUNA_CACHE_DIR");
|
|
1620
|
+
const rawMaxBytes = environment.REA_KUNA_CACHE_MAX_BYTES;
|
|
1621
|
+
const cacheMaxBytes = rawMaxBytes === undefined ? DEFAULT_CACHE_MAX_BYTES : positiveInteger(rawMaxBytes);
|
|
1622
|
+
if (cacheMaxBytes === undefined || cacheMaxBytes < MIN_CACHE_MAX_BYTES) return failure$1("open_options_invalid", `REA_KUNA_CACHE_MAX_BYTES must be a decimal byte count of at least ${String(MIN_CACHE_MAX_BYTES)}; received ${String(rawMaxBytes)}.`, "REA_KUNA_CACHE_MAX_BYTES");
|
|
1623
|
+
const rawTimeout = environment.REA_KUNA_PROJECT_TIMEOUT_MS;
|
|
1624
|
+
const timeout = rawTimeout === undefined ? undefined : providerStartupTimeoutSchema.safeParse(rawTimeout);
|
|
1625
|
+
if (timeout !== undefined && !timeout.success) return failure$1("open_options_invalid", `REA_KUNA_PROJECT_TIMEOUT_MS must be a decimal millisecond count from 1 to 2147483647; received ${String(rawTimeout)}.`, "REA_KUNA_PROJECT_TIMEOUT_MS");
|
|
1626
|
+
const rawFunctionTimeout = environment.REA_KUNA_TIMEOUT_MS;
|
|
1627
|
+
const functionTimeout = rawFunctionTimeout === undefined ? undefined : providerStartupTimeoutSchema.safeParse(rawFunctionTimeout);
|
|
1628
|
+
if (functionTimeout !== undefined && !functionTimeout.success) return failure$1("open_options_invalid", `REA_KUNA_TIMEOUT_MS must be a decimal millisecond count from 1 to 2147483647; received ${String(rawFunctionTimeout)}.`, "REA_KUNA_TIMEOUT_MS");
|
|
1629
|
+
const rawJobs = environment.REA_KUNA_JOBS;
|
|
1630
|
+
const jobs = rawJobs === undefined ? DEFAULT_JOBS : positiveInteger(rawJobs);
|
|
1631
|
+
if (jobs === undefined || jobs > MAX_KUNA_JOBS) return failure$1("open_options_invalid", `REA_KUNA_JOBS must be an integer from 1 to ${String(MAX_KUNA_JOBS)}; received ${String(rawJobs)}.`, "REA_KUNA_JOBS");
|
|
1632
|
+
return ok({
|
|
1633
|
+
command,
|
|
1634
|
+
cacheRoot: cacheRoot ?? defaultCacheRoot(environment, platform),
|
|
1635
|
+
cacheMaxBytes,
|
|
1636
|
+
projectTimeoutMs: timeout?.data ?? DEFAULT_PROJECT_TIMEOUT_MS,
|
|
1637
|
+
functionTimeoutMs: functionTimeout?.data ?? DEFAULT_FUNCTION_TIMEOUT_MS,
|
|
1638
|
+
jobs
|
|
1639
|
+
});
|
|
1640
|
+
};
|
|
1641
|
+
})))();
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region dist/kuna/KunaInstallation.js
|
|
1646
|
+
var VERSION_PROBE_TIMEOUT_MS, VERSION_PROBE_MAX_OUTPUT_BYTES, VERSION_LINE, createKunaFileCloseScope, kunaChildEnvironment, failure, message, inspectKunaInstallation, startsWithShebang;
|
|
1647
|
+
function init_KunaInstallation() {
|
|
1648
|
+
return (init_KunaInstallation = __esmMin((() => {
|
|
1649
|
+
init_RegularFile();
|
|
1650
|
+
init_result();
|
|
1651
|
+
init_AnalysisCleanupLease();
|
|
1652
|
+
init_StableFileHash();
|
|
1653
|
+
init_OwnedRegularFile();
|
|
1654
|
+
init_ExecFileOutput();
|
|
1655
|
+
init_KunaConfiguration();
|
|
1656
|
+
init_KunaRelease();
|
|
1657
|
+
VERSION_PROBE_TIMEOUT_MS = 1e4;
|
|
1658
|
+
VERSION_PROBE_MAX_OUTPUT_BYTES = 64 * 1024;
|
|
1659
|
+
VERSION_LINE = /^kuna (\d+\.\d+(?:\.\d+)?)\r?\n?$/u;
|
|
1660
|
+
createKunaFileCloseScope = (parent) => {
|
|
1661
|
+
const leases = new Map();
|
|
1662
|
+
return {
|
|
1663
|
+
owner: {
|
|
1664
|
+
retain: (owner, resource) => {
|
|
1665
|
+
const lease = AnalysisCleanupLease.forCloseOwner(owner, resource);
|
|
1666
|
+
leases.set(owner, lease);
|
|
1667
|
+
parent.retain({
|
|
1668
|
+
close: () => lease.release(),
|
|
1669
|
+
get cleanupResources() {
|
|
1670
|
+
return lease.cleanupResources ?? [resource];
|
|
1671
|
+
}
|
|
1672
|
+
}, resource);
|
|
1673
|
+
},
|
|
1674
|
+
run: (operation) => parent.run(operation)
|
|
1675
|
+
},
|
|
1676
|
+
bindFailure: (failure, error) => leases.get(failure.owner)?.bindCleanupError(error)
|
|
1677
|
+
};
|
|
1678
|
+
};
|
|
1679
|
+
kunaChildEnvironment = (configuration) => {
|
|
1680
|
+
const home = join(configuration.cacheRoot, "home");
|
|
1681
|
+
return {
|
|
1682
|
+
HOME: home,
|
|
1683
|
+
XDG_CACHE_HOME: join(home, ".cache"),
|
|
1684
|
+
NO_COLOR: "1"
|
|
1685
|
+
};
|
|
1686
|
+
};
|
|
1687
|
+
failure = (code, reason, diagnostics) => err({
|
|
1688
|
+
code,
|
|
1689
|
+
reason,
|
|
1690
|
+
diagnostics
|
|
1691
|
+
});
|
|
1692
|
+
message = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
1693
|
+
inspectKunaInstallation = async (environment, options) => {
|
|
1694
|
+
const configuration = readKunaConfiguration(environment, options.platform);
|
|
1695
|
+
if (!configuration.ok) return failure(configuration.error.code, configuration.error.reason, {
|
|
1696
|
+
configured: configuration.error.code !== "not_configured",
|
|
1697
|
+
...configuration.error.setting === null ? {} : { setting: configuration.error.setting }
|
|
1698
|
+
});
|
|
1699
|
+
const { command } = configuration.value;
|
|
1700
|
+
let executable;
|
|
1701
|
+
try {
|
|
1702
|
+
executable = await realpath(command);
|
|
1703
|
+
await access(executable, constants.X_OK);
|
|
1704
|
+
if (!(await stat(executable)).isFile()) return failure("executable_missing", `REA_KUNA_COMMAND is not a regular file: ${command}. ${KUNA_COMMAND_REMEDIATION}`, { command });
|
|
1705
|
+
} catch (cause) {
|
|
1706
|
+
assertRegularFileActive(options.signal);
|
|
1707
|
+
return failure("executable_missing", `Cannot execute REA_KUNA_COMMAND ${command}: ${message(cause)}. ${KUNA_COMMAND_REMEDIATION}`, { command });
|
|
1708
|
+
}
|
|
1709
|
+
const deadline = options.probeTimeoutMs ?? VERSION_PROBE_TIMEOUT_MS;
|
|
1710
|
+
let stdout;
|
|
1711
|
+
try {
|
|
1712
|
+
({stdout} = await execFileOutput(executable, ["--version"], {
|
|
1713
|
+
env: kunaChildEnvironment(configuration.value),
|
|
1714
|
+
timeout: deadline,
|
|
1715
|
+
maxBuffer: VERSION_PROBE_MAX_OUTPUT_BYTES,
|
|
1716
|
+
stopSignal: "SIGTERM",
|
|
1717
|
+
...options.signal === undefined ? {} : { signal: options.signal }
|
|
1718
|
+
}));
|
|
1719
|
+
} catch (cause) {
|
|
1720
|
+
assertRegularFileActive(options.signal);
|
|
1721
|
+
const output = execFileOutputFailure(cause);
|
|
1722
|
+
return failure("version_unresolved", `${executable} --version failed: ${output?.stderr.trim() || message(cause)}. ${KUNA_VERSION_PROBE_REMEDIATION}`, {
|
|
1723
|
+
command,
|
|
1724
|
+
executable,
|
|
1725
|
+
exit_code: typeof output?.code === "number" ? output.code : null,
|
|
1726
|
+
signal: output?.signal ?? null,
|
|
1727
|
+
killed: output?.killed ?? false,
|
|
1728
|
+
output_truncated: output?.outputTruncated ?? false,
|
|
1729
|
+
deadline_ms: deadline
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
const version = VERSION_LINE.exec(stdout)?.[1];
|
|
1733
|
+
if (version === undefined) return failure("version_unresolved", `${executable} --version printed no recognizable Kuna version. ${KUNA_VERSION_PROBE_REMEDIATION}`, {
|
|
1734
|
+
command,
|
|
1735
|
+
executable,
|
|
1736
|
+
stdout: stdout.slice(0, 256)
|
|
1737
|
+
});
|
|
1738
|
+
let fingerprint;
|
|
1739
|
+
let script;
|
|
1740
|
+
try {
|
|
1741
|
+
({fingerprint, script} = await options.fileCloseResources.run(async () => {
|
|
1742
|
+
const fingerprint = await hashStableFile(executable, {
|
|
1743
|
+
...options.signal === undefined ? {} : { signal: options.signal },
|
|
1744
|
+
retainFailedClose: (owner) => options.fileCloseResources.retain(owner, executable)
|
|
1745
|
+
});
|
|
1746
|
+
const script = await startsWithShebang(executable, options.fileCloseResources);
|
|
1747
|
+
assertRegularFileActive(options.signal);
|
|
1748
|
+
return {
|
|
1749
|
+
fingerprint,
|
|
1750
|
+
script
|
|
1751
|
+
};
|
|
1752
|
+
}));
|
|
1753
|
+
} catch (cause) {
|
|
1754
|
+
if (cause instanceof RegularFileCleanupFailure || regularFileCancellation(cause) !== undefined) throw cause;
|
|
1755
|
+
return failure("executable_missing", `Cannot fingerprint ${executable}: ${message(stableFileHashCause(cause))}`, {
|
|
1756
|
+
command,
|
|
1757
|
+
executable
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
return ok({
|
|
1761
|
+
configuration: configuration.value,
|
|
1762
|
+
executable,
|
|
1763
|
+
version,
|
|
1764
|
+
verified: version === KUNA_VERIFIED_VERSION,
|
|
1765
|
+
...fingerprint,
|
|
1766
|
+
script
|
|
1767
|
+
});
|
|
1768
|
+
};
|
|
1769
|
+
startsWithShebang = (path, fileCloseResources) => withOwnedRegularFile(path, {
|
|
1770
|
+
symlinks: "follow",
|
|
1771
|
+
retainFailedClose: (owner) => fileCloseResources.retain(owner, path)
|
|
1772
|
+
}, async (handle) => {
|
|
1773
|
+
const prefix = Buffer.alloc(2);
|
|
1774
|
+
const { bytesRead } = await handle.read(prefix, 0, 2, 0);
|
|
1775
|
+
return bytesRead === 2 && prefix.toString("latin1") === "#!";
|
|
1776
|
+
});
|
|
1777
|
+
})))();
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
//#endregion
|
|
1781
|
+
export { KUNA_COMMAND_REMEDIATION, KUNA_PROVIDER_ID, KUNA_UNSUPPORTED_HOST_REMEDIATION, KUNA_VERIFIED_VERSION, KUNA_VERSION_PROBE_REMEDIATION, createKunaFileCloseScope, ghidraFileFailure, ghidraInstallationDiagnostics, ghidraJavaEnvironment, idaConfigurationError, idaProtocol, init_GhidraFileArtifacts, init_GhidraInstallation, init_GhidraJavaProperties, init_GhidraReleasePolicy, init_IdaConfiguration, init_KunaConfiguration, init_KunaInstallation, init_KunaRelease, init_LinuxPrivateDisplayDiagnostic, init_LinuxPrivateDisplayProbe, inspectGhidraInstallation, inspectKunaInstallation, kunaChildEnvironment, kunaFunctionDeadline, kunaProjectDeadline, parseGhidraJavaProperties, parseLinuxPrivateDisplayDiagnostic, readGhidraProfileArtifact, readIdaConfiguration, readKunaConfiguration, selectLinuxPrivateDisplayStrategy, unverifiedGhidraBuildLimitation, writeGhidraProfileArtifact };
|