@eyeauras/insight-cli 0.8.4 → 0.9.1
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/.cli-package-build.json +1 -1
- package/README.md +16 -23
- package/SKILL.md +6 -44
- package/dist/src/activity-audit.d.ts +33 -46
- package/dist/src/activity-audit.js +120 -195
- package/dist/src/analysis-default.d.ts +10 -2
- package/dist/src/analysis-default.js +62 -47
- package/dist/src/analysis-storage.d.ts +13 -13
- package/dist/src/analysis-storage.js +127 -258
- package/dist/src/artifacts.d.ts +5 -1
- package/dist/src/artifacts.js +31 -46
- package/dist/src/audit-commands.d.ts +6 -1
- package/dist/src/audit-commands.js +9 -2
- package/dist/src/audit-retention.d.ts +5 -23
- package/dist/src/audit-retention.js +37 -150
- package/dist/src/binary.js +4 -13
- package/dist/src/budgets.d.ts +2 -2
- package/dist/src/budgets.js +7 -9
- package/dist/src/capture.js +17 -30
- package/dist/src/cli.d.ts +9 -4
- package/dist/src/cli.js +288 -473
- package/dist/src/code-references.d.ts +2 -13
- package/dist/src/code-references.js +7 -99
- package/dist/src/context-diagnostics.d.ts +1 -23
- package/dist/src/context-diagnostics.js +1 -83
- package/dist/src/core/coordinator.d.ts +298 -0
- package/dist/src/core/coordinator.js +591 -0
- package/dist/src/core/layout.d.ts +51 -0
- package/dist/src/core/layout.js +55 -0
- package/dist/src/core/legacy-import.d.ts +55 -0
- package/dist/src/core/legacy-import.js +193 -0
- package/dist/src/cross-results.d.ts +3 -3
- package/dist/src/cross-results.js +4 -42
- package/dist/src/cross.js +2 -3
- package/dist/src/debugger-results.d.ts +1 -6
- package/dist/src/debugger-results.js +21 -153
- package/dist/src/debugger.d.ts +21 -11
- package/dist/src/debugger.js +106 -168
- package/dist/src/decode-results.d.ts +2 -1
- package/dist/src/decode-results.js +4 -20
- package/dist/src/diagnostic-error.d.ts +1 -1
- package/dist/src/diagnostic-error.js +4 -23
- package/dist/src/die.js +1 -23
- package/dist/src/dnspy-runtime.js +5 -12
- package/dist/src/dnspy.js +13 -28
- package/dist/src/dotnet-diagnostics.js +1 -1
- package/dist/src/extensions.d.ts +2 -3
- package/dist/src/extensions.js +14 -91
- package/dist/src/frida-worker.js +0 -20
- package/dist/src/frida.js +3 -26
- package/dist/src/function-boundaries.d.ts +2 -2
- package/dist/src/function-boundaries.js +9 -61
- package/dist/src/function-entries.d.ts +2 -2
- package/dist/src/function-entries.js +6 -36
- package/dist/src/function-inspection.d.ts +2 -2
- package/dist/src/function-inspection.js +17 -33
- package/dist/src/function-results.d.ts +1 -3
- package/dist/src/function-results.js +2 -13
- package/dist/src/hub/admin.d.ts +101 -0
- package/dist/src/hub/admin.js +314 -0
- package/dist/src/hub/autostart.d.ts +111 -0
- package/dist/src/hub/autostart.js +207 -0
- package/dist/src/hub/bundle.d.ts +33 -0
- package/dist/src/hub/bundle.js +25 -0
- package/dist/src/hub/client.d.ts +90 -0
- package/dist/src/hub/client.js +256 -0
- package/dist/src/hub/commands.d.ts +13 -0
- package/dist/src/hub/commands.js +280 -0
- package/dist/src/hub/contract.d.ts +87 -0
- package/dist/src/hub/contract.js +3 -0
- package/dist/src/hub/extensions.d.ts +41 -0
- package/dist/src/hub/extensions.js +3 -0
- package/dist/src/hub/ghidra.d.ts +70 -0
- package/dist/src/hub/ghidra.js +197 -0
- package/dist/src/hub/index.d.ts +6 -0
- package/dist/src/hub/index.js +7 -0
- package/dist/src/{work/store.d.ts → hub/ledger-store.d.ts} +57 -94
- package/dist/src/hub/ledger-store.js +919 -0
- package/dist/src/hub/ledger.d.ts +4 -0
- package/dist/src/hub/ledger.js +173 -0
- package/dist/src/hub/lock.d.ts +7 -0
- package/dist/src/hub/lock.js +53 -0
- package/dist/src/hub/repository.d.ts +45 -0
- package/dist/src/hub/repository.js +130 -0
- package/dist/src/hub/server.d.ts +86 -0
- package/dist/src/hub/server.js +414 -0
- package/dist/src/hub/settings.d.ts +36 -0
- package/dist/src/hub/settings.js +112 -0
- package/dist/src/hub/storage.d.ts +13 -0
- package/dist/src/hub/storage.js +46 -0
- package/dist/src/hub/store.d.ts +75 -0
- package/dist/src/hub/store.js +188 -0
- package/dist/src/ilspy.js +1 -1
- package/dist/src/internal-timing.d.ts +2 -9
- package/dist/src/internal-timing.js +2 -95
- package/dist/src/lldb.js +3 -15
- package/dist/src/llvm.js +0 -9
- package/dist/src/managed-heap.js +3 -7
- package/dist/src/managed-metadata.js +2 -5
- package/dist/src/memory-inputs.d.ts +1 -4
- package/dist/src/memory-inputs.js +10 -40
- package/dist/src/mitmproxy.d.ts +35 -4
- package/dist/src/mitmproxy.js +59 -40
- package/dist/src/model.d.ts +0 -73
- package/dist/src/model.js +0 -45
- package/dist/src/mutations.d.ts +1 -1
- package/dist/src/mutations.js +5 -10
- package/dist/src/native/contract.d.ts +130 -0
- package/dist/src/native/ghidra.d.ts +58 -0
- package/dist/src/native/ghidra.js +77 -0
- package/dist/src/native/host.d.ts +71 -0
- package/dist/src/native/host.js +265 -0
- package/dist/src/native/index.d.ts +13 -0
- package/dist/src/native/index.js +19 -0
- package/dist/src/native/jvm.d.ts +54 -0
- package/dist/src/native/jvm.js +47 -0
- package/dist/src/native/worker.d.ts +70 -0
- package/dist/src/native/worker.js +240 -0
- package/dist/src/native-inputs.d.ts +9 -14
- package/dist/src/native-inputs.js +22 -110
- package/dist/src/native-merge-patches.d.ts +2 -2
- package/dist/src/native-merge-patches.js +14 -14
- package/dist/src/persistent-client.js +53 -25
- package/dist/src/procmon.js +17 -31
- package/dist/src/program-files.d.ts +42 -0
- package/dist/src/program-files.js +148 -0
- package/dist/src/queries.js +2 -15
- package/dist/src/query-policy.d.ts +0 -2
- package/dist/src/query-policy.js +1 -14
- package/dist/src/research.d.ts +59 -238
- package/dist/src/research.js +212 -906
- package/dist/src/runtime-identity.d.ts +8 -0
- package/dist/src/runtime-identity.js +26 -0
- package/dist/src/runtime-manager.d.ts +1 -11
- package/dist/src/runtime-manager.js +10 -145
- package/dist/src/runtime-selection.d.ts +1 -1
- package/dist/src/runtime-selection.js +5 -37
- package/dist/src/saved-materials.js +8 -51
- package/dist/src/scripts.d.ts +1 -1
- package/dist/src/scripts.js +15 -15
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk.js +8 -8
- package/dist/src/sevenzip.js +1 -3
- package/dist/src/strace.js +0 -3
- package/dist/src/string-anchors.d.ts +2 -3
- package/dist/src/string-anchors.js +8 -101
- package/dist/src/text-window.d.ts +5 -4
- package/dist/src/text-window.js +4 -4
- package/dist/src/tool-runtime/archives.d.ts +1 -1
- package/dist/src/tool-runtime/archives.js +11 -20
- package/dist/src/tool-runtime/catalog.js +2 -5
- package/dist/src/tool-runtime/commands.js +1 -3
- package/dist/src/tool-runtime/deadline.js +2 -7
- package/dist/src/tool-runtime/definition.js +1 -31
- package/dist/src/tool-runtime/identity.js +6 -87
- package/dist/src/tool-runtime/installer.d.ts +2 -6
- package/dist/src/tool-runtime/installer.js +14 -76
- package/dist/src/tool-runtime/java-arguments.js +4 -10
- package/dist/src/tool-runtime/launch-worker.js +2 -8
- package/dist/src/tool-runtime/run.d.ts +2 -0
- package/dist/src/tool-runtime/run.js +20 -8
- package/dist/src/tool-runtime/store.d.ts +3 -3
- package/dist/src/tool-runtime/store.js +21 -83
- package/dist/src/tool-runtime/supervisor.d.ts +6 -11
- package/dist/src/tool-runtime/supervisor.js +155 -214
- package/dist/src/tool-runtime/windows-helper.d.ts +5 -0
- package/dist/src/tool-runtime/windows-helper.js +13 -0
- package/dist/src/tool-runtime/windows-job.d.ts +5 -5
- package/dist/src/tool-runtime/windows-job.js +13 -31
- package/dist/src/tshark.js +14 -27
- package/dist/src/ui-results.d.ts +3 -2
- package/dist/src/ui-results.js +16 -53
- package/dist/src/ui.d.ts +12 -13
- package/dist/src/ui.js +32 -70
- package/dist/src/version-tracking.d.ts +25 -39
- package/dist/src/version-tracking.js +70 -174
- package/dist/src/windbg.d.ts +1 -1
- package/dist/src/windbg.js +2 -8
- package/dist/src/work/client.d.ts +63 -0
- package/dist/src/work/client.js +163 -0
- package/dist/src/work/commands.d.ts +3 -1
- package/dist/src/work/commands.js +158 -184
- package/dist/src/work/dashboard.d.ts +2 -2
- package/dist/src/work/dashboard.js +7 -8
- package/dist/src/work/legacy.d.ts +8 -0
- package/dist/src/work/legacy.js +70 -0
- package/dist/src/work/model.d.ts +0 -3
- package/dist/src/work/model.js +0 -10
- package/dist/src/work/timing.d.ts +3 -3
- package/dist/src/work/timing.js +21 -25
- package/dist/src/workspace.d.ts +4 -250
- package/dist/src/workspace.js +11 -699
- package/node_modules/@eyeauras/cli-factory/README.md +6 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.js +76 -28
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.js +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/command.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.js +18 -6
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts +44 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/{profile-file.js → file-publication.js} +41 -113
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts +5 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.js +17 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts +9 -4
- package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/index.js +5 -2
- package/node_modules/@eyeauras/cli-factory/dist/src/index.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js +11 -18
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts +10 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js +69 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts +3 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output.js +74 -14
- package/node_modules/@eyeauras/cli-factory/dist/src/output.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts +3 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js +9 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js +3 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts +16 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js +83 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts +5 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts +49 -7
- package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/view.js +83 -6
- package/node_modules/@eyeauras/cli-factory/dist/src/view.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/package.json +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/cli-host.proto +19 -19
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts +7 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js +9 -4
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js +5 -4
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts +11 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js +85 -57
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/package.json +2 -2
- package/package.json +4 -5
- package/references/native/InsightAnalyzerOptions.java +10 -0
- package/references/native/InsightAnchorScan.java +1 -11
- package/references/native/InsightCodeReferences.java +2 -3
- package/references/native/InsightCopyType.java +24 -0
- package/references/native/InsightFunctionBoundaries.java +0 -1
- package/references/native/InsightFunctionDatabases.java +20 -16
- package/references/native/InsightHelperCall.java +17 -0
- package/references/native/InsightHubServer.java +214 -0
- package/references/native/InsightNativeHost.java +112 -0
- package/references/native/InsightPlugins.java +0 -1
- package/references/native/InsightPythonWheels.java +3 -2
- package/references/native/InsightResearchQueries.java +3 -4
- package/references/native/InsightResearchView.java +4 -10
- package/references/native/InsightSdkFiles.java +7 -15
- package/references/native/InsightSdkScript.java +1 -4
- package/references/native/InsightSdkTools.java +36 -97
- package/references/native/InsightSdkTypes.java +13 -43
- package/references/native/InsightStringAnchors.java +1 -3
- package/references/native/InsightTraceState.java +13 -96
- package/references/native/InsightTraceTools.java +3 -5
- package/references/native/InsightVersionTracking.java +0 -6
- package/references/native/{HeadlessProgramMergeManager.java → InsightWcMerge.java} +17 -24
- package/references/native/InsightWcOps.java +449 -0
- package/references/native/InsightWcWorker.java +142 -0
- package/references/native/NATIVE-MERGE-NOTICE.txt +4 -8
- package/runtime/GhidraMCP-7.0.0.jar +0 -0
- package/runtime/managed/insight-heap/README.md +3 -3
- package/runtime/managed/insight-managed/README.md +3 -3
- package/runtime/native/binary/README.md +5 -4
- package/runtime/native/windows/DirectoryAlias.cs +24 -0
- package/runtime/native/windows/Insight.Windows.csproj +27 -0
- package/runtime/native/windows/Native.cs +36 -0
- package/runtime/native/windows/OwnedJob.cs +86 -0
- package/runtime/native/windows/Program.cs +50 -0
- package/runtime/native/windows/RegistryRedirect.cs +42 -0
- package/runtime/native/windows/insight-windows-x64.exe +0 -0
- package/runtime/native/windows/packages.lock.json +35 -0
- package/runtime/native/windows/provenance.json +17 -0
- package/runtime/research-view.provenance.json +6 -7
- package/runtime/toolbox.json +33 -114
- package/skill-bundle/insight-artifacts/SKILL.md +5 -19
- package/skill-bundle/insight-binary/SKILL.md +5 -35
- package/skill-bundle/insight-capture/SKILL.md +5 -45
- package/skill-bundle/insight-cli/SKILL.md +6 -44
- package/skill-bundle/insight-die/SKILL.md +5 -38
- package/skill-bundle/insight-dnspy/SKILL.md +5 -54
- package/skill-bundle/insight-dotnet-dump/SKILL.md +5 -35
- package/skill-bundle/insight-dotnet-stack/SKILL.md +5 -28
- package/skill-bundle/insight-dotnet-trace/SKILL.md +5 -34
- package/skill-bundle/insight-frida/SKILL.md +5 -56
- package/skill-bundle/insight-ghidra/SKILL.md +14 -113
- package/skill-bundle/insight-ilspy/SKILL.md +5 -34
- package/skill-bundle/insight-interop/SKILL.md +5 -43
- package/skill-bundle/insight-lldb/SKILL.md +5 -43
- package/skill-bundle/insight-llvm/SKILL.md +5 -45
- package/skill-bundle/insight-managed-heap/SKILL.md +5 -32
- package/skill-bundle/insight-managed-metadata/SKILL.md +5 -41
- package/skill-bundle/insight-mitmproxy/SKILL.md +5 -51
- package/skill-bundle/insight-overview/SKILL.md +5 -68
- package/skill-bundle/insight-procmon/SKILL.md +5 -38
- package/skill-bundle/insight-re/SKILL.md +10 -127
- package/skill-bundle/insight-sevenzip/SKILL.md +5 -31
- package/skill-bundle/insight-strace/SKILL.md +5 -35
- package/skill-bundle/insight-tshark/SKILL.md +5 -38
- package/skill-bundle/insight-windbg/SKILL.md +5 -35
- package/skill-bundle/manifest.json +1 -1
- package/skills/insight-artifacts/SKILL.md +5 -19
- package/skills/insight-binary/SKILL.md +5 -35
- package/skills/insight-capture/SKILL.md +5 -45
- package/skills/insight-die/SKILL.md +5 -38
- package/skills/insight-dnspy/SKILL.md +5 -54
- package/skills/insight-dotnet-dump/SKILL.md +5 -35
- package/skills/insight-dotnet-stack/SKILL.md +5 -28
- package/skills/insight-dotnet-trace/SKILL.md +5 -34
- package/skills/insight-frida/SKILL.md +5 -56
- package/skills/insight-ghidra/SKILL.md +14 -113
- package/skills/insight-ilspy/SKILL.md +5 -34
- package/skills/insight-interop/SKILL.md +5 -43
- package/skills/insight-lldb/SKILL.md +5 -43
- package/skills/insight-llvm/SKILL.md +5 -45
- package/skills/insight-managed-heap/SKILL.md +5 -32
- package/skills/insight-managed-metadata/SKILL.md +5 -41
- package/skills/insight-mitmproxy/SKILL.md +5 -51
- package/skills/insight-overview/SKILL.md +5 -68
- package/skills/insight-procmon/SKILL.md +5 -38
- package/skills/insight-re/SKILL.md +10 -127
- package/skills/insight-sevenzip/SKILL.md +5 -31
- package/skills/insight-strace/SKILL.md +5 -35
- package/skills/insight-tshark/SKILL.md +5 -38
- package/skills/insight-windbg/SKILL.md +5 -35
- package/dist/src/administration-results.d.ts +0 -1
- package/dist/src/administration-results.js +0 -84
- package/dist/src/administration.d.ts +0 -14
- package/dist/src/administration.js +0 -134
- package/dist/src/archive-contract.d.ts +0 -6
- package/dist/src/archive-contract.js +0 -108
- package/dist/src/archive.d.ts +0 -12
- package/dist/src/archive.js +0 -116
- package/dist/src/comment-effects.d.ts +0 -3
- package/dist/src/comment-effects.js +0 -55
- package/dist/src/context-credential.d.ts +0 -18
- package/dist/src/context-credential.js +0 -44
- package/dist/src/contexts.d.ts +0 -387
- package/dist/src/contexts.js +0 -2805
- package/dist/src/coordinator.d.ts +0 -41
- package/dist/src/coordinator.js +0 -160
- package/dist/src/cross-peer.d.ts +0 -20
- package/dist/src/cross-peer.js +0 -53
- package/dist/src/data-effects.d.ts +0 -3
- package/dist/src/data-effects.js +0 -103
- package/dist/src/debugger-caller.d.ts +0 -17
- package/dist/src/debugger-caller.js +0 -129
- package/dist/src/debugger-launch.d.ts +0 -2
- package/dist/src/debugger-launch.js +0 -17
- package/dist/src/debugger-supervisor.js +0 -179
- package/dist/src/directory-identity.d.ts +0 -6
- package/dist/src/directory-identity.js +0 -45
- package/dist/src/documentation-effects.d.ts +0 -5
- package/dist/src/documentation-effects.js +0 -56
- package/dist/src/function-effects.d.ts +0 -4
- package/dist/src/function-effects.js +0 -112
- package/dist/src/ghidra-processes.d.ts +0 -6
- package/dist/src/ghidra-processes.js +0 -138
- package/dist/src/ghidra.d.ts +0 -50
- package/dist/src/ghidra.js +0 -468
- package/dist/src/initial-model.d.ts +0 -7
- package/dist/src/initial-model.js +0 -115
- package/dist/src/initial-progress.d.ts +0 -4
- package/dist/src/initial-progress.js +0 -74
- package/dist/src/inline-script.d.ts +0 -15
- package/dist/src/inline-script.js +0 -61
- package/dist/src/legacy-migration.d.ts +0 -37
- package/dist/src/legacy-migration.js +0 -238
- package/dist/src/lifecycle.d.ts +0 -77
- package/dist/src/lifecycle.js +0 -315
- package/dist/src/merge.d.ts +0 -29
- package/dist/src/merge.js +0 -66
- package/dist/src/mutation-effects.d.ts +0 -4
- package/dist/src/mutation-effects.js +0 -321
- package/dist/src/native-queries.d.ts +0 -2
- package/dist/src/native-queries.js +0 -24
- package/dist/src/native-service.d.ts +0 -40
- package/dist/src/native-service.js +0 -406
- package/dist/src/projects.d.ts +0 -31
- package/dist/src/projects.js +0 -302
- package/dist/src/prototype-cli.d.ts +0 -8
- package/dist/src/prototype-cli.js +0 -155
- package/dist/src/query-results.d.ts +0 -2
- package/dist/src/query-results.js +0 -224
- package/dist/src/research-view.d.ts +0 -6
- package/dist/src/research-view.js +0 -9
- package/dist/src/sdk-files.d.ts +0 -29
- package/dist/src/sdk-files.js +0 -249
- package/dist/src/server.d.ts +0 -102
- package/dist/src/server.js +0 -663
- package/dist/src/storage-gc.d.ts +0 -23
- package/dist/src/storage-gc.js +0 -600
- package/dist/src/store.d.ts +0 -33
- package/dist/src/store.js +0 -178
- package/dist/src/sync-policy.d.ts +0 -22
- package/dist/src/sync-policy.js +0 -129
- package/dist/src/timed-backend.d.ts +0 -3
- package/dist/src/timed-backend.js +0 -24
- package/dist/src/timing-report.d.ts +0 -32
- package/dist/src/timing-report.js +0 -74
- package/dist/src/tool-runtime/native-process-proof.d.ts +0 -2
- package/dist/src/tool-runtime/native-process-proof.js +0 -26
- package/dist/src/transport.d.ts +0 -60
- package/dist/src/transport.js +0 -223
- package/dist/src/unresolved-guidance.d.ts +0 -46
- package/dist/src/unresolved-guidance.js +0 -55
- package/dist/src/work/backup.d.ts +0 -66
- package/dist/src/work/backup.js +0 -446
- package/dist/src/work/store.js +0 -1107
- package/dist/src/worker-lease.d.ts +0 -17
- package/dist/src/worker-lease.js +0 -50
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts +0 -37
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts.map +0 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.js.map +0 -1
- package/references/InsightRepositoryProbe.java +0 -55
- package/references/administration.md +0 -34
- package/references/agent-execution.md +0 -36
- package/references/agent-setup.md +0 -60
- package/references/archive.md +0 -32
- package/references/artifacts.md +0 -52
- package/references/debugger.md +0 -64
- package/references/extensions-and-sync.md +0 -125
- package/references/ilspy.md +0 -33
- package/references/managed-runtime.md +0 -162
- package/references/native/InsightArchivePayloads.java +0 -36
- package/references/native/InsightBlockTransfer.java +0 -57
- package/references/native/InsightGuiMain.java +0 -33
- package/references/native/InsightHeadlessMain.java +0 -18
- package/references/native/InsightImportProgress.java +0 -60
- package/references/native/InsightInitialImport.java +0 -48
- package/references/native/InsightInitialJournal.java +0 -57
- package/references/native/InsightInitialPublication.java +0 -142
- package/references/native/InsightInitialRecovery.java +0 -131
- package/references/native/InsightInlineExecutor.java +0 -143
- package/references/native/InsightInlineScript.java +0 -14
- package/references/native/InsightNativeCheckout.java +0 -487
- package/references/native/InsightNativeFingerprint.java +0 -80
- package/references/native/InsightNativeMigration.java +0 -155
- package/references/native/InsightNativeRead.java +0 -80
- package/references/native/InsightNativeReceipt.java +0 -31
- package/references/native/InsightNativeService.java +0 -43
- package/references/native/InsightNativeView.java +0 -40
- package/references/native/InsightOfflineAuthenticator.java +0 -20
- package/references/native/InsightOwnedScripts.java +0 -170
- package/references/native/InsightProjectFiles.java +0 -92
- package/references/native/InsightPublicationRecovery.java +0 -63
- package/references/native/InsightServerAdministration.java +0 -82
- package/references/native/InsightServerInit.java +0 -62
- package/references/native/InsightServerMain.java +0 -43
- package/references/native/InsightServerProbe.java +0 -29
- package/references/native/InsightSnapshotFields.java +0 -74
- package/references/native/InsightSnapshotInspect.java +0 -191
- package/references/native/InsightSnapshotPublisher.java +0 -123
- package/references/native/InsightStopDebugger.java +0 -20
- package/references/native/InsightTraceInspect.java +0 -24
- package/references/native/InsightWorkerLease.java +0 -132
- package/references/native-workflows.md +0 -124
- package/references/persistent-client.mjs +0 -147
- package/references/persistent.md +0 -90
- package/references/query-semantics.md +0 -109
- package/references/recovery.md +0 -235
- package/references/research.md +0 -296
- package/references/setup.md +0 -135
- package/references/sparse-navigation.md +0 -173
- package/references/storage.md +0 -139
- package/references/work-tracking.md +0 -261
- package/runtime/native/file-version.ps1 +0 -7
- package/runtime/native/mitmproxy/bridge.py +0 -180
- package/runtime/native/windows-job/DirectoryAlias.cs +0 -24
- package/runtime/native/windows-job/Insight.WindowsJob.csproj +0 -1
- package/runtime/native/windows-job/Insight.WindowsJob.dll +0 -0
- package/runtime/native/windows-job/OwnedJob.cs +0 -79
- package/runtime/native/windows-job/RegistryRedirect.cs +0 -45
- package/runtime/native/windows-job/packages.lock.json +0 -21
- package/runtime/native/windows-job/provenance.json +0 -16
- package/runtime/native/windows-job/windows-job.ps1 +0 -8
- package/skill-bundle/insight-artifacts/references/agent-execution.md +0 -36
- package/skill-bundle/insight-artifacts/references/artifacts.md +0 -52
- package/skill-bundle/insight-artifacts/references/recovery.md +0 -235
- package/skill-bundle/insight-artifacts/references/storage.md +0 -139
- package/skill-bundle/insight-binary/references/agent-execution.md +0 -36
- package/skill-bundle/insight-capture/references/agent-execution.md +0 -36
- package/skill-bundle/insight-cli/references/agent-execution.md +0 -36
- package/skill-bundle/insight-cli/references/agent-setup.md +0 -60
- package/skill-bundle/insight-cli/references/archive.md +0 -32
- package/skill-bundle/insight-cli/references/managed-runtime.md +0 -162
- package/skill-bundle/insight-cli/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-cli/references/persistent.md +0 -90
- package/skill-bundle/insight-cli/references/recovery.md +0 -235
- package/skill-bundle/insight-cli/references/setup.md +0 -135
- package/skill-bundle/insight-cli/references/storage.md +0 -139
- package/skill-bundle/insight-die/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dnspy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-dump/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-stack/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-trace/references/agent-execution.md +0 -36
- package/skill-bundle/insight-frida/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ghidra/references/administration.md +0 -34
- package/skill-bundle/insight-ghidra/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ghidra/references/archive.md +0 -32
- package/skill-bundle/insight-ghidra/references/artifacts.md +0 -52
- package/skill-bundle/insight-ghidra/references/debugger.md +0 -64
- package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +0 -125
- package/skill-bundle/insight-ghidra/references/managed-runtime.md +0 -162
- package/skill-bundle/insight-ghidra/references/native-workflows.md +0 -124
- package/skill-bundle/insight-ghidra/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-ghidra/references/persistent.md +0 -90
- package/skill-bundle/insight-ghidra/references/query-semantics.md +0 -109
- package/skill-bundle/insight-ghidra/references/recovery.md +0 -235
- package/skill-bundle/insight-ghidra/references/research.md +0 -296
- package/skill-bundle/insight-ghidra/references/setup.md +0 -135
- package/skill-bundle/insight-ghidra/references/sparse-navigation.md +0 -173
- package/skill-bundle/insight-ghidra/references/storage.md +0 -139
- package/skill-bundle/insight-ilspy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ilspy/references/ilspy.md +0 -33
- package/skill-bundle/insight-interop/references/agent-execution.md +0 -36
- package/skill-bundle/insight-lldb/references/agent-execution.md +0 -36
- package/skill-bundle/insight-llvm/references/agent-execution.md +0 -36
- package/skill-bundle/insight-managed-heap/references/agent-execution.md +0 -36
- package/skill-bundle/insight-managed-metadata/references/agent-execution.md +0 -36
- package/skill-bundle/insight-mitmproxy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-overview/references/agent-execution.md +0 -36
- package/skill-bundle/insight-procmon/references/agent-execution.md +0 -36
- package/skill-bundle/insight-re/references/agent-execution.md +0 -36
- package/skill-bundle/insight-re/references/artifacts.md +0 -52
- package/skill-bundle/insight-re/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-re/references/persistent.md +0 -90
- package/skill-bundle/insight-re/references/recovery.md +0 -235
- package/skill-bundle/insight-re/references/storage.md +0 -139
- package/skill-bundle/insight-re/references/work-tracking.md +0 -261
- package/skill-bundle/insight-sevenzip/references/agent-execution.md +0 -36
- package/skill-bundle/insight-strace/references/agent-execution.md +0 -36
- package/skill-bundle/insight-tshark/references/agent-execution.md +0 -36
- package/skill-bundle/insight-windbg/references/agent-execution.md +0 -36
- package/skills/insight-artifacts/references/agent-execution.md +0 -36
- package/skills/insight-artifacts/references/artifacts.md +0 -52
- package/skills/insight-artifacts/references/recovery.md +0 -235
- package/skills/insight-artifacts/references/storage.md +0 -139
- package/skills/insight-binary/references/agent-execution.md +0 -36
- package/skills/insight-capture/references/agent-execution.md +0 -36
- package/skills/insight-die/references/agent-execution.md +0 -36
- package/skills/insight-dnspy/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-dump/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-stack/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-trace/references/agent-execution.md +0 -36
- package/skills/insight-frida/references/agent-execution.md +0 -36
- package/skills/insight-ghidra/references/administration.md +0 -34
- package/skills/insight-ghidra/references/agent-execution.md +0 -36
- package/skills/insight-ghidra/references/archive.md +0 -32
- package/skills/insight-ghidra/references/artifacts.md +0 -52
- package/skills/insight-ghidra/references/debugger.md +0 -64
- package/skills/insight-ghidra/references/extensions-and-sync.md +0 -125
- package/skills/insight-ghidra/references/managed-runtime.md +0 -162
- package/skills/insight-ghidra/references/native-workflows.md +0 -124
- package/skills/insight-ghidra/references/persistent-client.mjs +0 -147
- package/skills/insight-ghidra/references/persistent.md +0 -90
- package/skills/insight-ghidra/references/query-semantics.md +0 -109
- package/skills/insight-ghidra/references/recovery.md +0 -235
- package/skills/insight-ghidra/references/research.md +0 -296
- package/skills/insight-ghidra/references/setup.md +0 -135
- package/skills/insight-ghidra/references/sparse-navigation.md +0 -173
- package/skills/insight-ghidra/references/storage.md +0 -139
- package/skills/insight-ilspy/references/agent-execution.md +0 -36
- package/skills/insight-ilspy/references/ilspy.md +0 -33
- package/skills/insight-interop/references/agent-execution.md +0 -36
- package/skills/insight-lldb/references/agent-execution.md +0 -36
- package/skills/insight-llvm/references/agent-execution.md +0 -36
- package/skills/insight-managed-heap/references/agent-execution.md +0 -36
- package/skills/insight-managed-metadata/references/agent-execution.md +0 -36
- package/skills/insight-mitmproxy/references/agent-execution.md +0 -36
- package/skills/insight-overview/references/agent-execution.md +0 -36
- package/skills/insight-procmon/references/agent-execution.md +0 -36
- package/skills/insight-re/references/agent-execution.md +0 -36
- package/skills/insight-re/references/artifacts.md +0 -52
- package/skills/insight-re/references/persistent-client.mjs +0 -147
- package/skills/insight-re/references/persistent.md +0 -90
- package/skills/insight-re/references/recovery.md +0 -235
- package/skills/insight-re/references/storage.md +0 -139
- package/skills/insight-re/references/work-tracking.md +0 -261
- package/skills/insight-sevenzip/references/agent-execution.md +0 -36
- package/skills/insight-strace/references/agent-execution.md +0 -36
- package/skills/insight-tshark/references/agent-execution.md +0 -36
- package/skills/insight-windbg/references/agent-execution.md +0 -36
- /package/dist/src/{debugger-supervisor.d.ts → native/contract.js} +0 -0
- /package/runtime/native/{windows-job → windows}/NuGet.Config +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function runtimeIdentity(ghidraHome: string): string;
|
|
2
|
+
/** An identity recorded by an older version: a hash of the whole installation, which compares with nothing. */
|
|
3
|
+
export declare const installationHash: (identity: unknown) => boolean;
|
|
4
|
+
/** The identity of a recorded runtime: an older installation hash is read again from its Ghidra home, if still there. */
|
|
5
|
+
export declare function currentIdentity(recorded: {
|
|
6
|
+
ghidraHome: string;
|
|
7
|
+
fingerprint: string;
|
|
8
|
+
}): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// What a client and a hub's Ghidra Server must share (#161): the Ghidra version, which fixes the server protocol and
|
|
2
|
+
// the database formats. Read from application.properties; installations are never hashed, so the same version
|
|
3
|
+
// matches on every machine and operating system.
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { fail } from './model.js';
|
|
7
|
+
export function runtimeIdentity(ghidraHome) {
|
|
8
|
+
const properties = readFileSync(join(ghidraHome, 'Ghidra', 'application.properties'), 'utf8');
|
|
9
|
+
const version = /^application.version=(.+)$/m.exec(properties)?.[1]?.trim();
|
|
10
|
+
if (!version)
|
|
11
|
+
fail('configuration', 'Ghidra application.properties names no version.');
|
|
12
|
+
return 'ghidra-' + version;
|
|
13
|
+
}
|
|
14
|
+
/** An identity recorded by an older version: a hash of the whole installation, which compares with nothing. */
|
|
15
|
+
export const installationHash = (identity) => typeof identity === 'string' && /^[a-f0-9]{64}$/.test(identity);
|
|
16
|
+
/** The identity of a recorded runtime: an older installation hash is read again from its Ghidra home, if still there. */
|
|
17
|
+
export function currentIdentity(recorded) {
|
|
18
|
+
if (!installationHash(recorded.fingerprint))
|
|
19
|
+
return recorded.fingerprint;
|
|
20
|
+
try {
|
|
21
|
+
return runtimeIdentity(recorded.ghidraHome);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return recorded.fingerprint;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type CommandContext, type CommandDefinition } from '@eyeauras/cli-factory';
|
|
2
2
|
import { atomicWrite } from './tool-runtime/store.js';
|
|
3
3
|
export declare const runtimeWrite: typeof atomicWrite;
|
|
4
|
-
/** Passive, conservative inventory: an unproved PID blocks deletion; it never grants kill authority. */
|
|
5
|
-
export declare function runtimeProcesses(directory: string, control?: string): Promise<Record<string, unknown>[]>;
|
|
6
4
|
export declare function externalGhidra(path: string): Promise<string>;
|
|
7
5
|
export declare class RuntimeManager {
|
|
8
6
|
private readonly c;
|
|
@@ -43,12 +41,6 @@ export declare class RuntimeManager {
|
|
|
43
41
|
requires?: undefined;
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
|
-
server: {
|
|
47
|
-
pid?: unknown;
|
|
48
|
-
mode: string;
|
|
49
|
-
state: string;
|
|
50
|
-
};
|
|
51
|
-
processes: Record<string, unknown>[];
|
|
52
44
|
installations: {
|
|
53
45
|
id: string;
|
|
54
46
|
selected: boolean;
|
|
@@ -83,7 +75,6 @@ export declare class RuntimeManager {
|
|
|
83
75
|
}[];
|
|
84
76
|
}>;
|
|
85
77
|
private archive;
|
|
86
|
-
private cleanupProbes;
|
|
87
78
|
install(o: Record<string, unknown>): Promise<{
|
|
88
79
|
debugger?: {
|
|
89
80
|
backend: string;
|
|
@@ -103,7 +94,7 @@ export declare class RuntimeManager {
|
|
|
103
94
|
}>;
|
|
104
95
|
uninstall(purgeCache?: boolean): Promise<{
|
|
105
96
|
state: string;
|
|
106
|
-
mode: "
|
|
97
|
+
mode: "managed" | "external";
|
|
107
98
|
externalInstallationPreserved: boolean;
|
|
108
99
|
researchPreserved: boolean;
|
|
109
100
|
materialsPreserved: boolean;
|
|
@@ -117,7 +108,6 @@ export declare class RuntimeManager {
|
|
|
117
108
|
checkedAt: string;
|
|
118
109
|
headless: unknown;
|
|
119
110
|
decompiler: unknown;
|
|
120
|
-
server: boolean;
|
|
121
111
|
debugger: Record<string, unknown>;
|
|
122
112
|
diagnostics: string;
|
|
123
113
|
}>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ownedDirectory } from './directory-identity.js';
|
|
2
1
|
import { runTool } from './tool-runtime/run.js';
|
|
3
2
|
import { analysisDirectory } from './analysis-storage.js';
|
|
4
3
|
import { readFile, mkdir, rename, rm, realpath, readdir, stat, cp } from 'node:fs/promises';
|
|
@@ -9,94 +8,12 @@ import { runtimeRoot, runtimeSelection, runtimeValues } from './runtime-selectio
|
|
|
9
8
|
import { runtimeCatalog } from './runtime-catalog.js';
|
|
10
9
|
import { cacheArtifact, extractArchive, consumeArchive } from './tool-runtime/archives.js';
|
|
11
10
|
import { nativeInputs, nativeHelpers, nativeJvmDirectories, pinnedMcpJar } from './native-inputs.js';
|
|
12
|
-
import { GhidraServer, stopLocalServer } from './server.js';
|
|
13
11
|
import { fail, text, digest, object } from './model.js';
|
|
14
12
|
import { atomicWrite, installationStage, removeInstallation, withToolLock, assertUnused } from './tool-runtime/store.js';
|
|
15
13
|
import { lifecycleCommands as sharedLifecycle } from './tool-runtime/definition.js';
|
|
16
|
-
import { recordedProcessGone } from './tool-runtime/supervisor.js';
|
|
17
14
|
import { managedGhidraDebugger, ghidraDebuggerInstaller, prepareGhidraDebugger } from './ghidra-debugger-runtime.js';
|
|
18
15
|
const suffix = process.platform === 'win32' ? '.exe' : '';
|
|
19
16
|
export const runtimeWrite = atomicWrite;
|
|
20
|
-
const live = (pid) => { if (!Number.isSafeInteger(pid) || Number(pid) < 1)
|
|
21
|
-
return false; try {
|
|
22
|
-
process.kill(Number(pid), 0);
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
if (error.code === 'ESRCH')
|
|
27
|
-
return false;
|
|
28
|
-
throw error;
|
|
29
|
-
} };
|
|
30
|
-
/**
|
|
31
|
-
* A Ghidra binding bound to a supervisor receipt is settled by that receipt when it is the same Ghidra role, PID and
|
|
32
|
-
* root and has provably ended (including a proven PID reuse). Bindings without a matching receipt stay conservative.
|
|
33
|
-
* Receipts live in the Factory control directory, which can differ from the scanned analysis directory.
|
|
34
|
-
*/
|
|
35
|
-
async function supervisorEnded(control, binding, role, root, rootKey) {
|
|
36
|
-
if (typeof binding.toolProcessId !== 'string')
|
|
37
|
-
return false;
|
|
38
|
-
try {
|
|
39
|
-
// The binding's PID is alive: only a fresh proof, on one validated receipt snapshot, settles it.
|
|
40
|
-
const row = await recordedProcessGone(control, binding.toolProcessId), recorded = row?.metadata?.[rootKey];
|
|
41
|
-
if (!row || row.tool !== 'ghidra' || row.role !== role || row.pid !== binding.pid || typeof recorded !== 'string')
|
|
42
|
-
return false;
|
|
43
|
-
const scanned = await realpath(root);
|
|
44
|
-
if (typeof binding.root === 'string' && await realpath(binding.root) !== scanned)
|
|
45
|
-
return false;
|
|
46
|
-
return await realpath(recorded) === scanned;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/** Passive, conservative inventory: an unproved PID blocks deletion; it never grants kill authority. */
|
|
53
|
-
export async function runtimeProcesses(directory, control = directory) {
|
|
54
|
-
const items = [];
|
|
55
|
-
async function walk(path, depth = 0) {
|
|
56
|
-
if (depth > 6)
|
|
57
|
-
return;
|
|
58
|
-
let entries;
|
|
59
|
-
try {
|
|
60
|
-
entries = await readdir(path, { withFileTypes: true });
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
if (error.code === 'ENOENT')
|
|
64
|
-
return;
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
for (const entry of entries) {
|
|
68
|
-
const at = join(path, entry.name);
|
|
69
|
-
if (entry.isDirectory())
|
|
70
|
-
await walk(at, depth + 1);
|
|
71
|
-
else if (entry.name === 'process.json') {
|
|
72
|
-
const p = object(JSON.parse(await readFile(at, 'utf8')));
|
|
73
|
-
let stopped = false;
|
|
74
|
-
try {
|
|
75
|
-
const s = object(JSON.parse(await readFile(join(path, 'stopped.json'), 'utf8')));
|
|
76
|
-
stopped = s.pid === p.pid && s.tokenSecret === p.tokenSecret;
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (error.code !== 'ENOENT')
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
// A GUI worker can own debugger state; it is settled only with debugger cleanup evidence (#153).
|
|
83
|
-
if (!stopped && live(p.pid) && (p.mode === 'gui' || !await supervisorEnded(control, p, String(p.kind), path, 'contextRoot')))
|
|
84
|
-
items.push({ kind: p.kind, pid: p.pid, sessionContext: p.context, ...(typeof p.session === 'string' ? { session: p.session } : {}), target: p.target, mode: p.mode });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
await walk(join(directory, 'workspace', 'ghidra-native'));
|
|
89
|
-
try {
|
|
90
|
-
const s = object(JSON.parse(await readFile(join(directory, 'workspace/server/local.json'), 'utf8')));
|
|
91
|
-
if (live(s.pid) && !await supervisorEnded(control, s, 'server', join(directory, 'workspace'), 'serverDirectory'))
|
|
92
|
-
items.push({ kind: 'server', pid: s.pid });
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
if (error.code !== 'ENOENT')
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
return items;
|
|
99
|
-
}
|
|
100
17
|
export async function externalGhidra(path) {
|
|
101
18
|
const resolved = await realpath(path), kind = await stat(resolved);
|
|
102
19
|
const parent = kind.isDirectory() ? resolved : dirname(dirname(resolved));
|
|
@@ -190,11 +107,10 @@ export class RuntimeManager {
|
|
|
190
107
|
if (error.code !== 'ENOENT')
|
|
191
108
|
throw error;
|
|
192
109
|
}
|
|
193
|
-
const processes = await runtimeProcesses(this.directory), server = processes.find(p => p.kind === 'server');
|
|
194
110
|
return { state: missing.length ? 'not_ready' : 'installed', mode: selected?.mode ?? (home || java ? 'external' : 'unconfigured'), recommended: 'managed', ghidraVersion: version, java, ghidraHome: home,
|
|
195
111
|
...(selected ? { installation: selected.id, fingerprint: selected.fingerprint } : {}), missing, capabilities: { headless: !missing.length, decompiler: !missing.length, gui: !missing.length,
|
|
196
112
|
debugger: managedGhidraDebugger() ? { backend: 'managed-lldb', runtime: await ghidraDebuggerInstaller(this.c).status(), requires: 'OS debugger authorization', checkedBy: 'ghidra doctor' } : process.platform === 'darwin' ? { backend: 'system-lldb', requires: 'Apple developer tools and OS debugger authorization', checkedBy: 'ghidra doctor' } : { backend: 'host-debugger', checkedBy: 'ghidra doctor' } },
|
|
197
|
-
|
|
113
|
+
installations, retainedStages: stages, lastCheck: lastCheck ? { ...lastCheck, appliesToSelection: lastCheck.fingerprint === selected?.fingerprint && !selected?.uninstalledAt } : undefined,
|
|
198
114
|
storage: { runtime: this.root, research: join(this.directory, 'workspace'), materials: join(this.directory, 'materials') } };
|
|
199
115
|
}
|
|
200
116
|
async download(offline = false) {
|
|
@@ -208,54 +124,24 @@ export class RuntimeManager {
|
|
|
208
124
|
items.push({ name: 'LLDB/Python', path: item.path, sha256: item.sha256, license: item.license });
|
|
209
125
|
return { state: 'downloaded', ghidraVersion: catalog.ghidraVersion, javaVersion: catalog.javaVersion, items };
|
|
210
126
|
}
|
|
211
|
-
async archive(artifact, provided,
|
|
127
|
+
async archive(artifact, provided, offline) {
|
|
212
128
|
if (provided === undefined)
|
|
213
129
|
return { path: await cacheArtifact(artifact, join(this.root, 'cache'), this.c.fetch, this.c.signal, offline), artifact };
|
|
214
|
-
return consumeArchive(resolve(this.c.cwd, text(provided, 4096)), join(this.root, 'cache'), artifact,
|
|
215
|
-
}
|
|
216
|
-
async cleanupProbes() {
|
|
217
|
-
// A killed owner may leave a disposable validation server alive. Its authenticated
|
|
218
|
-
// receipt, not PID existence, authorizes recovery; no research repository is touched.
|
|
219
|
-
for (const parent of ['stages', 'checks']) {
|
|
220
|
-
let names;
|
|
221
|
-
try {
|
|
222
|
-
names = await readdir(join(this.root, parent));
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
if (error.code === 'ENOENT')
|
|
226
|
-
continue;
|
|
227
|
-
throw error;
|
|
228
|
-
}
|
|
229
|
-
for (const name of names) {
|
|
230
|
-
if (!/^[a-f0-9-]{36}$/.test(name))
|
|
231
|
-
continue;
|
|
232
|
-
const root = join(analysisDirectory(this.c), 'runtime', parent, name, ...(parent === 'stages' ? ['validation'] : []));
|
|
233
|
-
if (existsSync(join(root, 'server/local.json'))) {
|
|
234
|
-
if (!ownedDirectory(root, analysisDirectory(this.c), ['runtime', parent, name, ...(parent === 'stages' ? ['validation'] : [])]))
|
|
235
|
-
fail('binding', 'Retained runtime probe moved outside its owned storage.');
|
|
236
|
-
await stopLocalServer(root, this.c);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
130
|
+
return consumeArchive(resolve(this.c.cwd, text(provided, 4096)), join(this.root, 'cache'), artifact, this.c.signal);
|
|
240
131
|
}
|
|
241
132
|
async install(o) {
|
|
242
133
|
return withToolLock(this.directory, 'ghidra', async () => {
|
|
243
134
|
await assertUnused(this.directory, 'ghidra');
|
|
244
|
-
await this.cleanupProbes();
|
|
245
135
|
if (o.executable && o.archive)
|
|
246
136
|
fail('invalid', 'Choose --executable or --archive.');
|
|
247
|
-
if (o.
|
|
248
|
-
fail('invalid', 'Archive checksum requires its archive path.');
|
|
249
|
-
if (o.debuggerArchiveSha256 && !o.debuggerArchive)
|
|
250
|
-
fail('invalid', 'Debugger archive checksum requires its archive path.');
|
|
251
|
-
if ((o.debuggerArchive || o.debuggerArchiveSha256) && !managedGhidraDebugger())
|
|
137
|
+
if (o.debuggerArchive && !managedGhidraDebugger())
|
|
252
138
|
fail('unsupported', 'A managed debugger archive requires macOS 15+ ARM64.');
|
|
253
139
|
const catalog = runtimeCatalog(), offline = Boolean(o.offline), external = o.executable ? await externalGhidra(resolve(this.c.cwd, text(o.executable, 4096))) : undefined;
|
|
254
|
-
const ghidra = external ? undefined : await this.archive(catalog.ghidra, o.archive,
|
|
140
|
+
const ghidra = external ? undefined : await this.archive(catalog.ghidra, o.archive, offline);
|
|
255
141
|
const java = o.java ? await realpath(resolve(this.c.cwd, text(o.java, 4096))) : undefined;
|
|
256
142
|
if (java && o.javaArchive)
|
|
257
143
|
fail('invalid', 'Choose --java or --java-archive.');
|
|
258
|
-
const jdk = java ? undefined : await this.archive(catalog.java, o.javaArchive,
|
|
144
|
+
const jdk = java ? undefined : await this.archive(catalog.java, o.javaArchive, offline);
|
|
259
145
|
const identity = digest({ schema: 1, platform: process.platform, architecture: process.arch, external, java, ghidra: ghidra?.artifact.sha256, jdk: jdk?.artifact.sha256, bridge: pinnedMcpJar });
|
|
260
146
|
const receipt = await installationStage(this.root, identity, async (temporary, installation) => {
|
|
261
147
|
let ghidraHome = external, nativeOverlay;
|
|
@@ -294,15 +180,12 @@ export class RuntimeManager {
|
|
|
294
180
|
await this.probe(inputs, join(temporary, 'validation'));
|
|
295
181
|
await rm(join(temporary, 'validation'), { recursive: true, force: true });
|
|
296
182
|
const receipt = { schema: 1, id: identity, ghidraVersion: inputs.ghidraVersion, fingerprint: inputs.fingerprint, java: java ?? join(installation, 'jdk/bin/java' + suffix), ghidraHome: external ?? join(installation, 'ghidra'),
|
|
297
|
-
archives: [...(nativeOverlay ? [{ sha256: nativeOverlay.sha256, source: nativeOverlay.url }] : []), ...(ghidra ? [{ sha256: ghidra.artifact.sha256, source: o.archive ? 'local' : catalog.ghidra.url }] : []), ...(jdk ? [{ sha256: jdk.artifact.sha256, source: o.javaArchive ? 'local' : catalog.java.url }] : [])], verifiedAt: new Date().toISOString(), checks: ['jdk', 'native-decompiler'
|
|
183
|
+
archives: [...(nativeOverlay ? [{ sha256: nativeOverlay.sha256, source: nativeOverlay.url }] : []), ...(ghidra ? [{ sha256: ghidra.artifact.sha256, source: o.archive ? 'local' : catalog.ghidra.url }] : []), ...(jdk ? [{ sha256: jdk.artifact.sha256, source: o.javaArchive ? 'local' : catalog.java.url }] : [])], verifiedAt: new Date().toISOString(), checks: ['jdk', 'native-decompiler'] };
|
|
298
184
|
return receipt;
|
|
299
185
|
}, async (receipt) => {
|
|
300
|
-
const inputs = await nativeInputs({ ...this.c.profile.values, java: receipt.java, ghidraHome: receipt.ghidraHome }, undefined, this.c);
|
|
301
|
-
if (inputs.fingerprint !== receipt.fingerprint)
|
|
302
|
-
fail('binding', 'Installed runtime differs from its verified installation receipt.');
|
|
303
186
|
}, this.c.signal);
|
|
304
187
|
const selected = { schema: 1, mode: external ? 'external' : 'managed', id: identity, ghidraHome: String(receipt.ghidraHome), java: String(receipt.java), fingerprint: String(receipt.fingerprint), selectedAt: new Date().toISOString() };
|
|
305
|
-
const debuggerRuntime = managedGhidraDebugger() ? await prepareGhidraDebugger(this.c, { archive: o.debuggerArchive,
|
|
188
|
+
const debuggerRuntime = managedGhidraDebugger() ? await prepareGhidraDebugger(this.c, { archive: o.debuggerArchive, offline: o.offline }) : undefined;
|
|
306
189
|
await runtimeWrite(join(this.root, 'selection.json'), selected);
|
|
307
190
|
return { state: 'installed', ...selected, checks: receipt.checks, ...(debuggerRuntime ? { debugger: { backend: 'managed-lldb', installation: debuggerRuntime.id, fingerprint: debuggerRuntime.fingerprint } } : {}) };
|
|
308
191
|
}, this.c.signal);
|
|
@@ -310,7 +193,6 @@ export class RuntimeManager {
|
|
|
310
193
|
async uninstall(purgeCache = false) {
|
|
311
194
|
return withToolLock(this.directory, 'ghidra', async () => {
|
|
312
195
|
await assertUnused(this.directory, 'ghidra');
|
|
313
|
-
await this.cleanupProbes();
|
|
314
196
|
const selected = runtimeSelection(this.directory, analysisDirectory(this.c));
|
|
315
197
|
if (!selected)
|
|
316
198
|
fail('configuration', 'No managed selection exists; externally configured profile paths are never removed.');
|
|
@@ -348,23 +230,9 @@ export class RuntimeManager {
|
|
|
348
230
|
const value = object(JSON.parse(output.stdout));
|
|
349
231
|
if (value.state !== 'ready' || value.decompiler !== true || value.expectedReturn !== 42)
|
|
350
232
|
fail('partial', 'Native decompiler probe did not verify its expected result.');
|
|
351
|
-
const probeContext = { ...this.c, profile: { ...this.c.profile, values: { ...this.c.profile.values, server: undefined } } };
|
|
352
|
-
const server = new GhidraServer(root, inputs, probeContext);
|
|
353
|
-
try {
|
|
354
|
-
const result = await server.administration('connect', {});
|
|
355
|
-
if (result.connected !== true || result.mode !== 'local')
|
|
356
|
-
fail('partial', 'Owned server probe did not connect.');
|
|
357
|
-
const checked = await server.administration('status', {});
|
|
358
|
-
if (checked.connected !== true)
|
|
359
|
-
fail('partial', 'Owned server identity/authority probe failed.');
|
|
360
|
-
}
|
|
361
|
-
finally {
|
|
362
|
-
await server.stop();
|
|
363
|
-
}
|
|
364
233
|
return value;
|
|
365
234
|
}
|
|
366
235
|
async doctor() {
|
|
367
|
-
await this.cleanupProbes();
|
|
368
236
|
const root = join(analysisDirectory(this.c), 'runtime/checks', randomUUID()), values = runtimeValues(this.directory, this.c.profile.values, analysisDirectory(this.c));
|
|
369
237
|
const inputs = await nativeInputs(values, undefined, this.c), native = await this.probe(inputs, root);
|
|
370
238
|
let debuggerCheck = { state: 'host_specific' };
|
|
@@ -384,10 +252,10 @@ export class RuntimeManager {
|
|
|
384
252
|
catch {
|
|
385
253
|
debuggerCheck = { state: 'missing', backend: 'system-lldb', reason: 'Apple developer tools or debugger authorization is unavailable' };
|
|
386
254
|
}
|
|
387
|
-
const result = { state: 'verified', fingerprint: inputs.fingerprint, ghidraVersion: inputs.ghidraVersion, checkedAt: new Date().toISOString(), headless: native.headless, decompiler: native.decompiler,
|
|
255
|
+
const result = { state: 'verified', fingerprint: inputs.fingerprint, ghidraVersion: inputs.ghidraVersion, checkedAt: new Date().toISOString(), headless: native.headless, decompiler: native.decompiler, debugger: debuggerCheck, diagnostics: root };
|
|
388
256
|
await runtimeWrite(join(this.root, 'last-check.json'), result);
|
|
389
257
|
if (debuggerCheck.state === 'missing')
|
|
390
|
-
fail('partial', 'Static analysis
|
|
258
|
+
fail('partial', 'Static analysis passed; the host debugger is unavailable.', { ...result, state: 'partial' });
|
|
391
259
|
return result;
|
|
392
260
|
}
|
|
393
261
|
}
|
|
@@ -395,10 +263,7 @@ function runtimeValuesForStatus(selection, values) { return { ...values, java: s
|
|
|
395
263
|
export function runtimeCommands(exclusive) {
|
|
396
264
|
const source = [{ flags: '--archive <path>', description: 'Local Ghidra zip/tar.gz; missing dependencies are downloaded' },
|
|
397
265
|
{ flags: '--debugger-archive <path>', description: 'Local pinned LLDB/Python runtime archive (macOS 15+ ARM64)' },
|
|
398
|
-
{ flags: '--debugger-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied debugger runtime archive' },
|
|
399
|
-
{ flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied Ghidra archive' },
|
|
400
266
|
{ flags: '--java-archive <path>', description: 'Local Java 21 JDK zip/tar.gz' },
|
|
401
|
-
{ flags: '--java-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied JDK archive' },
|
|
402
267
|
{ flags: '--java <path>', description: 'Use an external Java 21 JDK executable' },
|
|
403
268
|
{ flags: '--executable <path>', description: 'Use an external Ghidra launcher or installation directory; never deleted' },
|
|
404
269
|
{ flags: '--offline', description: 'Use local archives/cache only; never access the network' }];
|
|
@@ -9,5 +9,5 @@ export interface RuntimeSelection {
|
|
|
9
9
|
uninstalledAt?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const runtimeRoot: (directory: string) => string;
|
|
12
|
-
export declare function runtimeSelection(directory: string,
|
|
12
|
+
export declare function runtimeSelection(directory: string, _analysis?: string): RuntimeSelection | undefined;
|
|
13
13
|
export declare function runtimeValues(directory: string, values: Record<string, unknown>, analysis?: string): Record<string, unknown>;
|
|
@@ -1,42 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { fail, object, digest } from './model.js';
|
|
1
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fail } from './model.js';
|
|
5
4
|
export const runtimeRoot = (directory) => join(directory, 'runtime');
|
|
6
|
-
export function runtimeSelection(directory,
|
|
5
|
+
export function runtimeSelection(directory, _analysis = directory) {
|
|
7
6
|
const path = join(runtimeRoot(directory), 'selection.json');
|
|
8
7
|
if (!existsSync(path))
|
|
9
8
|
return;
|
|
10
|
-
|
|
11
|
-
if (value.schema !== 1 || !['managed', 'external'].includes(String(value.mode)) || typeof value.java !== 'string' || !isAbsolute(value.java) || typeof value.ghidraHome !== 'string' || !isAbsolute(value.ghidraHome) || !/^[a-f0-9]{64}$/.test(String(value.fingerprint)))
|
|
12
|
-
fail('binding', 'Runtime selection receipt is invalid.');
|
|
13
|
-
if (value.mode === 'managed') {
|
|
14
|
-
const id = String(value.id), recordedProfile = resolve(value.ghidraHome, '../../../..');
|
|
15
|
-
if (!/^[a-f0-9]{64}$/.test(id) || value.ghidraHome !== join(runtimeRoot(recordedProfile), 'installations', id, 'ghidra'))
|
|
16
|
-
fail('binding', 'Managed runtime moved outside its owned installation.');
|
|
17
|
-
// Workspace resolves AppData physically; older install receipts can retain a profile
|
|
18
|
-
// alias such as /tmp -> /private/tmp. Accept that same profile, never an inner escape.
|
|
19
|
-
let profile, recorded, owned, home, retained = false;
|
|
20
|
-
try {
|
|
21
|
-
profile = realpathSync.native(directory);
|
|
22
|
-
recorded = realpathSync.native(recordedProfile);
|
|
23
|
-
owned = realpathSync.native(analysis);
|
|
24
|
-
if (!sameDirectory(recorded, profile) && !sameDirectory(recorded, owned)) {
|
|
25
|
-
const marker = object(JSON.parse(readFileSync(join(recorded, '.insight-analysis.json'), 'utf8')));
|
|
26
|
-
retained = marker.schema === 1 && marker.binding === digest(profile);
|
|
27
|
-
}
|
|
28
|
-
if (!ownedDirectory(runtimeRoot(directory), owned, ['runtime']) || !ownedDirectory(runtimeRoot(recordedProfile), owned, ['runtime']))
|
|
29
|
-
fail('binding', 'Managed runtime root differs from its configured analysis owner.');
|
|
30
|
-
if (existsSync(value.ghidraHome))
|
|
31
|
-
home = realpathSync.native(value.ghidraHome);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
fail('binding', 'Managed runtime profile ownership could not be verified.');
|
|
35
|
-
}
|
|
36
|
-
if (!sameDirectory(recorded, profile) && !sameDirectory(recorded, owned) && !retained || home !== undefined && !ownedDirectory(home, owned, ['runtime', 'installations', id, 'ghidra']))
|
|
37
|
-
fail('binding', 'Managed runtime moved outside its owned installation.');
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
9
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
40
10
|
}
|
|
41
11
|
export function runtimeValues(directory, values, analysis) {
|
|
42
12
|
const selected = runtimeSelection(directory, analysis);
|
|
@@ -44,7 +14,5 @@ export function runtimeValues(directory, values, analysis) {
|
|
|
44
14
|
return values;
|
|
45
15
|
if (selected.uninstalledAt)
|
|
46
16
|
fail('configuration', 'Selected Ghidra runtime was uninstalled. Run insight-cli ghidra install.');
|
|
47
|
-
if (selected.mode === 'managed' && !existsSync(join(runtimeRoot(directory), 'installations', selected.id, 'ready.json')))
|
|
48
|
-
fail('configuration', 'Selected managed Ghidra is not installed. Run insight-cli ghidra install.');
|
|
49
17
|
return { ...values, java: selected.java, ghidraHome: selected.ghidraHome };
|
|
50
18
|
}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { command, CliError, Permission } from '@eyeauras/cli-factory';
|
|
2
2
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
3
|
import { constants } from 'node:fs';
|
|
4
|
-
import { lstat, mkdir, open, opendir,
|
|
5
|
-
import { basename,
|
|
4
|
+
import { lstat, mkdir, open, opendir, rename, rm } from 'node:fs/promises';
|
|
5
|
+
import { basename, join, resolve } from 'node:path';
|
|
6
6
|
import { analysisDirectory } from './analysis-storage.js';
|
|
7
7
|
const maximumEntries = 100_000, maximumDepth = 128;
|
|
8
8
|
function fail(code, message) { throw new CliError(message, { code: 'artifacts.' + code }); }
|
|
9
9
|
function check(signal) { if (signal?.aborted)
|
|
10
10
|
fail('cancelled', 'Saving materials was cancelled; no snapshot was published.'); }
|
|
11
|
-
function inside(parent, child) {
|
|
12
|
-
const value = relative(parent, child);
|
|
13
|
-
return value === '' || (!isAbsolute(value) && value !== '..' && !value.startsWith('..' + sep));
|
|
14
|
-
}
|
|
15
|
-
function stamp(info) { return [info.dev, info.ino, info.mode, info.size, info.mtimeNs, info.ctimeNs].join(':'); }
|
|
16
11
|
async function syncDirectory(path) {
|
|
17
12
|
if (process.platform === 'win32')
|
|
18
13
|
return;
|
|
@@ -30,12 +25,10 @@ async function inventory(source, signal) {
|
|
|
30
25
|
check(signal);
|
|
31
26
|
if (depth > maximumDepth || entries.length >= maximumEntries)
|
|
32
27
|
fail('limit', 'Materials exceed the traversal bound of 100000 entries or 128 directory levels; save a smaller selection.');
|
|
33
|
-
const info = await lstat(path
|
|
28
|
+
const info = await lstat(path);
|
|
34
29
|
if (!info.isFile() && !info.isDirectory())
|
|
35
30
|
fail('unsupported', 'Materials must contain only ordinary files and directories; symbolic links and special files are unsupported.');
|
|
36
|
-
|
|
37
|
-
fail('limit', 'A materials entry exceeds the supported size counter.');
|
|
38
|
-
entries.push({ path: name, kind: info.isFile() ? 'file' : 'directory', stamp: stamp(info), size: Number(info.size) });
|
|
31
|
+
entries.push({ path: name, kind: info.isFile() ? 'file' : 'directory' });
|
|
39
32
|
if (info.isDirectory()) {
|
|
40
33
|
// Sorting by code unit keeps manifest digests independent of locale and enumeration order.
|
|
41
34
|
const names = [];
|
|
@@ -48,43 +41,23 @@ async function inventory(source, signal) {
|
|
|
48
41
|
names.sort();
|
|
49
42
|
for (const child of names)
|
|
50
43
|
await visit(join(path, child), name ? name + '/' + child : child, depth + 1);
|
|
51
|
-
if (stamp(await lstat(path, { bigint: true })) !== stamp(info))
|
|
52
|
-
fail('changed', 'Source changed while saving; save a stable file or directory.');
|
|
53
44
|
}
|
|
54
45
|
}
|
|
55
46
|
await visit(source, '', 0);
|
|
56
47
|
return entries;
|
|
57
48
|
}
|
|
58
|
-
async function verifyParents(source, entry, entries) {
|
|
59
|
-
let parent = entry.path ? entry.path.split('/').slice(0, -1).join('/') : undefined;
|
|
60
|
-
while (parent !== undefined) {
|
|
61
|
-
const expected = entries.get(parent);
|
|
62
|
-
if (stamp(await lstat(parent ? join(source, parent) : source, { bigint: true })) !== expected.stamp)
|
|
63
|
-
fail('changed', 'Source directory changed while saving; no snapshot was published.');
|
|
64
|
-
parent = parent ? parent.split('/').slice(0, -1).join('/') : undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
49
|
/** Copy user materials without initializing Ghidra, targets, sessions or Workspace. */
|
|
68
50
|
export async function saveMaterials(appDataDirectory, source, signal) {
|
|
69
51
|
let stage, published;
|
|
70
52
|
try {
|
|
71
53
|
check(signal);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const info = await lstat(sourcePath, { bigint: true });
|
|
54
|
+
const canonicalSource = resolve(source);
|
|
55
|
+
const info = await lstat(canonicalSource);
|
|
75
56
|
if (!info.isFile() && !info.isDirectory())
|
|
76
57
|
fail('unsupported', 'Save an ordinary file or directory; symbolic links and special files are unsupported.');
|
|
77
|
-
const
|
|
78
|
-
await mkdir(appDataDirectory, { recursive: true, mode: 0o700 });
|
|
79
|
-
const appData = await realpath(appDataDirectory), storage = join(appData, 'materials');
|
|
80
|
-
if (info.isDirectory() && inside(canonicalSource, storage))
|
|
81
|
-
fail('recursive', 'Source contains the materials storage; choose a source outside its storage ancestry.');
|
|
58
|
+
const storage = join(appDataDirectory, 'materials');
|
|
82
59
|
await mkdir(storage, { recursive: true, mode: 0o700 });
|
|
83
|
-
|
|
84
|
-
fail('storage', 'Materials storage must be an ordinary profile-owned directory.');
|
|
85
|
-
const entries = await inventory(canonicalSource, signal), byPath = new Map(entries.map(entry => [entry.path, entry]));
|
|
86
|
-
if (entries[0].stamp !== stamp(info))
|
|
87
|
-
fail('changed', 'Source changed while preparing its snapshot; save a stable file or directory.');
|
|
60
|
+
const entries = await inventory(canonicalSource, signal);
|
|
88
61
|
const identity = randomUUID(), candidate = join(storage, '.pending-' + identity);
|
|
89
62
|
const final = join(storage, identity), content = join(candidate, 'content');
|
|
90
63
|
await mkdir(candidate, { mode: 0o700 });
|
|
@@ -96,7 +69,6 @@ export async function saveMaterials(appDataDirectory, source, signal) {
|
|
|
96
69
|
const buffer = Buffer.allocUnsafe(1024 * 1024);
|
|
97
70
|
for (const entry of entries) {
|
|
98
71
|
check(signal);
|
|
99
|
-
await verifyParents(canonicalSource, entry, byPath);
|
|
100
72
|
const inputPath = entry.path ? join(canonicalSource, entry.path) : canonicalSource;
|
|
101
73
|
const outputPath = entry.path ? join(output, entry.path) : output;
|
|
102
74
|
if (entry.kind === 'directory') {
|
|
@@ -108,9 +80,6 @@ export async function saveMaterials(appDataDirectory, source, signal) {
|
|
|
108
80
|
// NONBLOCK avoids a hang if a regular source is exchanged for a FIFO before open.
|
|
109
81
|
const input = await open(inputPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
110
82
|
try {
|
|
111
|
-
const before = await input.stat({ bigint: true });
|
|
112
|
-
if (!before.isFile() || stamp(before) !== entry.stamp)
|
|
113
|
-
fail('changed', 'Source file changed while saving; no snapshot was published.');
|
|
114
83
|
const destination = await open(outputPath, 'wx', 0o600), hash = createHash('sha256');
|
|
115
84
|
let copied = 0;
|
|
116
85
|
try {
|
|
@@ -120,15 +89,10 @@ export async function saveMaterials(appDataDirectory, source, signal) {
|
|
|
120
89
|
if (!bytesRead)
|
|
121
90
|
break;
|
|
122
91
|
copied += bytesRead;
|
|
123
|
-
if (copied > entry.size)
|
|
124
|
-
fail('changed', 'Source file grew while saving; no snapshot was published.');
|
|
125
92
|
const chunk = buffer.subarray(0, bytesRead);
|
|
126
93
|
hash.update(chunk);
|
|
127
94
|
await destination.writeFile(chunk);
|
|
128
95
|
}
|
|
129
|
-
if (copied !== entry.size || stamp(await input.stat({ bigint: true })) !== entry.stamp ||
|
|
130
|
-
stamp(await lstat(inputPath, { bigint: true })) !== entry.stamp)
|
|
131
|
-
fail('changed', 'Source file changed while saving; no snapshot was published.');
|
|
132
96
|
await destination.sync();
|
|
133
97
|
}
|
|
134
98
|
finally {
|
|
@@ -139,18 +103,11 @@ export async function saveMaterials(appDataDirectory, source, signal) {
|
|
|
139
103
|
fileDigest = sha256;
|
|
140
104
|
files++;
|
|
141
105
|
bytes += copied;
|
|
142
|
-
if (!Number.isSafeInteger(bytes))
|
|
143
|
-
fail('limit', 'Materials exceed the supported size counter.');
|
|
144
106
|
}
|
|
145
107
|
finally {
|
|
146
108
|
await input.close();
|
|
147
109
|
}
|
|
148
110
|
}
|
|
149
|
-
// Detect edits to earlier files and directory membership changes during the entire capture.
|
|
150
|
-
const after = await inventory(canonicalSource, signal);
|
|
151
|
-
if (JSON.stringify(after) !== JSON.stringify(entries) || await realpath(sourcePath) !== canonicalSource ||
|
|
152
|
-
stamp(await lstat(sourcePath, { bigint: true })) !== stamp(info))
|
|
153
|
-
fail('changed', 'Source changed while saving; no snapshot was published.');
|
|
154
111
|
const manifestBytes = JSON.stringify({ version: 1, entries: manifest }) + '\n';
|
|
155
112
|
const metadata = await open(join(stage, 'manifest.json'), 'wx', 0o600);
|
|
156
113
|
try {
|
package/dist/src/scripts.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface ScriptPage {
|
|
|
13
13
|
limit: number;
|
|
14
14
|
truncated: boolean;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/** The file of an explicit inventory ID (`installation:<module path>/<name>`, `extension:<module>/<name>`, `context:<name>`). */
|
|
17
17
|
export declare function scriptPath(home: string, contextRoot: string, script: string, extensions?: string[]): Promise<string>;
|
|
18
18
|
/** Enumerate configured installation and owned context scripts without exposing native paths. */
|
|
19
19
|
export declare function scriptInventory(home: string, contextRoot: string, filter: string, limit: number, offset: number, extensions?: string[]): Promise<ScriptPage>;
|
package/dist/src/scripts.js
CHANGED
|
@@ -2,24 +2,26 @@ import { readdir, open } from 'node:fs/promises';
|
|
|
2
2
|
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import { constants } from 'node:fs';
|
|
4
4
|
import { fail } from './model.js';
|
|
5
|
-
/**
|
|
5
|
+
/** The file of an explicit inventory ID (`installation:<module path>/<name>`, `extension:<module>/<name>`, `context:<name>`). */
|
|
6
6
|
export async function scriptPath(home, contextRoot, script, extensions = []) {
|
|
7
7
|
if (!/^(installation|context|extension):[^\0]+\.(java|py)$/.test(script) || script.includes('..') || script.includes('\\'))
|
|
8
8
|
fail('invalid', 'Choose an explicit script ID returned by ghidra scripts list.');
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const part = script.slice(script.indexOf(':') + 1);
|
|
13
|
-
if (item.origin === 'extension') {
|
|
9
|
+
const origin = script.slice(0, script.indexOf(':')), part = script.slice(script.indexOf(':') + 1), segments = part.split('/'), filename = segments.pop();
|
|
10
|
+
let path;
|
|
11
|
+
if (origin === 'extension') {
|
|
14
12
|
const [module, ...rest] = part.split('/'), root = extensions.find(p => p.split(/[\\/]/).pop() === module);
|
|
15
|
-
if (!root)
|
|
16
|
-
fail('
|
|
17
|
-
|
|
13
|
+
if (!root || !rest.length)
|
|
14
|
+
fail('notFound', 'Script module is not enabled.');
|
|
15
|
+
path = join(root, 'ghidra_scripts', ...rest);
|
|
18
16
|
}
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
else if (origin === 'context') {
|
|
18
|
+
if (segments.length)
|
|
19
|
+
fail('notFound', 'Script ID is absent from this context and installation.');
|
|
20
|
+
path = join(contextRoot, 'ghidra_scripts', filename);
|
|
21
|
+
}
|
|
22
|
+
else
|
|
23
|
+
path = join(home, 'Ghidra', ...segments, 'ghidra_scripts', filename);
|
|
24
|
+
return path;
|
|
23
25
|
}
|
|
24
26
|
/** Enumerate configured installation and owned context scripts without exposing native paths. */
|
|
25
27
|
export async function scriptInventory(home, contextRoot, filter, limit, offset, extensions = []) {
|
|
@@ -44,8 +46,6 @@ export async function scriptInventory(home, contextRoot, filter, limit, offset,
|
|
|
44
46
|
let category;
|
|
45
47
|
try {
|
|
46
48
|
const data = Buffer.alloc(4096), read = await handle.read(data, 0, data.length, 0);
|
|
47
|
-
if (!(await handle.stat()).isFile())
|
|
48
|
-
fail('binding', 'Script inventory file changed during inspection.');
|
|
49
49
|
category = /^\s*(?:\/\/|#)\s*@category\s+([^\r\n]+)/m.exec(data.subarray(0, read.bytesRead).toString('utf8'))?.[1]?.trim().slice(0, 256);
|
|
50
50
|
}
|
|
51
51
|
finally {
|
|
@@ -9,8 +9,8 @@ export const sdkOperations = [
|
|
|
9
9
|
{ operation: 'type-layout', group: 'types', name: 'layout', description: 'Read native packing, alignment, bitfields, settings and source archive identity', params: [str('path')] },
|
|
10
10
|
{ operation: 'type-structure', group: 'types', name: 'define-layout', description: 'Create a native structure with packing/alignment/bitfields; replace only an explicitly selected empty placeholder', write: true, params: [str('path'), json('fields', 'array'), { name: 'packing', type: 'integer', required: false, default: '0' }, { name: 'alignment', type: 'integer', required: false, default: '0' }, bool('replace_placeholder')] },
|
|
11
11
|
{ operation: 'type-settings', group: 'types', name: 'set-settings', description: 'Edit default settings by actual native definition names; null clears an explicit setting', write: true, params: [str('path'), json('settings')] },
|
|
12
|
-
{ operation: 'type-archive-import', group: 'types', name: 'archive-import', description: 'Import explicit GDT type paths with archive identity
|
|
13
|
-
{ operation: 'changes', group: 'changes', name: 'compare', description: 'Categorized native ProgramDiff of
|
|
12
|
+
{ operation: 'type-archive-import', group: 'types', name: 'archive-import', description: 'Import explicit GDT type paths with their archive identity', write: true, params: [str('input'), json('types', 'array')] },
|
|
13
|
+
{ operation: 'changes', group: 'changes', name: 'compare', description: 'Categorized native ProgramDiff of this working copy against its base version or another context; does not merge', pair: true, params: [{ ...json('categories', 'array', false), default: '["bytes","code_units","comments","symbols","functions","references","context","properties"]' }, count('max_ranges', '100'), count('timeout_seconds', '30')] },
|
|
14
14
|
{ operation: 'block-state', group: 'memory', name: 'block-state', description: 'Read exact block layout and bounded full-content digest', params: [str('name')] },
|
|
15
15
|
{ operation: 'assembly-preview', group: 'assembly', name: 'preview', description: 'Assemble in this program language and processor context without writing', params: [at(), json('instructions', 'array')] },
|
|
16
16
|
{ operation: 'patch-bytes', group: 'memory', name: 'patch-bytes', description: 'Replace equal-length bytes only when the expected bytes match; clears overlapping listing', write: true, params: [at(), str('expect_hex'), str('bytes_hex')] },
|