rea-agents 4.1.0 → 6.0.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 +173 -568
- package/bridge/android/ReaJadxBridge.java +247 -0
- package/bridge/mitmproxy/capture.py +210 -0
- package/bridge/native/NativeUIChildren.swift +27 -0
- package/bridge/native/ReaNativeUI.swift +30 -16
- package/bridge/native/rea_lldb_tracer.py +303 -0
- package/bridge/process/ProcessRunTokenReader.swift +263 -0
- package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
- package/bridge/pwndbg/core_context.py +101 -0
- package/bridge/pwndbg/launch.py +39 -0
- package/bridge/pwndbg/launch_impl.py +34 -0
- package/bridge/pwntools/decoder_runtime.py +59 -0
- package/bridge/pwntools/layout.py +39 -0
- package/bridge/pwntools/layout_impl.py +309 -0
- package/bridge/pwntools/recorded_crash.py +39 -0
- package/bridge/pwntools/recorded_crash_impl.py +143 -0
- package/dist/android/AndroidTargetSnapshot.js +5 -3
- package/dist/android/JadxAnalysis.js +8 -6
- package/dist/android/JadxConfiguration.js +19 -3
- package/dist/android/JadxMcpTransport.js +43 -16
- package/dist/android/JadxProtocol.js +8 -0
- package/dist/android/JadxProvider.js +118 -28
- package/dist/android/JadxRelease.js +8 -0
- package/dist/android/JadxSession.js +32 -18
- package/dist/application/AppBundleExecutable.js +141 -0
- package/dist/application/BinaryTargetResolver.js +9 -64
- package/dist/application/CapabilityInventory.js +82 -3
- package/dist/application/ClientConfigurationDocument.js +72 -12
- package/dist/application/ClientRegistrationStatus.js +7 -8
- package/dist/application/DirectAnalysis.js +109 -37
- package/dist/application/DirectAnalysisStatus.js +4 -5
- package/dist/application/DoctorDiagnostics.js +3 -3
- package/dist/application/EnhancedTools.js +4 -4
- package/dist/application/EvidenceBundleCommands.js +1 -1
- package/dist/application/EvidenceBundleFiles.js +1 -1
- package/dist/application/InvestigationProviders.js +6 -0
- package/dist/application/LinuxHopper.js +8 -2
- package/dist/application/OptionalObservationProviders.js +3 -0
- package/dist/application/ReconstructionCoverageService.js +2 -6
- package/dist/application/ReconstructionObligationCandidates.js +10 -3
- package/dist/application/ReferenceSourceImport.js +2 -0
- package/dist/application/ReferenceSourceImportEntries.js +20 -3
- package/dist/application/ReferenceSourceImportTypes.js +5 -0
- package/dist/application/Setup.js +10 -2
- package/dist/application/SetupClientConfiguration.js +19 -16
- package/dist/application/SetupHost.js +18 -3
- package/dist/application/SetupPlan.js +1 -1
- package/dist/application/Uninstall.js +23 -17
- package/dist/application/UpdateMaintenance.js +3 -3
- package/dist/application/ValidateSelectedWebScript.js +27 -0
- package/dist/application/WebModuleTraceService.js +209 -0
- package/dist/application/WebNetworkCaptureService.js +132 -0
- package/dist/application/WebRuntimeService.js +73 -0
- package/dist/application/WebScriptExportService.js +115 -0
- package/dist/application/WebSourceLocationService.js +160 -0
- package/dist/application/WindowsCapabilities.js +1 -1
- package/dist/application/{AndroidAnalysisService.js → android/AndroidAnalysisService.js} +6 -6
- package/dist/application/{AndroidApplicationService.js → android/AndroidApplicationService.js} +3 -3
- package/dist/application/{AppleApplicationService.js → apple/AppleApplicationService.js} +5 -5
- package/dist/application/{AnalysisClientCleanup.js → binary/AnalysisClientCleanup.js} +2 -2
- package/dist/application/{AnalysisProviderEvaluation.js → binary/AnalysisProviderEvaluation.js} +4 -4
- package/dist/application/{AnalysisProviderRegistry.js → binary/AnalysisProviderRegistry.js} +5 -5
- package/dist/application/{AnalysisSnapshotCache.js → binary/AnalysisSnapshotCache.js} +55 -14
- package/dist/application/{AnalysisSnapshotFiles.js → binary/AnalysisSnapshotFiles.js} +4 -4
- package/dist/application/{BinarySession.js → binary/BinarySession.js} +50 -20
- package/dist/application/{BinarySessionComposition.js → binary/BinarySessionComposition.js} +2 -1
- package/dist/application/{BinarySessionExecution.js → binary/BinarySessionExecution.js} +9 -7
- package/dist/application/{BinarySessionOpen.js → binary/BinarySessionOpen.js} +22 -9
- package/dist/application/{BinarySessionRecords.js → binary/BinarySessionRecords.js} +48 -40
- package/dist/application/{CompositeProvider.js → binary/CompositeProvider.js} +2 -2
- package/dist/application/{LazyAnalysisProvider.js → binary/LazyAnalysisProvider.js} +6 -6
- package/dist/application/{SessionProviderRouter.js → binary/SessionProviderRouter.js} +7 -7
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +57 -0
- package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +60 -0
- package/dist/application/evm/EvmInterfacePort.js +1 -0
- package/dist/application/evm/EvmInterfaceService.js +62 -0
- package/dist/application/firmware/FirmwareAnalysisPort.js +1 -0
- package/dist/application/{FirmwareAnalysisService.js → firmware/FirmwareAnalysisService.js} +5 -5
- package/dist/application/{EvidenceLedger.js → investigation/EvidenceLedger.js} +44 -7
- package/dist/application/investigation/InvestigationRecordPort.js +1 -0
- package/dist/application/investigation/InvestigationRecords.js +69 -0
- package/dist/application/{UnknownEvidence.js → investigation/UnknownEvidence.js} +1 -1
- package/dist/application/{ElectronActiveEvidence.js → javascript/ElectronActiveEvidence.js} +3 -3
- package/dist/application/javascript/ElectronActiveObservationPort.js +1 -0
- package/dist/application/{ElectronActiveObservationService.js → javascript/ElectronActiveObservationService.js} +3 -3
- package/dist/application/{ElectronBoundaryAnalysis.js → javascript/ElectronBoundaryAnalysis.js} +1 -1
- package/dist/application/{ElectronBoundaryGraphContext.js → javascript/ElectronBoundaryGraphContext.js} +1 -1
- package/dist/application/{ElectronEvidence.js → javascript/ElectronEvidence.js} +2 -2
- package/dist/application/javascript/ElectronObservationPort.js +1 -0
- package/dist/application/{ElectronObservationService.js → javascript/ElectronObservationService.js} +3 -3
- package/dist/application/{JavaScriptApplicationEvidence.js → javascript/JavaScriptApplicationEvidence.js} +3 -4
- package/dist/application/{JavaScriptApplicationEvidenceGraph.js → javascript/JavaScriptApplicationEvidenceGraph.js} +5 -5
- package/dist/application/{JavaScriptApplicationService.js → javascript/JavaScriptApplicationService.js} +25 -12
- package/dist/application/{JavaScriptApplicationWorkflowEvidence.js → javascript/JavaScriptApplicationWorkflowEvidence.js} +3 -3
- package/dist/application/{JavaScriptApplicationWorkflowService.js → javascript/JavaScriptApplicationWorkflowService.js} +12 -12
- package/dist/application/{JavaScriptArtifactAnalysis.js → javascript/JavaScriptArtifactAnalysis.js} +50 -47
- package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +1 -0
- package/dist/application/{JavaScriptArtifactGraphAccumulator.js → javascript/JavaScriptArtifactGraphAccumulator.js} +16 -2
- package/dist/application/{JavaScriptArtifactGraphBuilder.js → javascript/JavaScriptArtifactGraphBuilder.js} +2 -2
- package/dist/application/{JavaScriptArtifactGraphContext.js → javascript/JavaScriptArtifactGraphContext.js} +1 -1
- package/dist/application/{JavaScriptArtifactGraphDocuments.js → javascript/JavaScriptArtifactGraphDocuments.js} +27 -3
- package/dist/application/{JavaScriptArtifactGraphFindings.js → javascript/JavaScriptArtifactGraphFindings.js} +20 -7
- package/dist/application/{JavaScriptArtifactGraphStructure.js → javascript/JavaScriptArtifactGraphStructure.js} +1 -1
- package/dist/application/{JavaScriptArtifactPathResolution.js → javascript/JavaScriptArtifactPathResolution.js} +80 -36
- package/dist/application/{JavaScriptArtifactReconstruction.js → javascript/JavaScriptArtifactReconstruction.js} +26 -17
- package/dist/application/{JavaScriptJsonModules.js → javascript/JavaScriptJsonModules.js} +1 -1
- package/dist/application/{JavaScriptModuleRelationships.js → javascript/JavaScriptModuleRelationships.js} +2 -2
- package/dist/application/javascript/JavaScriptRecoveryPort.js +1 -0
- package/dist/application/javascript/JavaScriptRecoveryService.js +52 -0
- package/dist/application/{JavaScriptReturnShapeProjection.js → javascript/JavaScriptReturnShapeProjection.js} +3 -3
- package/dist/application/{JavaScriptRuntimeObservationEvidence.js → javascript/JavaScriptRuntimeObservationEvidence.js} +2 -2
- package/dist/application/javascript/JavaScriptRuntimeObservationPort.js +1 -0
- package/dist/application/{JavaScriptRuntimeObservationService.js → javascript/JavaScriptRuntimeObservationService.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationEvidence.js → javascript/JavaScriptRuntimeReconciliationEvidence.js} +3 -3
- package/dist/application/{JavaScriptRuntimeReconciliationService.js → javascript/JavaScriptRuntimeReconciliationService.js} +6 -6
- package/dist/application/{JavaScriptSemanticGraphAsyncProjection.js → javascript/JavaScriptSemanticGraphAsyncProjection.js} +8 -8
- package/dist/application/{JavaScriptSemanticGraphBuilder.js → javascript/JavaScriptSemanticGraphBuilder.js} +150 -73
- package/dist/application/{JavaScriptSemanticGraphChildProcessProjection.js → javascript/JavaScriptSemanticGraphChildProcessProjection.js} +15 -16
- package/dist/application/{JavaScriptSemanticGraphConstruction.js → javascript/JavaScriptSemanticGraphConstruction.js} +43 -2
- package/dist/application/{JavaScriptSemanticGraphDataProjection.js → javascript/JavaScriptSemanticGraphDataProjection.js} +8 -8
- package/dist/application/{JavaScriptSemanticGraphFingerprintProjection.js → javascript/JavaScriptSemanticGraphFingerprintProjection.js} +1 -1
- package/dist/application/{JavaScriptSemanticGraphFlowProjection.js → javascript/JavaScriptSemanticGraphFlowProjection.js} +7 -11
- package/dist/application/{JavaScriptSemanticGraphObjectProjection.js → javascript/JavaScriptSemanticGraphObjectProjection.js} +4 -4
- package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +144 -0
- package/dist/application/{JavaScriptSemanticGraphResourceProjection.js → javascript/JavaScriptSemanticGraphResourceProjection.js} +4 -4
- package/dist/application/{JavaScriptSemanticGraphValueProjection.js → javascript/JavaScriptSemanticGraphValueProjection.js} +5 -5
- package/dist/application/{JavaScriptSemanticTraceService.js → javascript/JavaScriptSemanticTraceService.js} +6 -6
- package/dist/application/{ManagedApplicationGraphService.js → managed/ManagedApplicationGraphService.js} +7 -7
- package/dist/application/{ManagedMemberComparisonService.js → managed/ManagedMemberComparisonService.js} +10 -10
- package/dist/application/{ManagedNativeVerificationService.js → managed/ManagedNativeVerificationService.js} +7 -7
- package/dist/application/{ManagedReconstructionService.js → managed/ManagedReconstructionService.js} +7 -7
- package/dist/application/{NativeApiInspection.js → native/NativeApiInspection.js} +1 -1
- package/dist/application/{NativeCallRoutes.js → native/NativeCallRoutes.js} +3 -3
- package/dist/application/{NativeDispatchMetadataInspection.js → native/NativeDispatchMetadataInspection.js} +4 -4
- package/dist/application/{NativeUiActionTrace.js → native/NativeUiActionTrace.js} +7 -7
- package/dist/application/{NativeValueTrace.js → native/NativeValueTrace.js} +6 -6
- package/dist/application/{ProcessCli.js → process/ProcessCli.js} +15 -11
- package/dist/application/{ProcessEvidence.js → process/ProcessEvidence.js} +4 -4
- package/dist/{application/ArtifactInventory/hash.js → artifacts/ArtifactHash.js} +4 -2
- package/dist/artifacts/ArtifactPaths.js +3 -3
- package/dist/artifacts/ArtifactProvider.js +37 -40
- package/dist/artifacts/ArtifactProviderMetadata.js +37 -0
- package/dist/artifacts/AsarArtifactReader.js +195 -23
- package/dist/artifacts/AsarEntryStream.js +76 -0
- package/dist/artifacts/DirectoryArtifactReader.js +41 -7
- package/dist/artifacts/NativeDmgArtifactReader.js +161 -9
- package/dist/artifacts/ZipArtifactReader.js +3 -0
- package/dist/{application → artifacts/apple}/AppleAssetCatalogAnalysis.js +4 -4
- package/dist/artifacts/apple/DylibResolutionReader.js +259 -0
- package/dist/{application → artifacts/apple}/InterfaceBuilderAnalysis.js +125 -51
- package/dist/artifacts/{KeyedArchiveReader.js → apple/KeyedArchiveReader.js} +21 -27
- package/dist/artifacts/apple/MachoLoadCommandReader.js +294 -0
- package/dist/artifacts/apple/NibViewHierarchy.js +150 -0
- package/dist/{application → artifacts/extraction}/ArtifactExtraction.js +10 -10
- package/dist/{application → artifacts/inventory}/ArtifactGraphConstruction.js +3 -3
- package/dist/{application → artifacts/inventory}/ArtifactInventory.js +4 -4
- package/dist/{application/ArtifactInventory → artifacts/inventory}/classify.js +2 -2
- package/dist/{application/ArtifactInventory → artifacts/inventory}/reader.js +5 -5
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanCanonical.js +3 -3
- package/dist/{application/ArtifactInventory → artifacts/inventory}/scanReader.js +5 -5
- package/dist/{application → artifacts/javascript}/JavaScriptArtifactFiles.js +27 -6
- package/dist/artifacts/javascript/JavaScriptArtifactReader.js +6 -0
- package/dist/artifacts/readStableArtifact.js +68 -0
- package/dist/browser/BrowserScenarioSecrets.js +50 -8
- package/dist/browser/CdpAuthorizedMainFrame.js +4 -4
- package/dist/browser/CdpAuthorizedTarget.js +22 -0
- package/dist/browser/CdpBrowserProvider.js +4 -15
- package/dist/browser/CdpCaptureDocuments.js +33 -21
- package/dist/browser/CdpCaptureEventBodyShapes.js +3 -3
- package/dist/browser/CdpCaptureEventHandlers.js +116 -28
- package/dist/browser/CdpCaptureEventHelpers.js +6 -6
- package/dist/browser/CdpCaptureEvents.js +9 -0
- package/dist/browser/CdpCaptureStorage.js +10 -8
- package/dist/browser/CdpCaptureStorageFingerprints.js +24 -22
- package/dist/browser/CdpCaptureValues.js +2 -2
- package/dist/browser/CdpCommandRejection.js +17 -0
- package/dist/browser/CdpConnection.js +51 -11
- package/dist/browser/CdpElectronInspection.js +10 -10
- package/dist/browser/CdpElectronProvider.js +3 -6
- package/dist/browser/CdpElectronScriptEvents.js +6 -6
- package/dist/browser/CdpElectronScripts.js +2 -2
- package/dist/browser/CdpElectronWorkers.js +4 -4
- package/dist/browser/CdpObservationSession.js +18 -23
- package/dist/browser/CdpPageCapture.js +4 -4
- package/dist/browser/CdpPageCaptureScripts.js +2 -2
- package/dist/browser/CdpPageCaptureWorkers.js +9 -9
- package/dist/browser/CdpSafeMetadata.js +48 -10
- package/dist/browser/CdpScreenshot.js +5 -5
- package/dist/browser/CdpTargetEvents.js +8 -0
- package/dist/browser/CdpTargetSession.js +2 -2
- package/dist/browser/CdpWebMcpDiscovery.js +22 -16
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +7 -6
- package/dist/browser/PlaywrightElectronActiveProvider.js +15 -9
- package/dist/browser/PlaywrightScenarioEvents.js +59 -51
- package/dist/browser/PlaywrightScenarioSession.js +8 -1
- package/dist/browser/WebSourceMapFetcher.js +37 -53
- package/dist/browser/assets/LocalWebScriptArtifacts.js +87 -0
- package/dist/browser/assets/PageScriptCapture.js +32 -0
- package/dist/browser/assets/PublishWebScripts.js +74 -0
- package/dist/browser/assets/ScenarioScriptCapture.js +76 -0
- package/dist/browser/assets/ScriptCaptureAdapters.js +57 -0
- package/dist/browser/assets/WebArtifactReads.js +56 -0
- package/dist/browser/assets/WebSourceLocationArtifacts.js +40 -0
- package/dist/browser/execution/CdpEventListeners.js +79 -0
- package/dist/browser/execution/CdpExecutionCapture.js +135 -0
- package/dist/browser/execution/CdpExecutionCollection.js +57 -0
- package/dist/browser/execution/CdpExecutionWindow.js +100 -0
- package/dist/browser/execution/CdpListenerSelector.js +22 -0
- package/dist/browser/execution/CdpPreciseCoverage.js +48 -0
- package/dist/browser/execution/CdpRuntimeInitiator.js +18 -0
- package/dist/browser/execution/CdpRuntimeProtocol.js +106 -0
- package/dist/browser/execution/CdpRuntimeRequests.js +81 -0
- package/dist/browser/execution/CdpRuntimeSession.js +163 -0
- package/dist/browser/execution/CdpRuntimeSources.js +223 -0
- package/dist/browser/execution/CdpWebRuntimeProvider.js +51 -0
- package/dist/browser/history/CaptureFailures.js +101 -0
- package/dist/browser/history/CaptureFormatError.js +10 -0
- package/dist/browser/history/CaptureRedaction.js +65 -0
- package/dist/browser/history/CaptureRelease.js +12 -0
- package/dist/browser/history/HarCapture.js +165 -0
- package/dist/browser/history/HarCaptureAdapter.js +20 -0
- package/dist/browser/history/HarCaptureProcess.js +57 -0
- package/dist/browser/history/HarJson.js +91 -0
- package/dist/browser/history/HarSchema.js +72 -0
- package/dist/browser/history/HistoricalCaptureDecoder.js +186 -0
- package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
- package/dist/browser/history/MitmproxyCaptureAdapter.js +42 -0
- package/dist/browser/modules/NativeModuleResolver.js +210 -0
- package/dist/browser/modules/WebModuleArtifacts.js +40 -0
- package/dist/browser/network/PlaywrightNetworkContent.js +71 -0
- package/dist/browser/network/PlaywrightScenarioNetwork.js +180 -0
- package/dist/browser/providerIdentities.js +24 -0
- package/dist/catalogIdentity.js +23 -15
- package/dist/cli/androidCommands.js +13 -3
- package/dist/cli/applicationCommands.js +39 -8
- package/dist/cli/artifactCommands.js +27 -2
- package/dist/cli/binaryDiagnosticsCommands.js +39 -0
- package/dist/cli/browserAdvancedCommands.js +27 -9
- package/dist/cli/coreAnalysisCommands.js +6 -494
- package/dist/cli/coreBinaryCommands.js +211 -0
- package/dist/cli/coreNativeCommands.js +293 -0
- package/dist/cli/electronCommands.js +29 -27
- package/dist/cli/evmCommands.js +24 -0
- package/dist/cli/firmwareCommands.js +9 -6
- package/dist/cli/javascriptApplicationAnalysis.js +17 -4
- package/dist/cli/javascriptRecoveryCommands.js +45 -0
- package/dist/cli/jsonOutput.js +133 -0
- package/dist/cli/managedCommands.js +4 -4
- package/dist/cli/managedProjectGraphCommand.js +1 -1
- package/dist/cli/nativeCallCommands.js +35 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/referenceSourceImportStatus.js +6 -1
- package/dist/cli/streamedJsonOutput.js +56 -0
- package/dist/cli/utilityCommands.js +49 -23
- package/dist/cli/webModuleCommands.js +56 -0
- package/dist/cli/webNetworkCaptureCommands.js +40 -0
- package/dist/cli/webRuntimeCommands.js +60 -0
- package/dist/cli/webScriptCommands.js +31 -0
- package/dist/cli/webSourceLocationCommands.js +42 -0
- package/dist/cli.js +19 -3
- package/dist/cliBrowserContext.js +4 -2
- package/dist/cliBrowserScenarioCommands.js +6 -5
- package/dist/cliCommandNames.js +14 -0
- package/dist/cliJavaScriptRuntimeCommands.js +6 -4
- package/dist/cliJsonInput.js +38 -2
- package/dist/cliOutput.js +52 -11
- package/dist/composition/android.js +3 -0
- package/dist/composition/auxiliaryAnalysisProviders.js +30 -0
- package/dist/composition/binary.js +25 -0
- package/dist/composition/binaryDiagnostics.js +8 -0
- package/dist/composition/browserObservation.js +3 -0
- package/dist/composition/browserScenario.js +3 -0
- package/dist/composition/directAnalysis.js +17 -0
- package/dist/composition/electronObservation.js +3 -0
- package/dist/composition/electronScenario.js +3 -0
- package/dist/composition/evm.js +4 -0
- package/dist/composition/firmware.js +3 -0
- package/dist/composition/javascriptRecovery.js +3 -0
- package/dist/composition/javascriptRuntimeObservation.js +3 -0
- package/dist/composition/optionalObservationProviders.js +49 -0
- package/dist/composition/webModules.js +5 -0
- package/dist/composition/webNetworkCaptures.js +6 -0
- package/dist/composition/webRuntime.js +4 -0
- package/dist/composition/webSourceLocations.js +5 -0
- package/dist/config/parseConfig.js +22 -3
- package/dist/contracts/{androidToolContracts.js → android/androidToolContracts.js} +5 -5
- package/dist/contracts/applicationToolContracts.js +43 -8
- package/dist/contracts/artifactToolContracts.js +8 -2
- package/dist/contracts/browserCaptureToolInputSchema.js +43 -0
- package/dist/contracts/browserScenarioToolContracts.js +1 -1
- package/dist/contracts/browserToolContracts.js +4 -3
- package/dist/contracts/enhancedInputs.js +1 -1
- package/dist/contracts/errorSchemas.js +8 -1
- package/dist/contracts/evm/evmToolContracts.js +20 -0
- package/dist/contracts/{firmwareToolContracts.js → firmware/firmwareToolContracts.js} +5 -5
- package/dist/contracts/investigationExamples.js +2 -2
- package/dist/contracts/{applicationWorkflowInputContracts.js → javascript/applicationWorkflowInputContracts.js} +6 -6
- package/dist/contracts/{electronToolContracts.js → javascript/electronToolContracts.js} +6 -6
- package/dist/contracts/{javascriptApplicationWorkflowExamples.js → javascript/javascriptApplicationWorkflowExamples.js} +3 -3
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +23 -0
- package/dist/contracts/{javascriptRuntimeObservationToolContracts.js → javascript/javascriptRuntimeObservationToolContracts.js} +3 -3
- package/dist/contracts/{javascriptRuntimeReconciliationExample.js → javascript/javascriptRuntimeReconciliationExample.js} +5 -5
- package/dist/contracts/{managedToolContracts.js → managed/managedToolContracts.js} +10 -6
- package/dist/contracts/{managedWorkflowExamples.js → managed/managedWorkflowExamples.js} +1 -1
- package/dist/contracts/{managedWorkflowToolContracts.js → managed/managedWorkflowToolContracts.js} +6 -6
- package/dist/contracts/mobileApplicationGraphExamples.js +105 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +42 -0
- package/dist/contracts/{nativeToolContracts.js → native/nativeToolContracts.js} +31 -8
- package/dist/contracts/officialToolContracts.js +15 -12
- package/dist/contracts/process/processCaptureExample.js +2 -0
- package/dist/contracts/sessionLifecycleInputs.js +22 -5
- package/dist/contracts/sessionStatusContract.js +10 -2
- package/dist/contracts/sessionToolContracts.js +9 -2
- package/dist/contracts/sessionToolSchemas.js +10 -3
- package/dist/contracts/toolContractExamples.js +1 -1
- package/dist/contracts/toolContracts.js +19 -7
- package/dist/contracts/toolEffects.js +62 -0
- package/dist/contracts/toolOutputSchemaGroups.js +23 -19
- package/dist/contracts/toolOutputSchemaPrimitives.js +1 -1
- package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
- package/dist/contracts/webRuntimeToolContracts.js +43 -0
- package/dist/contracts/webScriptToolContracts.js +68 -0
- package/dist/domain/analysisErrorBase.js +15 -0
- package/dist/domain/analysisErrorCore.js +63 -7
- package/dist/domain/analysisErrorPresentation.js +29 -1
- package/dist/domain/analysisErrorProjection.js +53 -2
- package/dist/domain/analysisSnapshot.js +166 -2
- package/dist/domain/{androidApplication.js → android/androidApplication.js} +7 -6
- package/dist/domain/apple/appleApplication.js +277 -0
- package/dist/domain/{appleAssetCatalog.js → apple/appleAssetCatalog.js} +2 -2
- package/dist/domain/apple/appleBundleAnatomy.js +236 -0
- package/dist/domain/apple/dyldPaths.js +81 -0
- package/dist/domain/apple/dylibResolution.js +367 -0
- package/dist/domain/apple/dylibResolutionFindings.js +75 -0
- package/dist/domain/{interfaceBuilderGraph.js → apple/interfaceBuilderGraph.js} +47 -314
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +411 -0
- package/dist/domain/{keyedArchive.js → apple/keyedArchive.js} +10 -9
- package/dist/domain/apple/plistValue.js +35 -0
- package/dist/domain/artifactInventoryEvidence.js +12 -2
- package/dist/domain/artifactInventorySnapshot.js +1 -0
- package/dist/domain/artifactOperationError.js +5 -1
- package/dist/domain/artifactPathSyntax.js +26 -0
- package/dist/domain/browserNetworkEvidence.js +82 -0
- package/dist/domain/browserObservation.js +1 -1
- package/dist/domain/browserObservationError.js +2 -0
- package/dist/domain/browserObservationSchemas.js +15 -1
- package/dist/domain/browserScenarioCapture.js +22 -0
- package/dist/domain/browserScenarioCaptureValues.js +25 -0
- package/dist/domain/browserScenarioDiff.js +6 -3
- package/dist/domain/browserScenarioDiffEvidence.js +35 -1
- package/dist/domain/browserScenarioValues.js +21 -3
- package/dist/domain/browserSession.js +2 -7
- package/dist/domain/bundleComparison.js +2 -1
- package/dist/domain/callPath.js +52 -44
- package/dist/domain/callPathSchemas.js +1 -1
- package/dist/domain/canonicalDigest.js +13 -1
- package/dist/domain/changedBehavior.js +3 -3
- package/dist/domain/comparisonStatus.js +11 -0
- package/dist/domain/conformanceTrustGate.js +0 -16
- package/dist/domain/evidence.js +17 -5
- package/dist/domain/evidenceBundle.js +98 -35
- package/dist/domain/evm/evmInterface.js +63 -0
- package/dist/domain/explicitSensitiveFailure.js +92 -0
- package/dist/domain/explicitSensitiveValues.js +10 -0
- package/dist/domain/{firmwareAnalysis.js → firmware/firmwareAnalysis.js} +10 -3
- package/dist/domain/functionComparisonNormalization.js +11 -13
- package/dist/domain/hopperValues.js +2 -2
- package/dist/domain/inputIssueProjection.js +17 -2
- package/dist/domain/{electronActiveObservation.js → javascript/electronActiveObservation.js} +9 -4
- package/dist/domain/{electronObservation.js → javascript/electronObservation.js} +5 -11
- package/dist/domain/{electronStaticAnalysisBrowser.js → javascript/electronStaticAnalysisBrowser.js} +4 -3
- package/dist/domain/{electronStaticAnalysisIpc.js → javascript/electronStaticAnalysisIpc.js} +2 -2
- package/dist/domain/{electronStaticAnalysisNative.js → javascript/electronStaticAnalysisNative.js} +12 -13
- package/dist/domain/javascript/electronStaticAnalysisTypes.js +1 -0
- package/dist/domain/{electronStaticAnalysisValues.js → javascript/electronStaticAnalysisValues.js} +3 -3
- package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
- package/dist/domain/{javascriptApplicationAnalysis.js → javascript/javascriptApplicationAnalysis.js} +2 -2
- package/dist/domain/{javascriptApplicationChangeGraph.js → javascript/javascriptApplicationChangeGraph.js} +1 -1
- package/dist/domain/{javascriptApplicationEvidenceSchemas.js → javascript/javascriptApplicationEvidenceSchemas.js} +6 -4
- package/dist/domain/{javascriptApplicationGraph.js → javascript/javascriptApplicationGraph.js} +2 -2
- package/dist/domain/{javascriptApplicationGraphSchemas.js → javascript/javascriptApplicationGraphSchemas.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparison.js → javascript/javascriptApplicationVersionComparison.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionComparisonSchemas.js → javascript/javascriptApplicationVersionComparisonSchemas.js} +3 -3
- package/dist/domain/{javascriptApplicationVersionItems.js → javascript/javascriptApplicationVersionItems.js} +2 -2
- package/dist/domain/{javascriptApplicationVersionKeys.js → javascript/javascriptApplicationVersionKeys.js} +16 -9
- package/dist/domain/javascript/javascriptArtifactFiles.js +1 -0
- package/dist/domain/{javascriptAstFingerprint.js → javascript/javascriptAstFingerprint.js} +38 -22
- package/dist/domain/javascript/javascriptAstValues.js +23 -0
- package/dist/domain/{javascriptExportShapeComparison.js → javascript/javascriptExportShapeComparison.js} +21 -5
- package/dist/domain/{javascriptExportShapeComparisonSchemas.js → javascript/javascriptExportShapeComparisonSchemas.js} +2 -2
- package/dist/domain/{javascriptExportShapeSelection.js → javascript/javascriptExportShapeSelection.js} +1 -1
- package/dist/domain/{javascriptExportShapeVariants.js → javascript/javascriptExportShapeVariants.js} +1 -11
- package/dist/domain/{javascriptFeatureSeed.js → javascript/javascriptFeatureSeed.js} +4 -3
- package/dist/domain/{javascriptFeatureTrace.js → javascript/javascriptFeatureTrace.js} +2 -2
- package/dist/domain/{javascriptFeatureTraceSchemas.js → javascript/javascriptFeatureTraceSchemas.js} +32 -18
- package/dist/domain/{javascriptFeatureTraversal.js → javascript/javascriptFeatureTraversal.js} +6 -2
- package/dist/domain/{javascriptNativeHandoff.js → javascript/javascriptNativeHandoff.js} +1 -1
- package/dist/domain/javascript/javascriptRecovery.js +88 -0
- package/dist/domain/{javascriptRuntimeLoadState.js → javascript/javascriptRuntimeLoadState.js} +1 -1
- package/dist/domain/{javascriptRuntimeObservation.js → javascript/javascriptRuntimeObservation.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationActive.js → javascript/javascriptRuntimeReconciliationActive.js} +3 -3
- package/dist/domain/{javascriptRuntimeReconciliationGraph.js → javascript/javascriptRuntimeReconciliationGraph.js} +1 -1
- package/dist/domain/{javascriptRuntimeReconciliationMatching.js → javascript/javascriptRuntimeReconciliationMatching.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationParsing.js → javascript/javascriptRuntimeReconciliationParsing.js} +5 -5
- package/dist/domain/{javascriptRuntimeReconciliationResult.js → javascript/javascriptRuntimeReconciliationResult.js} +2 -2
- package/dist/domain/{javascriptRuntimeReconciliationSchemas.js → javascript/javascriptRuntimeReconciliationSchemas.js} +4 -4
- package/dist/domain/{javascriptRuntimeStaticCandidates.js → javascript/javascriptRuntimeStaticCandidates.js} +1 -1
- package/dist/domain/{javascriptSemanticAnalysis.js → javascript/javascriptSemanticAnalysis.js} +40 -14
- package/dist/domain/{javascriptSemanticAsyncEffects.js → javascript/javascriptSemanticAsyncEffects.js} +2 -1
- package/dist/domain/{javascriptSemanticCallResolution.js → javascript/javascriptSemanticCallResolution.js} +10 -5
- package/dist/domain/{javascriptSemanticCalls.js → javascript/javascriptSemanticCalls.js} +7 -4
- package/dist/domain/{javascriptSemanticChildProcesses.js → javascript/javascriptSemanticChildProcesses.js} +4 -2
- package/dist/domain/{javascriptSemanticDataEffectHelpers.js → javascript/javascriptSemanticDataEffectHelpers.js} +7 -6
- package/dist/domain/{javascriptSemanticDataEffects.js → javascript/javascriptSemanticDataEffects.js} +8 -6
- package/dist/domain/{javascriptSemanticFingerprints.js → javascript/javascriptSemanticFingerprints.js} +40 -16
- package/dist/domain/{javascriptSemanticGraph.js → javascript/javascriptSemanticGraph.js} +23 -7
- package/dist/domain/{javascriptSemanticGraphSchemas.js → javascript/javascriptSemanticGraphSchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +116 -0
- package/dist/domain/javascript/javascriptSemanticMutationValues.js +53 -0
- package/dist/domain/{javascriptSemanticObjects.js → javascript/javascriptSemanticObjects.js} +5 -5
- package/dist/domain/{javascriptSemanticPrimitives.js → javascript/javascriptSemanticPrimitives.js} +1 -1
- package/dist/domain/{javascriptSemanticProjection.js → javascript/javascriptSemanticProjection.js} +31 -44
- package/dist/domain/{javascriptSemanticPromises.js → javascript/javascriptSemanticPromises.js} +77 -22
- package/dist/domain/{javascriptSemanticProvenance.js → javascript/javascriptSemanticProvenance.js} +4 -1
- package/dist/domain/{javascriptSemanticQuery.js → javascript/javascriptSemanticQuery.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryAssessment.js → javascript/javascriptSemanticQueryAssessment.js} +1 -1
- package/dist/domain/{javascriptSemanticQueryIdentity.js → javascript/javascriptSemanticQueryIdentity.js} +1 -1
- package/dist/domain/{javascriptSemanticQuerySchemas.js → javascript/javascriptSemanticQuerySchemas.js} +3 -3
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +25 -0
- package/dist/domain/{javascriptSemanticResources.js → javascript/javascriptSemanticResources.js} +2 -1
- package/dist/domain/{javascriptSemanticReturns.js → javascript/javascriptSemanticReturns.js} +1 -1
- package/dist/domain/{javascriptSemanticTraceSchemas.js → javascript/javascriptSemanticTraceSchemas.js} +2 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +55 -0
- package/dist/domain/javascript/javascriptSemanticValueTypes.js +1 -0
- package/dist/domain/{javascriptSemanticValues.js → javascript/javascriptSemanticValues.js} +72 -48
- package/dist/domain/{javascriptStaticAnalysis.js → javascript/javascriptStaticAnalysis.js} +7 -4
- package/dist/domain/{javascriptStaticAnalysisBundler.js → javascript/javascriptStaticAnalysisBundler.js} +14 -11
- package/dist/domain/{javascriptStaticAnalysisCalls.js → javascript/javascriptStaticAnalysisCalls.js} +2 -2
- package/dist/domain/{javascriptStaticAnalysisHelpers.js → javascript/javascriptStaticAnalysisHelpers.js} +231 -40
- package/dist/domain/{sourceToBundleComparison.js → javascript/sourceToBundleComparison.js} +2 -2
- package/dist/domain/{sourceToBundleComparisonSchemas.js → javascript/sourceToBundleComparisonSchemas.js} +4 -4
- package/dist/domain/{sourceToBundleSignals.js → javascript/sourceToBundleSignals.js} +2 -2
- package/dist/domain/jsonValue.js +4 -0
- package/dist/domain/localPath.js +2 -0
- package/dist/domain/{managedApplicationGraph.js → managed/managedApplicationGraph.js} +4 -4
- package/dist/domain/{managedApplicationGraphNodes.js → managed/managedApplicationGraphNodes.js} +1 -1
- package/dist/domain/{managedArtifact.js → managed/managedArtifact.js} +1 -1
- package/dist/domain/{managedMemberComparison.js → managed/managedMemberComparison.js} +4 -4
- package/dist/domain/{managedMemberComparisonCoverage.js → managed/managedMemberComparisonCoverage.js} +2 -1
- package/dist/domain/{managedMemberComparisonItems.js → managed/managedMemberComparisonItems.js} +97 -40
- package/dist/domain/{managedMemberComparisonMatch.js → managed/managedMemberComparisonMatch.js} +22 -11
- package/dist/domain/{managedNativeVerification.js → managed/managedNativeVerification.js} +1 -1
- package/dist/domain/{managedNativeVerificationMatch.js → managed/managedNativeVerificationMatch.js} +3 -3
- package/dist/domain/{managedNativeVerificationSchemas.js → managed/managedNativeVerificationSchemas.js} +6 -5
- package/dist/domain/{managedReconstruction.js → managed/managedReconstruction.js} +3 -3
- package/dist/domain/native/binaryLayout.js +357 -0
- package/dist/domain/native/nativeCallObservation.js +164 -0
- package/dist/domain/{nativeFunctionAnnotations.js → native/nativeFunctionAnnotations.js} +1 -1
- package/dist/domain/{nativeInspection.js → native/nativeInspection.js} +1 -1
- package/dist/domain/{nativeInvestigationGraph.js → native/nativeInvestigationGraph.js} +13 -4
- package/dist/domain/{nativeLoadImage.js → native/nativeLoadImage.js} +1 -1
- package/dist/domain/{nativeUiObservation.js → native/nativeUiObservation.js} +20 -6
- package/dist/domain/{objcSwiftMetadata.js → native/objcSwiftMetadata.js} +17 -39
- package/dist/domain/native/recordedCrash.js +266 -0
- package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
- package/dist/domain/process/processCapture.js +316 -0
- package/dist/domain/{processCaptureExample.js → process/processCaptureExample.js} +5 -0
- package/dist/domain/process/processCaptureParsing.js +54 -0
- package/dist/domain/{processCaptureValidation.js → process/processCaptureValidation.js} +18 -2
- package/dist/domain/{processComparison.js → process/processComparison.js} +1 -1
- package/dist/domain/{processObservation.js → process/processObservation.js} +1 -1
- package/dist/domain/{processScenario.js → process/processScenario.js} +17 -17
- package/dist/domain/{processTraceSpecification.js → process/processTraceSpecification.js} +1 -1
- package/dist/domain/propertyListKeys.js +69 -0
- package/dist/domain/providerCleanupError.js +5 -2
- package/dist/domain/providerSelectionError.js +4 -2
- package/dist/domain/reconstructionCoverageEvaluation.js +46 -24
- package/dist/domain/reconstructionCoverageInput.js +7 -0
- package/dist/domain/reconstructionVerification.js +3 -3
- package/dist/domain/reconstructionVerificationSchemas.js +1 -1
- package/dist/domain/residualUnknown.js +3 -2
- package/dist/domain/runtimeVersion.js +2 -0
- package/dist/domain/sourceMapEnvelope.js +38 -0
- package/dist/domain/staticRuntimeCorrelation.js +3 -3
- package/dist/domain/unicodeCodePointOrder.js +11 -6
- package/dist/domain/webBundleAnalyzerAst.js +2 -34
- package/dist/domain/webBundleAnalyzerInspection.js +12 -9
- package/dist/domain/webCaptureDiff.js +1 -0
- package/dist/domain/webEventListeners.js +28 -0
- package/dist/domain/webExecution.js +74 -0
- package/dist/domain/webMcpDiscovery.js +1 -7
- package/dist/domain/webModuleImports.js +104 -0
- package/dist/domain/webModuleTrace.js +106 -0
- package/dist/domain/webNetworkCapture.js +118 -0
- package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
- package/dist/domain/webRuntime.js +69 -0
- package/dist/domain/webScreenshot.js +1 -7
- package/dist/domain/webScriptArtifacts.js +39 -0
- package/dist/domain/webScriptExport.js +86 -0
- package/dist/domain/webScriptExportError.js +13 -0
- package/dist/domain/webScriptExportPlan.js +108 -0
- package/dist/domain/webSourceLocation.js +106 -0
- package/dist/domain/webSourcePosition.js +21 -0
- package/dist/dotnet/ManagedArtifactInspector.js +1 -1
- package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
- package/dist/dotnet/ManagedMemberInspector.js +5 -3
- package/dist/dotnet/ManagedMemberInspectorCore.js +72 -32
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +23 -7
- package/dist/dotnet/ManagedMemberRows.js +19 -6
- package/dist/dotnet/ManagedMetadataHeaps.js +20 -2
- package/dist/dotnet/ManagedMetadataInventory.js +38 -28
- package/dist/dotnet/ManagedMetadataInventoryRows.js +24 -10
- package/dist/dotnet/ManagedMethodBodyReader.js +7 -1
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +37 -19
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +59 -51
- package/dist/dotnet/ManagedPeReader.js +11 -0
- package/dist/dotnet/ManagedStaticProvider.js +3 -33
- package/dist/dotnet/ManagedStaticProviderMetadata.js +36 -0
- package/dist/evaluation/CodexAgentEval.js +2 -1
- package/dist/evm/EvmBytecodeCarrier.js +21 -0
- package/dist/evm/EvmWorkerLimits.js +40 -0
- package/dist/evm/EvmoleFailures.js +126 -0
- package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
- package/dist/evm/EvmoleInterfaceProvider.js +273 -0
- package/dist/evm/EvmoleInterfaceWorker.js +87 -0
- package/dist/evm/EvmoleRelease.js +16 -0
- package/dist/firmware/FirmwareCommand.js +1 -0
- package/dist/firmware/FirmwareProvider.js +18 -12
- package/dist/firmware/FirmwarePublication.js +1 -1
- package/dist/firmware/FirmwareRelease.js +1 -1
- package/dist/firmware/FirmwareReports.js +12 -0
- package/dist/firmware/FirmwareVersion.js +80 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraFunctionValues.js +5 -5
- package/dist/ghidra/GhidraInstallation.js +38 -34
- package/dist/ghidra/GhidraInstallationPolicy.js +140 -0
- package/dist/ghidra/GhidraInventoryValues.js +1 -1
- package/dist/ghidra/GhidraLauncher.js +13 -4
- package/dist/ghidra/GhidraLoadImageAttest.js +36 -0
- package/dist/ghidra/GhidraLoadImageValues.js +1 -1
- package/dist/ghidra/GhidraProvider.js +17 -235
- package/dist/ghidra/GhidraProviderCapabilities.js +8 -15
- package/dist/ghidra/GhidraProviderClient.js +209 -0
- package/dist/ghidra/GhidraResponseBuffer.js +7 -1
- package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +17 -1
- package/dist/hopper/BridgeLauncher.js +2 -0
- package/dist/hopper/HopperProvider.js +2 -48
- package/dist/hopper/HopperProviderCapabilities.js +73 -0
- package/dist/hopper/HopperResponseStream.js +7 -1
- package/dist/hopper/LinuxPrivateDisplayProbe.js +8 -6
- package/dist/ida/IdaProviderCapabilities.js +3 -11
- package/dist/ida/IdaSessionClient.js +12 -0
- package/dist/{browser → inspector}/JavaScriptRuntimeScope.js +16 -5
- package/dist/{browser → inspector}/V8InspectorCaptureProjection.js +46 -8
- package/dist/{browser → inspector}/V8InspectorEndpoint.js +1 -1
- package/dist/{browser → inspector}/V8InspectorProvider.js +10 -13
- package/dist/inspector/providerIdentity.js +6 -0
- package/dist/javascript/recovery/RecoveryFiles.js +122 -0
- package/dist/javascript/recovery/WakaruCommand.js +119 -0
- package/dist/javascript/recovery/WakaruExecution.js +100 -0
- package/dist/javascript/recovery/WakaruProvider.js +96 -0
- package/dist/javascript/recovery/WakaruPublication.js +102 -0
- package/dist/javascript/recovery/WakaruRelease.js +29 -0
- package/dist/javascript/recovery/WakaruReport.js +134 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProcess.js +37 -0
- package/dist/javascript/sourceMaps/SourceMapCodecProtocol.js +20 -0
- package/dist/javascript/sourceMaps/SourceMapCommand.js +177 -0
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +61 -0
- package/dist/javascript/sourceMaps/SourceMapFormat.js +185 -0
- package/dist/javascript/sourceMaps/TraceSourceMap.js +138 -0
- package/dist/main/shutdown.js +8 -2
- package/dist/main/transport.js +24 -7
- package/dist/main.js +4 -18
- package/dist/native/AppleDispatchCoverage.js +58 -0
- package/dist/native/AppleDispatchMetadata.js +71 -509
- package/dist/native/AppleMachoFixups.js +292 -0
- package/dist/native/AppleMachoSelection.js +188 -0
- package/dist/native/AppleObjcCategories.js +59 -0
- package/dist/native/AppleObjcDispatchFacets.js +257 -0
- package/dist/native/AppleObjcProperties.js +68 -0
- package/dist/native/AppleObjcProtocols.js +2 -1
- package/dist/native/AppleSwiftDispatchFacets.js +150 -0
- package/dist/native/CommandRunner.js +2 -1
- package/dist/native/LldbCallTracer.js +278 -0
- package/dist/native/NativeCallObservation.js +135 -0
- package/dist/native/NativeMacOSProvider.js +151 -75
- package/dist/native/NativeMacOSProviderMetadata.js +47 -0
- package/dist/native/NativeMachoInspection.js +45 -14
- package/dist/native/NativeUiHelperRuntime.js +7 -3
- package/dist/native/NativeUiObservation.js +8 -4
- package/dist/native/NativeUiOutputBudget.js +8 -0
- package/dist/native/parsers/codesign.js +40 -5
- package/dist/native/parsers/demangle.js +6 -2
- package/dist/native/parsers/dyldInfo.js +13 -4
- package/dist/native/parsers/echoedPath.js +14 -0
- package/dist/native/parsers/lipo.js +14 -0
- package/dist/native/parsers/otool.js +1 -1
- package/dist/native/parsers/plist.js +174 -19
- package/dist/native/pwndbg/PwndbgCoreContext.js +160 -0
- package/dist/native/pwntools/PwntoolsDecoder.js +203 -0
- package/dist/native/pwntools/PwntoolsFailures.js +180 -0
- package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
- package/dist/native/pwntools/PwntoolsRelease.js +19 -0
- package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +101 -0
- package/dist/process/DarwinProcessRunTokenReader.js +294 -0
- package/dist/process/ExecFileOutput.js +2 -0
- package/dist/process/OwnedCommand.js +113 -0
- package/dist/process/ProcessOwnership.js +263 -33
- package/dist/process/ProcessOwnershipObservation.js +161 -24
- package/dist/process/ProviderProcess.js +68 -20
- package/dist/{application → process/capture}/FilesystemSnapshot.js +20 -5
- package/dist/{application → process/capture}/ProcessCaptureCapability.js +16 -1
- package/dist/{application → process/capture}/ProcessCaptureError.js +17 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +615 -0
- package/dist/process/capture/ProcessHarness.js +452 -0
- package/dist/{application → process/capture}/ProcessSampling.js +2 -2
- package/dist/reference/ReferenceSourceReaderEntries.js +6 -1
- package/dist/server/createServer.js +70 -6
- package/dist/server/mcpClientMetadata.js +6 -3
- package/dist/server/promptCompletion.js +10 -3
- package/dist/server/registerAndroidTools.js +1 -1
- package/dist/server/registerApplicationTools/compareExportShapes.js +2 -2
- package/dist/server/registerApplicationTools/compareSourceToBundle.js +2 -2
- package/dist/server/registerApplicationTools/compareVersions.js +2 -2
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +43 -0
- package/dist/server/registerApplicationTools/traceFeature.js +1 -1
- package/dist/server/registerApplicationTools/traceSemantics.js +1 -1
- package/dist/server/registerApplicationTools.js +2 -0
- package/dist/server/registerBinaryDiagnosticsTools.js +17 -0
- package/dist/server/registerBrowserScenarioTool.js +6 -2
- package/dist/server/registerBrowserTools.js +13 -2
- package/dist/server/registerCloseLifecycleTool.js +1 -1
- package/dist/server/registerElectronTools.js +21 -7
- package/dist/server/registerEvidenceTools.js +1 -1
- package/dist/server/registerEvmTools.js +17 -0
- package/dist/server/registerJavaScriptRecoveryTool.js +17 -0
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +9 -4
- package/dist/server/registerManagedTools.js +3 -3
- package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +2 -2
- package/dist/server/registerManagedWorkflowTools/contract.js +1 -1
- package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +1 -1
- package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +1 -1
- package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +2 -2
- package/dist/server/registerNativeTools.js +1 -1
- package/dist/server/registerProcessComparisonTool.js +1 -1
- package/dist/server/registerPrompts.js +5 -1
- package/dist/server/registerRecordedCrashTools.js +17 -0
- package/dist/server/registerSessionTools.js +3 -3
- package/dist/server/registerWebModuleTool.js +17 -0
- package/dist/server/registerWebNetworkCaptureTool.js +28 -0
- package/dist/server/registerWebRuntimeTools.js +31 -0
- package/dist/server/registerWebScriptTool.js +18 -0
- package/dist/server/registerWebSourceLocationTool.js +17 -0
- package/dist/server/sessionAvailabilityPolicy.js +27 -12
- package/dist/server/sessionToolPolicies.js +1 -1
- package/dist/server/toolResult.js +1 -1
- package/dist/windows/WindowsOwnedProcess.js +3 -1
- package/install.sh +12 -2
- package/native/windows/README.md +5 -0
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +75 -26
- package/scripts/hopper-demo-x11.py +67 -8
- package/scripts/rea.mjs +19 -3
- package/skills/reverse-engineer-anything/SKILL.md +23 -3
- package/skills/reverse-engineer-anything/references/android-applications.md +2 -2
- package/skills/reverse-engineer-anything/references/javascript-applications.md +1 -1
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +61 -23
- package/third_party/README.md +60 -0
- package/third_party/evmole/LICENSE +21 -0
- package/third_party/evmole/README.md +22 -0
- package/third_party/pwndbg/LICENSE.md +21 -0
- package/third_party/pwndbg/README.md +23 -0
- package/third_party/pwntools/README.md +40 -0
- package/dist/application/AuthorizedArtifactInventory.js +0 -7
- package/dist/application/JavaScriptSemanticGraphProjection.js +0 -38
- package/dist/application/ProcessCaptureLifecycle.js +0 -299
- package/dist/application/ProcessHarness.js +0 -275
- package/dist/application/StoreFileLock.js +0 -124
- package/dist/application/runtime.js +0 -53
- package/dist/contracts/processCaptureExample.js +0 -2
- package/dist/domain/appleApplication.js +0 -181
- package/dist/domain/bytecodeProvider.js +0 -178
- package/dist/domain/customProtocolCapture.js +0 -137
- package/dist/domain/eventProcessTree.js +0 -225
- package/dist/domain/javascriptAstValues.js +0 -13
- package/dist/domain/javascriptSemanticTraversal.js +0 -30
- package/dist/domain/mobileApplicationInvestigation.js +0 -159
- package/dist/domain/packageAnalysis.js +0 -123
- package/dist/domain/peInspection.js +0 -197
- package/dist/domain/processCapture.js +0 -177
- package/dist/domain/processCaptureParsing.js +0 -21
- package/dist/domain/protocolCapture.js +0 -217
- package/dist/domain/runtimeIdentification.js +0 -212
- package/dist/generatedMcpToolCatalog.js +0 -37
- package/dist/native/NativeHostCapabilities.js +0 -23
- /package/dist/application/{AndroidAnalysisPort.js → DirectAnalysisDependencies.js} +0 -0
- /package/dist/application/{BinarySessionPort.js → WebModulePorts.js} +0 -0
- /package/dist/application/{ElectronActiveObservationPort.js → WebNetworkCapturePort.js} +0 -0
- /package/dist/application/{ElectronObservationPort.js → WebRuntimePort.js} +0 -0
- /package/dist/application/{FirmwareAnalysisPort.js → WebScriptArtifactPort.js} +0 -0
- /package/dist/application/{JavaScriptArtifactAnalysisTypes.js → WebSourceLocationPorts.js} +0 -0
- /package/dist/application/{JavaScriptRuntimeObservationPort.js → android/AndroidAnalysisPort.js} +0 -0
- /package/dist/application/{ArtifactExtractionDestination.js → artifacts/ArtifactExtractionDestination.js} +0 -0
- /package/dist/application/{AbortablePromise.js → binary/AbortablePromise.js} +0 -0
- /package/dist/{domain/electronStaticAnalysisTypes.js → application/binary/BinarySessionPort.js} +0 -0
- /package/dist/application/{BinarySessionStatus.js → binary/BinarySessionStatus.js} +0 -0
- /package/dist/{domain/javascriptSemanticValueTypes.js → application/binaryDiagnostics/BinaryLayoutPort.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraph.js → javascript/ElectronBoundaryGraph.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphIpc.js → javascript/ElectronBoundaryGraphIpc.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphNative.js → javascript/ElectronBoundaryGraphNative.js} +0 -0
- /package/dist/application/{ElectronBoundaryGraphWindows.js → javascript/ElectronBoundaryGraphWindows.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphBundlers.js → javascript/JavaScriptArtifactGraphBundlers.js} +0 -0
- /package/dist/application/{JavaScriptArtifactGraphEvidence.js → javascript/JavaScriptArtifactGraphEvidence.js} +0 -0
- /package/dist/application/{JavaScriptArtifactReconstructionInput.js → javascript/JavaScriptArtifactReconstructionInput.js} +0 -0
- /package/dist/application/{JavaScriptSemanticGraphEvidence.js → javascript/JavaScriptSemanticGraphEvidence.js} +0 -0
- /package/dist/artifacts/{NibArchive.js → apple/NibArchive.js} +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/policy.js +0 -0
- /package/dist/{application/ArtifactInventory → artifacts/inventory}/types.js +0 -0
- /package/dist/domain/{androidAnalysis.js → android/androidAnalysis.js} +0 -0
- /package/dist/domain/{electronStaticAnalysis.js → javascript/electronStaticAnalysis.js} +0 -0
- /package/dist/domain/{javascriptExportShapeComparisonIdentity.js → javascript/javascriptExportShapeComparisonIdentity.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliation.js → javascript/javascriptRuntimeReconciliation.js} +0 -0
- /package/dist/domain/{javascriptRuntimeReconciliationRuntime.js → javascript/javascriptRuntimeReconciliationRuntime.js} +0 -0
- /package/dist/domain/{javascriptSemanticCoverage.js → javascript/javascriptSemanticCoverage.js} +0 -0
- /package/dist/domain/{javascriptSemanticDerivedAnalysis.js → javascript/javascriptSemanticDerivedAnalysis.js} +0 -0
- /package/dist/domain/{javascriptSemanticGraphSerialization.js → javascript/javascriptSemanticGraphSerialization.js} +0 -0
- /package/dist/domain/{javascriptSemanticIr.js → javascript/javascriptSemanticIr.js} +0 -0
- /package/dist/domain/{javascriptSemanticQueryRelations.js → javascript/javascriptSemanticQueryRelations.js} +0 -0
- /package/dist/domain/{javascriptSemanticState.js → javascript/javascriptSemanticState.js} +0 -0
- /package/dist/domain/{javascriptSourceParser.js → javascript/javascriptSourceParser.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisFindings.js → javascript/javascriptStaticAnalysisFindings.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisState.js → javascript/javascriptStaticAnalysisState.js} +0 -0
- /package/dist/domain/{javascriptStaticAnalysisTypes.js → javascript/javascriptStaticAnalysisTypes.js} +0 -0
- /package/dist/domain/{managedApplicationGraphCoverage.js → managed/managedApplicationGraphCoverage.js} +0 -0
- /package/dist/domain/{managedApplicationGraphNodeCoverage.js → managed/managedApplicationGraphNodeCoverage.js} +0 -0
- /package/dist/domain/{nativeApiBoundary.js → native/nativeApiBoundary.js} +0 -0
- /package/dist/domain/{nativeDataType.js → native/nativeDataType.js} +0 -0
- /package/dist/domain/{nativeInstruction.js → native/nativeInstruction.js} +0 -0
- /package/dist/domain/{nativeMetadataRecovery.js → native/nativeMetadataRecovery.js} +0 -0
- /package/dist/domain/{nativeValueFlow.js → native/nativeValueFlow.js} +0 -0
- /package/dist/domain/{nativeValueTrace.js → native/nativeValueTrace.js} +0 -0
- /package/dist/domain/{processEvidenceProvider.js → process/processEvidenceProvider.js} +0 -0
- /package/dist/domain/{processTraceComparison.js → process/processTraceComparison.js} +0 -0
- /package/dist/domain/{processTraceDimensionProjection.js → process/processTraceDimensionProjection.js} +0 -0
- /package/dist/domain/{processTraceEvaluation.js → process/processTraceEvaluation.js} +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureEnvironment.js +0 -0
- /package/dist/{application → process/capture}/ProcessCaptureJournal.js +0 -0
- /package/dist/{application → process/capture}/ProcessFilesystemEffects.js +0 -0
- /package/dist/{application → process/capture}/ProcessNormalization.js +0 -0
- /package/dist/{application → process/capture}/ProcessScenarioRuntimeValidation.js +0 -0
- /package/dist/{application → process/capture}/ProcessTimer.js +0 -0
- /package/dist/{application → process/capture}/TerminalRenderer.js +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import com.atxx.jhmcp.*;
|
|
2
|
+
import com.google.gson.*;
|
|
3
|
+
import io.modelcontextprotocol.kotlin.sdk.server.*;
|
|
4
|
+
import io.modelcontextprotocol.kotlin.sdk.types.*;
|
|
5
|
+
import jadx.api.*;
|
|
6
|
+
import jadx.core.dex.nodes.*;
|
|
7
|
+
import java.io.PrintStream;
|
|
8
|
+
import java.util.*;
|
|
9
|
+
import java.util.concurrent.CountDownLatch;
|
|
10
|
+
import java.util.stream.Collectors;
|
|
11
|
+
import kotlin.Unit;
|
|
12
|
+
import kotlin.coroutines.EmptyCoroutineContext;
|
|
13
|
+
import kotlinx.coroutines.BuildersKt;
|
|
14
|
+
import kotlinx.io.CoreKt;
|
|
15
|
+
import kotlinx.io.JvmCoreKt;
|
|
16
|
+
import kotlinx.serialization.json.JsonObject;
|
|
17
|
+
|
|
18
|
+
/** REA-owned metadata boundary for the unmodified jadx-headless-mcp 0.7.1 JAR. */
|
|
19
|
+
class ReaJadxBridge {
|
|
20
|
+
private static final Gson JSON = new Gson();
|
|
21
|
+
private final SessionHolder holder;
|
|
22
|
+
private JadxSession indexedSession;
|
|
23
|
+
private Map<String, List<ClassSnapshot>> classes = Map.of();
|
|
24
|
+
|
|
25
|
+
private record MethodSnapshot(String name, String shortId, Map<String, Object> summary) {}
|
|
26
|
+
private record ClassSnapshot(JavaClass node, List<MethodSnapshot> methods, Map<String, Object> summary) {}
|
|
27
|
+
|
|
28
|
+
private ReaJadxBridge(SessionHolder holder) { this.holder = holder; }
|
|
29
|
+
|
|
30
|
+
private static CallToolResult text(String value, boolean failed) {
|
|
31
|
+
return new CallToolResult(List.of(new TextContent(value, null, null)), failed, null, null);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private static CallToolResult json(Object value) { return text(JSON.toJson(value), false); }
|
|
35
|
+
|
|
36
|
+
private static String string(JsonObject args, String name) {
|
|
37
|
+
JsonElement value = JsonParser.parseString(args.toString()).getAsJsonObject().get(name);
|
|
38
|
+
if (value == null || !value.isJsonPrimitive() || !value.getAsJsonPrimitive().isString())
|
|
39
|
+
throw new IllegalArgumentException(name + " must be a string");
|
|
40
|
+
return value.getAsString();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private static int integer(JsonObject args, String name, int fallback) {
|
|
44
|
+
JsonElement value = JsonParser.parseString(args.toString()).getAsJsonObject().get(name);
|
|
45
|
+
if (value == null) return fallback;
|
|
46
|
+
if (!value.isJsonPrimitive() || !value.getAsJsonPrimitive().isNumber())
|
|
47
|
+
throw new IllegalArgumentException(name + " must be a nonnegative integer");
|
|
48
|
+
try {
|
|
49
|
+
int result = value.getAsBigDecimal().intValueExact();
|
|
50
|
+
if (result < 0) throw new ArithmeticException();
|
|
51
|
+
return result;
|
|
52
|
+
} catch (ArithmeticException error) {
|
|
53
|
+
throw new IllegalArgumentException(name + " must be a nonnegative integer", error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private JadxSession session() {
|
|
58
|
+
JadxSession current = holder.current();
|
|
59
|
+
if (current == null) throw new IllegalArgumentException("No APK loaded");
|
|
60
|
+
return current;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private ClassSnapshot selected(JsonObject args) {
|
|
64
|
+
JadxSession current = session();
|
|
65
|
+
if (indexedSession != current) {
|
|
66
|
+
Map<String, List<ClassSnapshot>> index = new LinkedHashMap<>();
|
|
67
|
+
if (!current.getClasses().isEmpty()) {
|
|
68
|
+
JadxDecompiler decompiler = current.getClasses().get(0).getClassNode().root().getDecompiler();
|
|
69
|
+
// JavaClass.getMethods/getFields/getInnerClasses all load code. Raw nodes do not.
|
|
70
|
+
// Snapshot every identity before code generation can rewrite aliases or members.
|
|
71
|
+
for (JavaClass cls : decompiler.getClassesWithInners()) {
|
|
72
|
+
ClassNode node = cls.getClassNode();
|
|
73
|
+
List<MethodNode> ordered = new ArrayList<>(node.getMethods());
|
|
74
|
+
ordered.sort(Comparator.comparing(MethodNode::getAlias));
|
|
75
|
+
List<MethodSnapshot> methods = ordered.stream().map(method -> {
|
|
76
|
+
String name = method.getAlias();
|
|
77
|
+
String signature = name + "(" + method.getArgTypes().stream()
|
|
78
|
+
.map(Object::toString).collect(Collectors.joining(", "))
|
|
79
|
+
+ "): " + method.getReturnType().toString();
|
|
80
|
+
return new MethodSnapshot(name, method.getMethodInfo().getShortId(), Map.of(
|
|
81
|
+
"name", name, "signature", signature,
|
|
82
|
+
"is_constructor", method.isConstructor(), "def_pos", 0));
|
|
83
|
+
}).toList();
|
|
84
|
+
List<Map<String, Object>> fields = node.getFields().stream()
|
|
85
|
+
.sorted(Comparator.comparing(FieldNode::getAlias))
|
|
86
|
+
.map(field -> Map.<String, Object>of("name", field.getAlias(),
|
|
87
|
+
"type", field.getType().toString(), "def_pos", 0)).toList();
|
|
88
|
+
List<String> inner = node.getInnerClasses().stream().map(ClassNode::getFullName).toList();
|
|
89
|
+
Map<String, Object> summary = Map.of(
|
|
90
|
+
"full_name", cls.getFullName(), "name", cls.getName(),
|
|
91
|
+
"method_count", methods.size(), "field_count", fields.size(),
|
|
92
|
+
"inner_class_count", inner.size(), "inner_classes", inner,
|
|
93
|
+
"methods", methods.stream().map(MethodSnapshot::summary).toList(), "fields", fields);
|
|
94
|
+
index.computeIfAbsent(cls.getFullName(), ignored -> new ArrayList<>())
|
|
95
|
+
.add(new ClassSnapshot(cls, methods, summary));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
classes = Collections.unmodifiableMap(index);
|
|
99
|
+
indexedSession = current;
|
|
100
|
+
}
|
|
101
|
+
String name = string(args, "class_name");
|
|
102
|
+
List<ClassSnapshot> candidates = classes.get(name);
|
|
103
|
+
if (candidates == null) throw new IllegalArgumentException("Exact class not found: " + name);
|
|
104
|
+
if (candidates.size() != 1) throw new IllegalArgumentException("Ambiguous metadata class identity: " + name
|
|
105
|
+
+ "; raw identities: " + candidates.stream().map(candidate -> candidate.node().getRawName()).toList());
|
|
106
|
+
return candidates.get(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private List<MethodSnapshot> methods(ClassSnapshot cls, JsonObject args) {
|
|
110
|
+
String name = string(args, "method_name");
|
|
111
|
+
List<MethodSnapshot> result = cls.methods().stream().filter(method -> method.name().equals(name)).toList();
|
|
112
|
+
if (result.isEmpty()) throw new IllegalArgumentException("Method not found: " + name);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private JavaMethod method(ClassSnapshot cls, MethodSnapshot selected) {
|
|
117
|
+
JavaMethod result = cls.node().searchMethodByShortId(selected.shortId());
|
|
118
|
+
if (result == null) throw new IllegalArgumentException("Method identity no longer available: " + selected.shortId());
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private CallToolResult handle(String name, JsonObject args) {
|
|
123
|
+
if (name.equals("rea_jvm_status")) return json(Map.of(
|
|
124
|
+
"engine_reported_version", BuildInfo.VERSION,
|
|
125
|
+
"max_heap_bytes", Runtime.getRuntime().maxMemory(),
|
|
126
|
+
"available_processors", Runtime.getRuntime().availableProcessors(),
|
|
127
|
+
"java_version", System.getProperty("java.version"),
|
|
128
|
+
"metadata_scope", "parsed_members"));
|
|
129
|
+
JadxSession current = session();
|
|
130
|
+
if (name.equals("list_classes")) {
|
|
131
|
+
List<String> names = current.getClassFqns();
|
|
132
|
+
int offset = integer(args, "offset", 0);
|
|
133
|
+
int limit = integer(args, "limit", 200);
|
|
134
|
+
int start = Math.min(offset, names.size());
|
|
135
|
+
int end = (int) Math.min((long) start + limit, names.size());
|
|
136
|
+
return json(Map.of("total", names.size(), "offset", offset, "limit", limit,
|
|
137
|
+
"items", names.subList(start, end)));
|
|
138
|
+
}
|
|
139
|
+
ClassSnapshot cls = selected(args);
|
|
140
|
+
if (name.equals("get_class_summary")) return json(cls.summary());
|
|
141
|
+
if (name.equals("get_method_body")) {
|
|
142
|
+
List<MethodSnapshot> overloads = methods(cls, args);
|
|
143
|
+
int index = integer(args, "overload_index", 0);
|
|
144
|
+
if (index >= overloads.size()) throw new IllegalArgumentException("overload_index out of range: " + index);
|
|
145
|
+
JavaMethod method = method(cls, overloads.get(index));
|
|
146
|
+
JadxSession.SmartCode code = current.getMethodBodySmart(method, current.getMaxSourceBytes(), true);
|
|
147
|
+
return json(Map.of("class_name", cls.summary().get("full_name"),
|
|
148
|
+
"method_name", overloads.get(index).name(), "full_name", method.getFullName(),
|
|
149
|
+
"overload_index", index, "overload_count", overloads.size(),
|
|
150
|
+
"mode", code.getKind(), "fell_back", code.getFellBack(),
|
|
151
|
+
"markers", code.getMarkers(), "body", code.getText()));
|
|
152
|
+
}
|
|
153
|
+
List<JavaNode> uses;
|
|
154
|
+
String target = string(args, "class_name");
|
|
155
|
+
if (name.equals("get_xrefs_to_class")) uses = cls.node().getUseIn();
|
|
156
|
+
else {
|
|
157
|
+
List<MethodSnapshot> overloads = methods(cls, args);
|
|
158
|
+
if (overloads.size() != 1) throw new IllegalArgumentException("Method references require a unique overload");
|
|
159
|
+
target += "." + overloads.get(0).name();
|
|
160
|
+
uses = method(cls, overloads.get(0)).getUseIn();
|
|
161
|
+
}
|
|
162
|
+
// REA consumes all references without materializing source line information.
|
|
163
|
+
List<Map<String, Object>> items = uses.stream().map(node -> current.describeUsage(node, false)).toList();
|
|
164
|
+
return json(Map.of("target", target, "total", uses.size(), "count", items.size(),
|
|
165
|
+
"resolve_line", false, "items", items));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public static void main(String[] args) throws Exception {
|
|
169
|
+
PrintStream protocolOut = System.out;
|
|
170
|
+
System.setOut(System.err);
|
|
171
|
+
SessionHolder holder = new SessionHolder(new SessionConfig(
|
|
172
|
+
1048576, 0, 90000L, 1, List.of(), List.of(), 64, ResourceMode.FULL));
|
|
173
|
+
ServerCapabilities capabilities = new ServerCapabilities(
|
|
174
|
+
new ServerCapabilities.Tools(null), null, null, null, null, null, null, Map.of());
|
|
175
|
+
Server server = new Server(new Implementation("rea-jadx-bridge", "1", null, null, null),
|
|
176
|
+
new ServerOptions(capabilities), "", ignored -> Unit.INSTANCE);
|
|
177
|
+
SessionToolsKt.registerSessionTools(server, holder);
|
|
178
|
+
ManifestToolsKt.registerManifestTools(server, holder);
|
|
179
|
+
ClassToolsKt.registerClassTools(server, holder);
|
|
180
|
+
MethodToolsKt.registerMethodTools(server, holder);
|
|
181
|
+
XrefToolsKt.registerXrefTools(server, holder);
|
|
182
|
+
ReaJadxBridge bridge = new ReaJadxBridge(holder);
|
|
183
|
+
Set<String> consumed = Set.of("load_apk", "get_app_info", "get_android_manifest",
|
|
184
|
+
"list_classes", "get_class_summary", "get_method_body",
|
|
185
|
+
"get_xrefs_to_class", "get_xrefs_to_method");
|
|
186
|
+
for (String name : new ArrayList<>(server.getTools().keySet()))
|
|
187
|
+
if (!consumed.contains(name)) server.removeTool(name);
|
|
188
|
+
Tool diagnostics = new Tool("rea_jvm_status",
|
|
189
|
+
new ToolSchema(null, new JsonObject(Map.of()), List.of(), null),
|
|
190
|
+
"Observed worker JVM and metadata scope", null, null, null, null, null, null);
|
|
191
|
+
server.addTool(diagnostics, (connection, request, continuation) -> bridge.handle("rea_jvm_status", request.getArguments()));
|
|
192
|
+
for (String name : List.of("list_classes", "get_class_summary",
|
|
193
|
+
"get_method_body", "get_xrefs_to_class", "get_xrefs_to_method")) {
|
|
194
|
+
Tool tool = server.getTools().get(name).getTool();
|
|
195
|
+
server.removeTool(name);
|
|
196
|
+
List<String> fields = switch (name) {
|
|
197
|
+
case "list_classes" -> List.of("offset", "limit");
|
|
198
|
+
case "get_method_body" -> List.of("class_name", "method_name", "overload_index");
|
|
199
|
+
case "get_xrefs_to_method" -> List.of("class_name", "method_name");
|
|
200
|
+
default -> List.of("class_name");
|
|
201
|
+
};
|
|
202
|
+
Map<String, kotlinx.serialization.json.JsonElement> properties = new LinkedHashMap<>();
|
|
203
|
+
for (String field : fields) properties.put(field, tool.getInputSchema().getProperties().get(field));
|
|
204
|
+
String description = switch (name) {
|
|
205
|
+
case "list_classes" -> "Indexed pages of all top-level class names, with offset and limit.";
|
|
206
|
+
case "get_class_summary" -> "Parsed member metadata for one exact class name; no source generation.";
|
|
207
|
+
case "get_method_body" -> "Source for an exact class and stable same-name overload index, with smali fallback.";
|
|
208
|
+
default -> "Complete static references to an exact class or unique method; source lines are unresolved.";
|
|
209
|
+
};
|
|
210
|
+
Tool narrowed = new Tool(name, new ToolSchema(null, new JsonObject(properties),
|
|
211
|
+
tool.getInputSchema().getRequired(), null), description, null, null, null, null, null, null);
|
|
212
|
+
server.addTool(narrowed, (connection, request, continuation) -> {
|
|
213
|
+
try { return bridge.handle(name, request.getArguments()); }
|
|
214
|
+
catch (IllegalArgumentException error) { return text(error.getMessage(), true); }
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
CountDownLatch done = new CountDownLatch(1);
|
|
218
|
+
server.onClose(() -> { done.countDown(); return Unit.INSTANCE; });
|
|
219
|
+
StdioServerTransport transport = new StdioServerTransport(
|
|
220
|
+
CoreKt.buffered(JvmCoreKt.asSource(System.in)),
|
|
221
|
+
CoreKt.buffered(JvmCoreKt.asSink(protocolOut)));
|
|
222
|
+
transport.onClose(() -> { done.countDown(); return Unit.INSTANCE; });
|
|
223
|
+
ServerSession connection = null;
|
|
224
|
+
try {
|
|
225
|
+
connection = BuildersKt.runBlocking(EmptyCoroutineContext.INSTANCE,
|
|
226
|
+
(scope, continuation) -> server.createSession(transport, continuation));
|
|
227
|
+
done.await();
|
|
228
|
+
} finally {
|
|
229
|
+
try {
|
|
230
|
+
if (connection != null) {
|
|
231
|
+
ServerSession connected = connection;
|
|
232
|
+
// Unsubscribe the connection before the SDK joins its notification service.
|
|
233
|
+
BuildersKt.runBlocking(EmptyCoroutineContext.INSTANCE,
|
|
234
|
+
(scope, continuation) -> connected.close(continuation));
|
|
235
|
+
}
|
|
236
|
+
} finally {
|
|
237
|
+
try {
|
|
238
|
+
BuildersKt.runBlocking(EmptyCoroutineContext.INSTANCE,
|
|
239
|
+
(scope, continuation) -> server.close(continuation));
|
|
240
|
+
} finally {
|
|
241
|
+
BuildersKt.runBlocking(EmptyCoroutineContext.INSTANCE,
|
|
242
|
+
(scope, continuation) -> holder.unload(continuation));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"""REA offline adapter using mitmproxy's unchanged native tnetstring decoder.
|
|
2
|
+
|
|
3
|
+
No FlowReader migrations, HAR conversion, proxy listener, or target requests.
|
|
4
|
+
The containing mitmdump process and its configuration directory are REA-owned.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import base64
|
|
8
|
+
import hashlib
|
|
9
|
+
import json
|
|
10
|
+
import math
|
|
11
|
+
import re
|
|
12
|
+
import resource
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from mitmproxy import ctx, version
|
|
16
|
+
from mitmproxy.io import tnetstring
|
|
17
|
+
|
|
18
|
+
PROFILE = "12.2.3"
|
|
19
|
+
OUTPUT_BYTES = 96 * 1024 * 1024
|
|
20
|
+
CREDENTIALS = {b"authorization", b"proxy-authorization", b"cookie", b"set-cookie"}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CaptureFailure(Exception):
|
|
24
|
+
def __init__(self, reason, message, pointer=""):
|
|
25
|
+
self.reason, self.pointer = reason, pointer
|
|
26
|
+
super().__init__(message)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def pointer(parent, key):
|
|
30
|
+
return parent + "/" + str(key).replace("~", "~0").replace("/", "~1")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BoundedReader:
|
|
34
|
+
"""Refuse malicious declared lengths before the upstream parser allocates."""
|
|
35
|
+
def __init__(self, handle, size):
|
|
36
|
+
self.handle, self.size = handle, size
|
|
37
|
+
|
|
38
|
+
def read(self, count):
|
|
39
|
+
if count < 0 or count > self.size - self.handle.tell():
|
|
40
|
+
raise CaptureFailure("format", "Native record declares bytes beyond the retained capture.")
|
|
41
|
+
return self.handle.read(count)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def project_record(state, secrets):
|
|
45
|
+
binaries, numbers, redactions = [], [], []
|
|
46
|
+
byte_secrets = []
|
|
47
|
+
for secret in secrets:
|
|
48
|
+
try:
|
|
49
|
+
byte_secrets.append(secret.encode("utf-8", errors="strict"))
|
|
50
|
+
except UnicodeEncodeError:
|
|
51
|
+
# Non-scalar JSON strings have no UTF-8 byte representation.
|
|
52
|
+
# Keep them in secrets for the ordinary string projection.
|
|
53
|
+
pass
|
|
54
|
+
|
|
55
|
+
def redact(text, path, original):
|
|
56
|
+
if any(secret in text or secret in original for secret in secrets):
|
|
57
|
+
redactions.append({"pointer": path, "reason": "explicit-sensitive-value"})
|
|
58
|
+
return None
|
|
59
|
+
return text
|
|
60
|
+
|
|
61
|
+
def transport_value(value, path, transport_url):
|
|
62
|
+
if not (transport_url or re.fullmatch(r"/(?:backup/)*request/(?:path|authority)", path)):
|
|
63
|
+
return value, False
|
|
64
|
+
binary = isinstance(value, bytes)
|
|
65
|
+
pattern = rb"^([\x00-\x20]*(?:[a-z][a-z0-9+.-]*:)?//)[^/?#]*@" if binary else r"^([\x00-\x20]*(?:[a-z][a-z0-9+.-]*:)?//)[^/?#]*@"
|
|
66
|
+
replacement = rb"\1" if binary else r"\1"
|
|
67
|
+
separator = b"@" if binary else "@"
|
|
68
|
+
safe_url = re.sub(pattern, replacement, value, flags=re.I)
|
|
69
|
+
if path.endswith("/authority") and separator in safe_url:
|
|
70
|
+
safe_url = safe_url.rsplit(separator, 1)[1]
|
|
71
|
+
changed = safe_url != value
|
|
72
|
+
if changed:
|
|
73
|
+
redactions.append({"pointer": path, "reason": "transport-credential"})
|
|
74
|
+
return safe_url, changed
|
|
75
|
+
|
|
76
|
+
def validate_omitted(value, path, depth):
|
|
77
|
+
before = len(binaries), len(numbers), len(redactions)
|
|
78
|
+
visit(value, path, depth)
|
|
79
|
+
del binaries[before[0]:]
|
|
80
|
+
del numbers[before[1]:]
|
|
81
|
+
del redactions[before[2]:]
|
|
82
|
+
|
|
83
|
+
def visit(value, path, depth=0, credential=False, transport_url=False):
|
|
84
|
+
if depth > 64:
|
|
85
|
+
raise CaptureFailure("input-limit", "Native capture exceeds the 64-level evidence nesting budget.", path)
|
|
86
|
+
if credential:
|
|
87
|
+
validate_omitted(value, path, depth)
|
|
88
|
+
redactions.append({"pointer": path, "reason": "transport-credential"})
|
|
89
|
+
if isinstance(value, bytes):
|
|
90
|
+
binaries.append({"pointer": path, "representation": "producer-bytes", "state": "redacted", "content_base64": None, "bytes": None, "sha256": None})
|
|
91
|
+
return None
|
|
92
|
+
if isinstance(value, bytes):
|
|
93
|
+
safe_bytes, credential_url = transport_value(value, path, transport_url)
|
|
94
|
+
content_base64 = base64.b64encode(value).decode("ascii")
|
|
95
|
+
digest = hashlib.sha256(value).hexdigest()
|
|
96
|
+
hidden = any(secret in value or secret in safe_bytes for secret in byte_secrets) or any(secret in content_base64 or secret in digest for secret in secrets)
|
|
97
|
+
safe_text = None
|
|
98
|
+
try:
|
|
99
|
+
safe_text = safe_bytes.decode("utf-8", errors="strict")
|
|
100
|
+
except UnicodeDecodeError:
|
|
101
|
+
pass
|
|
102
|
+
if hidden:
|
|
103
|
+
redactions.append({"pointer": path, "reason": "explicit-sensitive-value"})
|
|
104
|
+
exclude = hidden or credential_url
|
|
105
|
+
binaries.append({"pointer": path, "representation": "producer-bytes", "state": "redacted" if exclude else "retained", "content_base64": None if exclude else content_base64, "bytes": None if exclude else len(value), "sha256": None if exclude else digest})
|
|
106
|
+
if hidden:
|
|
107
|
+
return None
|
|
108
|
+
return safe_text
|
|
109
|
+
if isinstance(value, str):
|
|
110
|
+
safe_text, _ = transport_value(value, path, transport_url)
|
|
111
|
+
return redact(safe_text, path, value)
|
|
112
|
+
if isinstance(value, bool) or value is None:
|
|
113
|
+
return value
|
|
114
|
+
if isinstance(value, (int, float)):
|
|
115
|
+
literal = repr(value)
|
|
116
|
+
if any(secret in literal for secret in secrets):
|
|
117
|
+
redactions.append({"pointer": path, "reason": "explicit-sensitive-value"})
|
|
118
|
+
return None
|
|
119
|
+
numbers.append({"pointer": path, "producer_type": "integer" if isinstance(value, int) else "float", "literal": literal})
|
|
120
|
+
return value if (abs(value) <= 9007199254740991 if isinstance(value, int) else math.isfinite(value)) else None
|
|
121
|
+
if isinstance(value, (list, tuple)):
|
|
122
|
+
fields = re.fullmatch(r"/(?:backup/)*(?:request|response)/(?:headers|trailers)", path)
|
|
123
|
+
if fields:
|
|
124
|
+
result = []
|
|
125
|
+
for index, field in enumerate(value):
|
|
126
|
+
if not isinstance(field, (list, tuple)) or len(field) != 2 or not isinstance(field[0], bytes):
|
|
127
|
+
raise CaptureFailure("format", "Native header/trailer is not an ordered byte pair.", pointer(path, index))
|
|
128
|
+
result.append([visit(field[0], pointer(pointer(path, index), 0), depth + 2), visit(field[1], pointer(pointer(path, index), 1), depth + 2, field[0].lower() in CREDENTIALS, field[0].lower() in {b"location", b"referer", b"origin"})])
|
|
129
|
+
return result
|
|
130
|
+
return [visit(item, pointer(path, index), depth + 1) for index, item in enumerate(value)]
|
|
131
|
+
if isinstance(value, dict):
|
|
132
|
+
result = {}
|
|
133
|
+
for key, item in value.items():
|
|
134
|
+
if not isinstance(key, str):
|
|
135
|
+
raise CaptureFailure("format", "Native record has a non-string dictionary key.", path)
|
|
136
|
+
if key == "__proto__":
|
|
137
|
+
raise CaptureFailure("unsupported", "Native object contains a __proto__ member that the current JSON schema boundary cannot preserve.", path)
|
|
138
|
+
if any(secret in key for secret in secrets):
|
|
139
|
+
# Validate the omitted subtree too, then discard all of its
|
|
140
|
+
# coordinates rather than inventing a replacement identity.
|
|
141
|
+
validate_omitted(item, pointer(path, key), depth + 1)
|
|
142
|
+
redactions.append({"pointer": path, "reason": "explicit-sensitive-value", "scope": "property-name"})
|
|
143
|
+
continue
|
|
144
|
+
result[key] = visit(item, pointer(path, key), depth + 1)
|
|
145
|
+
return result
|
|
146
|
+
raise CaptureFailure("decoder", "Native parser returned an unexpected value type: " + type(value).__name__ + ".", path)
|
|
147
|
+
|
|
148
|
+
return {"reported": visit(state, ""), "binary_fields": binaries, "numeric_literals": numbers, "redactions": redactions}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def decode(request):
|
|
152
|
+
if version.VERSION != PROFILE:
|
|
153
|
+
raise CaptureFailure("unsupported", "Expected mitmproxy " + PROFILE + "; observed " + version.VERSION + ".")
|
|
154
|
+
records = []
|
|
155
|
+
capture = Path(request["snapshot_path"])
|
|
156
|
+
size = capture.stat().st_size
|
|
157
|
+
with capture.open("rb") as handle:
|
|
158
|
+
reader = BoundedReader(handle, size)
|
|
159
|
+
while handle.tell() < size:
|
|
160
|
+
start = handle.tell()
|
|
161
|
+
try:
|
|
162
|
+
state = tnetstring.load(reader)
|
|
163
|
+
except CaptureFailure:
|
|
164
|
+
raise
|
|
165
|
+
except RecursionError:
|
|
166
|
+
raise CaptureFailure("input-limit", "Native parser exceeded its recursion budget at byte offset " + str(start) + ".") from None
|
|
167
|
+
except (ValueError, IndexError, UnicodeError, EOFError):
|
|
168
|
+
raise CaptureFailure("format", "Malformed native record at byte offset " + str(start) + ".") from None
|
|
169
|
+
if not isinstance(state, dict):
|
|
170
|
+
raise CaptureFailure("format", "Native flow record must be a dictionary at byte offset " + str(start) + ".")
|
|
171
|
+
records.append({"ordinal": len(records), "location": {"kind": "byte-range", "offset": start, "bytes": handle.tell() - start}, **project_record(state, request["sensitive_values"]), "limitations": ["Fields are original native states without FlowReader migration. Binary fields contain exact producer bytes; reported UTF-8 strings for those fields are derived display views. Unknown flow/version extensions are retained without interpretation."]})
|
|
172
|
+
return {"decoder": {"id": "mitmproxy-native-tnetstring", "name": "REA offline native mitmproxy adapter", "version": PROFILE}, "container": {"reported": None, "numeric_literals": [], "redactions": [], "records_pointer": None}, "total_records": len(records), "records": records}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def failure_reply(error):
|
|
176
|
+
"""Keep producer constraints, resource exhaustion and adapter defects distinct."""
|
|
177
|
+
if isinstance(error, CaptureFailure):
|
|
178
|
+
return {"ok": False, "reason": error.reason, "message": str(error), "pointer": error.pointer}
|
|
179
|
+
if isinstance(error, MemoryError):
|
|
180
|
+
return {"ok": False, "reason": "resource-limit", "message": "Native decoder exhausted its 768 MiB address-space budget.", "pointer": ""}
|
|
181
|
+
return {"ok": False, "reason": "decoder", "message": "Offline native decoder failed unexpectedly: " + type(error).__name__ + ".", "pointer": ""}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class OfflineCapture:
|
|
185
|
+
def load(self, loader):
|
|
186
|
+
loader.add_option("rea_request_path", str, "", "REA private offline capture request")
|
|
187
|
+
|
|
188
|
+
def running(self):
|
|
189
|
+
resource.setrlimit(resource.RLIMIT_AS, (768 * 1024 * 1024, 768 * 1024 * 1024))
|
|
190
|
+
resource.setrlimit(resource.RLIMIT_CPU, (30, 30))
|
|
191
|
+
resource.setrlimit(resource.RLIMIT_FSIZE, (OUTPUT_BYTES, OUTPUT_BYTES))
|
|
192
|
+
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
|
|
193
|
+
request = json.loads(Path(ctx.options.rea_request_path).read_text(encoding="utf-8"))
|
|
194
|
+
try:
|
|
195
|
+
response = {"ok": True, "value": decode(request)}
|
|
196
|
+
except Exception as error:
|
|
197
|
+
response = failure_reply(error)
|
|
198
|
+
try:
|
|
199
|
+
try:
|
|
200
|
+
output = json.dumps(response, ensure_ascii=True, allow_nan=False, separators=(",", ":")).encode("ascii")
|
|
201
|
+
except Exception as error:
|
|
202
|
+
output = json.dumps(failure_reply(error), separators=(",", ":")).encode("ascii")
|
|
203
|
+
if len(output) > OUTPUT_BYTES:
|
|
204
|
+
output = b'{"ok":false,"reason":"limit","message":"Native reply exceeds the complete-evidence output budget.","pointer":""}'
|
|
205
|
+
Path(request["reply_path"]).write_bytes(output)
|
|
206
|
+
finally:
|
|
207
|
+
ctx.master.shutdown()
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
addons = [OfflineCapture()]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
struct ChildBatch<Element> {
|
|
4
|
+
let values: [Element]
|
|
5
|
+
let complete: Bool
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
struct ChildCount {
|
|
9
|
+
let value: Int?
|
|
10
|
+
let error: Int32?
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
func serializeHelperOutput(_ value: Any) throws -> Data {
|
|
14
|
+
try JSONSerialization.data(withJSONObject: value, options: [.sortedKeys, .withoutEscapingSlashes])
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func captureChildCount(status: Int32, success: Int32, value: Int) -> ChildCount {
|
|
18
|
+
guard status == success else { return ChildCount(value: nil, error: status) }
|
|
19
|
+
return ChildCount(value: value, error: nil)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func captureChildValues<Element>(requestedCount: Int, copy: () -> [Element]?) -> ChildBatch<Element> {
|
|
23
|
+
guard requestedCount > 0 else { return ChildBatch(values: [], complete: true) }
|
|
24
|
+
let returned = copy() ?? []
|
|
25
|
+
let values = Array(returned.prefix(requestedCount))
|
|
26
|
+
return ChildBatch(values: values, complete: values.count == requestedCount)
|
|
27
|
+
}
|
|
@@ -22,15 +22,17 @@ func attribute(_ element: AXUIElement, _ key: String) -> CFTypeRef? {
|
|
|
22
22
|
var value: CFTypeRef?
|
|
23
23
|
return AXUIElementCopyAttributeValue(element, key as CFString, &value) == .success ? value : nil
|
|
24
24
|
}
|
|
25
|
-
func childCount(_ element: AXUIElement) ->
|
|
25
|
+
func childCount(_ element: AXUIElement) -> ChildCount {
|
|
26
26
|
var count = 0
|
|
27
|
-
|
|
27
|
+
let status = AXUIElementGetAttributeValueCount(element, kAXChildrenAttribute as CFString, &count)
|
|
28
|
+
return captureChildCount(status: status.rawValue, success: AXError.success.rawValue, value: count)
|
|
28
29
|
}
|
|
29
|
-
func children(_ element: AXUIElement,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
func children(_ element: AXUIElement, count: Int) -> ChildBatch<AXUIElement> {
|
|
31
|
+
captureChildValues(requestedCount: count) {
|
|
32
|
+
var value: CFArray?
|
|
33
|
+
guard AXUIElementCopyAttributeValues(element, kAXChildrenAttribute as CFString, 0, count, &value) == .success else { return nil }
|
|
34
|
+
return value as? [AXUIElement]
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
func text(_ element: AXUIElement, _ key: String) -> Any { (attribute(element, key) as? String) ?? NSNull() as Any }
|
|
36
38
|
func windowBounds(_ element: AXUIElement) -> CGRect? {
|
|
@@ -87,7 +89,11 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
87
89
|
var element = root
|
|
88
90
|
for index in action.path ?? [] {
|
|
89
91
|
var selectedChild: CFArray?
|
|
90
|
-
|
|
92
|
+
let count = childCount(element)
|
|
93
|
+
guard let available = count.value else {
|
|
94
|
+
try fail("element-count-unavailable", "Cannot validate selected accessibility path because child count failed with AXError \(count.error ?? -1)")
|
|
95
|
+
}
|
|
96
|
+
guard index >= 0 && index < available,
|
|
91
97
|
AXUIElementCopyAttributeValues(element, kAXChildrenAttribute as CFString, index, 1, &selectedChild) == .success,
|
|
92
98
|
let item = (selectedChild as? [AXUIElement])?.first else { try fail("element-missing", "Selected accessibility path no longer exists") }
|
|
93
99
|
element = item
|
|
@@ -103,21 +109,29 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
103
109
|
}
|
|
104
110
|
guard outcome == .success else { try fail("action-failed", "Accessibility action failed with AXError \(outcome.rawValue)") }
|
|
105
111
|
}
|
|
106
|
-
var nodes: [[String: Any]] = []; var truncated = false
|
|
112
|
+
var nodes: [[String: Any]] = []; var truncated = false; var gaps: [String] = []
|
|
107
113
|
if request.accessibility, let root = selected {
|
|
108
114
|
var pending: [(AXUIElement, [Int])] = [(root, [])]
|
|
109
115
|
while let (element, path) = pending.popLast() {
|
|
110
116
|
if nodes.count >= request.max_nodes { truncated = true; break }
|
|
111
|
-
let
|
|
117
|
+
let childCountResult = childCount(element)
|
|
112
118
|
var actions: CFArray?
|
|
113
119
|
AXUIElementCopyActionNames(element, &actions)
|
|
114
|
-
nodes.append(["path": path, "role": text(element, kAXRoleAttribute), "title": text(element, kAXTitleAttribute), "value": text(element, kAXValueAttribute), "actions": actions as? [String] ?? [], "children_count":
|
|
120
|
+
nodes.append(["path": path, "role": text(element, kAXRoleAttribute), "title": text(element, kAXTitleAttribute), "value": text(element, kAXValueAttribute), "actions": actions as? [String] ?? [], "children_count": childCountResult.value.map { $0 as Any } ?? NSNull()])
|
|
121
|
+
guard let totalChildren = childCountResult.value else {
|
|
122
|
+
truncated = true
|
|
123
|
+
gaps.append("AX child count unavailable at path \(path): AXError \(childCountResult.error ?? -1)")
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
115
126
|
if path.count >= 32 { if totalChildren > 0 { truncated = true }; continue }
|
|
116
127
|
let available = max(0, request.max_nodes - nodes.count - pending.count)
|
|
117
128
|
let count = min(available, totalChildren)
|
|
118
|
-
let
|
|
129
|
+
let batch = children(element, count: count)
|
|
130
|
+
if !batch.complete { truncated = true }
|
|
119
131
|
if totalChildren > count { truncated = true }
|
|
120
|
-
for index in (
|
|
132
|
+
for (index, item) in batch.values.enumerated().reversed() {
|
|
133
|
+
pending.append((item, path + [index]))
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
136
|
}
|
|
123
137
|
var screenshot: Any = NSNull()
|
|
@@ -139,18 +153,18 @@ func observe(_ request: Request) async throws -> [String: Any] {
|
|
|
139
153
|
}
|
|
140
154
|
screenshot = ["mime_type": "image/png", "base64": png.base64EncodedString(), "sha256": SHA256.hash(data: png).map({ String(format: "%02x", $0) }).joined(), "width": image.width, "height": image.height]
|
|
141
155
|
}
|
|
142
|
-
return ["window": ["pid": request.pid, "window_id": request.window_id, "executable": request.executable, "launch_time": launch, "title": window[kCGWindowName as String] as? String ?? ""], "nodes": nodes, "truncated": truncated, "screenshot": screenshot, "gaps": request.accessibility ?
|
|
156
|
+
return ["window": ["pid": request.pid, "window_id": request.window_id, "executable": request.executable, "launch_time": launch, "title": window[kCGWindowName as String] as? String ?? ""], "nodes": nodes, "truncated": truncated, "screenshot": screenshot, "gaps": request.accessibility ? gaps : ["Accessibility capture was disabled"]]
|
|
143
157
|
}
|
|
144
158
|
Task { @MainActor in
|
|
145
159
|
do {
|
|
146
160
|
let request = try JSONDecoder().decode(Request.self, from: Data(CommandLine.arguments[1].utf8))
|
|
147
161
|
let result = try await observe(request)
|
|
148
|
-
let output = try
|
|
162
|
+
let output = try serializeHelperOutput(["ok": true, "result": result])
|
|
149
163
|
FileHandle.standardOutput.write(output)
|
|
150
164
|
} catch {
|
|
151
165
|
let failure = error as? BoundaryFailure
|
|
152
166
|
let output: [String: Any] = ["ok": false, "code": failure?.code ?? "capture-failed", "message": failure?.message ?? error.localizedDescription]
|
|
153
|
-
if let data = try?
|
|
167
|
+
if let data = try? serializeHelperOutput(output) { FileHandle.standardOutput.write(data) }
|
|
154
168
|
}
|
|
155
169
|
exit(0)
|
|
156
170
|
}
|