@eyeauras/insight-cli 0.2.0 → 0.2.2
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 +25 -0
- package/SKILL.md +38 -54
- package/dist/src/binary.d.ts +3 -0
- package/dist/src/binary.js +74 -0
- package/dist/src/capture.d.ts +3 -0
- package/dist/src/capture.js +220 -0
- package/dist/src/cli.js +57 -12
- package/dist/src/contexts.d.ts +5 -0
- package/dist/src/contexts.js +42 -16
- package/dist/src/debugger-caller.d.ts +17 -0
- package/dist/src/debugger-caller.js +129 -0
- package/dist/src/debugger-launch.d.ts +2 -0
- package/dist/src/debugger-launch.js +17 -0
- package/dist/src/debugger-results.d.ts +1 -0
- package/dist/src/debugger-results.js +8 -0
- package/dist/src/debugger-supervisor.js +56 -13
- package/dist/src/debugger.js +16 -7
- package/dist/src/die.d.ts +12 -0
- package/dist/src/die.js +127 -0
- package/dist/src/dnspy-runtime.d.ts +8 -0
- package/dist/src/dnspy-runtime.js +46 -0
- package/dist/src/dnspy.d.ts +22 -0
- package/dist/src/dnspy.js +160 -0
- package/dist/src/dotnet-diagnostics.d.ts +13 -0
- package/dist/src/dotnet-diagnostics.js +101 -0
- package/dist/src/frida-worker.d.ts +1 -0
- package/dist/src/frida-worker.js +125 -0
- package/dist/src/frida.d.ts +16 -0
- package/dist/src/frida.js +125 -0
- package/dist/src/ghidra-debugger-runtime.d.ts +7 -0
- package/dist/src/ghidra-debugger-runtime.js +31 -0
- package/dist/src/ghidra-processes.d.ts +6 -0
- package/dist/src/ghidra-processes.js +121 -0
- package/dist/src/ghidra.js +6 -6
- package/dist/src/ilspy.d.ts +7 -0
- package/dist/src/ilspy.js +122 -0
- package/dist/src/lldb.d.ts +10 -0
- package/dist/src/lldb.js +99 -0
- package/dist/src/llvm.d.ts +6 -0
- package/dist/src/llvm.js +133 -0
- package/dist/src/managed-heap.d.ts +4 -0
- package/dist/src/managed-heap.js +73 -0
- package/dist/src/managed-metadata.d.ts +11 -0
- package/dist/src/managed-metadata.js +66 -0
- package/dist/src/mitmproxy.d.ts +55 -0
- package/dist/src/mitmproxy.js +172 -0
- package/dist/src/native-inputs.d.ts +3 -2
- package/dist/src/native-inputs.js +9 -4
- package/dist/src/package-version.d.ts +1 -0
- package/dist/src/package-version.js +3 -0
- package/dist/src/procmon-config.d.ts +2 -0
- package/dist/src/procmon-config.js +15 -0
- package/dist/src/procmon-events.d.ts +13 -0
- package/dist/src/procmon-events.js +82 -0
- package/dist/src/procmon.d.ts +4 -0
- package/dist/src/procmon.js +107 -0
- package/dist/src/research.d.ts +11 -2
- package/dist/src/research.js +5 -3
- package/dist/src/runtime-catalog.d.ts +5 -10
- package/dist/src/runtime-catalog.js +4 -5
- package/dist/src/runtime-manager.d.ts +27 -3
- package/dist/src/runtime-manager.js +100 -159
- package/dist/src/runtime-selection.js +21 -4
- package/dist/src/server.d.ts +13 -0
- package/dist/src/server.js +21 -45
- package/dist/src/sevenzip.d.ts +15 -0
- package/dist/src/sevenzip.js +119 -0
- package/dist/src/strace.d.ts +10 -0
- package/dist/src/strace.js +71 -0
- package/dist/src/text-window.d.ts +11 -0
- package/dist/src/text-window.js +6 -0
- package/dist/src/tool-runtime/archives.d.ts +10 -0
- package/dist/src/{runtime-archives.js → tool-runtime/archives.js} +91 -24
- package/dist/src/tool-runtime/catalog.d.ts +3 -0
- package/dist/src/tool-runtime/catalog.js +13 -0
- package/dist/src/tool-runtime/commands.d.ts +9 -0
- package/dist/src/tool-runtime/commands.js +39 -0
- package/dist/src/tool-runtime/deadline.d.ts +11 -0
- package/dist/src/tool-runtime/deadline.js +32 -0
- package/dist/src/tool-runtime/definition.d.ts +73 -0
- package/dist/src/tool-runtime/definition.js +49 -0
- package/dist/src/tool-runtime/dotnet.d.ts +4 -0
- package/dist/src/tool-runtime/dotnet.js +22 -0
- package/dist/src/tool-runtime/identity.d.ts +6 -0
- package/dist/src/tool-runtime/identity.js +50 -0
- package/dist/src/tool-runtime/installer.d.ts +101 -0
- package/dist/src/tool-runtime/installer.js +180 -0
- package/dist/src/tool-runtime/java-arguments.d.ts +6 -0
- package/dist/src/tool-runtime/java-arguments.js +44 -0
- package/dist/src/tool-runtime/launch-worker.d.ts +1 -0
- package/dist/src/tool-runtime/launch-worker.js +58 -0
- package/dist/src/tool-runtime/run.d.ts +51 -0
- package/dist/src/tool-runtime/run.js +159 -0
- package/dist/src/tool-runtime/store.d.ts +15 -0
- package/dist/src/tool-runtime/store.js +219 -0
- package/dist/src/tool-runtime/supervisor.d.ts +57 -0
- package/dist/src/tool-runtime/supervisor.js +269 -0
- package/dist/src/tool-runtime/windows-job.d.ts +22 -0
- package/dist/src/tool-runtime/windows-job.js +43 -0
- package/dist/src/toolbox.d.ts +84 -0
- package/dist/src/toolbox.js +35 -0
- package/dist/src/tshark.d.ts +23 -0
- package/dist/src/tshark.js +174 -0
- package/dist/src/windbg.d.ts +14 -0
- package/dist/src/windbg.js +119 -0
- package/dist/src/workspace.d.ts +1 -0
- package/dist/src/workspace.js +6 -0
- package/package.json +5 -4
- package/references/agent-execution.md +36 -0
- package/references/agent-setup.md +61 -0
- package/references/artifacts.md +5 -0
- package/references/debugger.md +22 -0
- package/references/ilspy.md +33 -0
- package/references/managed-runtime.md +53 -7
- package/references/native/InsightPythonWheels.java +283 -2
- package/references/native/InsightTraceState.java +28 -13
- package/references/native-workflows.md +10 -0
- package/references/setup.md +2 -1
- package/runtime/managed/insight-heap/Azure.Core.dll +0 -0
- package/runtime/managed/insight-heap/Azure.Identity.dll +0 -0
- package/runtime/managed/insight-heap/Insight.Heap.csproj +1 -0
- package/runtime/managed/insight-heap/Insight.Heap.deps.json +391 -0
- package/runtime/managed/insight-heap/Insight.Heap.dll +0 -0
- package/runtime/managed/insight-heap/Insight.Heap.runtimeconfig.json +13 -0
- package/runtime/managed/insight-heap/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Diagnostics.NETCore.Client.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Diagnostics.Runtime.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Diagnostics.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Hosting.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Options.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Extensions.Primitives.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Identity.Client.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.IdentityModel.Abstractions.dll +0 -0
- package/runtime/managed/insight-heap/Microsoft.Security.AntiSSRF.dll +0 -0
- package/runtime/managed/insight-heap/NuGet.Config +1 -0
- package/runtime/managed/insight-heap/Program.cs +20 -0
- package/runtime/managed/insight-heap/README.md +16 -0
- package/runtime/managed/insight-heap/System.ClientModel.dll +0 -0
- package/runtime/managed/insight-heap/System.Memory.Data.dll +0 -0
- package/runtime/managed/insight-heap/System.Security.Cryptography.ProtectedData.dll +0 -0
- package/runtime/managed/insight-heap/dependencies.json +436 -0
- package/runtime/managed/insight-heap/notices/Azure.Core-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/Azure.Identity-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Bcl.AsyncInterfaces-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Bcl.AsyncInterfaces-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Diagnostics.NETCore.Client-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Diagnostics.Runtime-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Configuration.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Configuration.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.DependencyInjection.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.DependencyInjection.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Diagnostics.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Diagnostics.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.FileProviders.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.FileProviders.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Hosting.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Hosting.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Logging.Abstractions-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Logging.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Options-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Options-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Primitives-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Primitives-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Identity.Client-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Identity.Client.Extensions.Msal-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/Microsoft.IdentityModel.Abstractions-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/Microsoft.Security.AntiSSRF-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/System.ClientModel-LICENSE.txt +21 -0
- package/runtime/managed/insight-heap/notices/System.Memory.Data-LICENSE.txt +23 -0
- package/runtime/managed/insight-heap/notices/System.Memory.Data-THIRD-PARTY-NOTICES.TXT +1418 -0
- package/runtime/managed/insight-heap/notices/System.Security.Cryptography.ProtectedData-LICENSE.TXT +23 -0
- package/runtime/managed/insight-heap/notices/System.Security.Cryptography.ProtectedData-THIRD-PARTY-NOTICES.TXT +309 -0
- package/runtime/managed/insight-heap/packages.lock.json +165 -0
- package/runtime/managed/insight-heap/provenance.json +146 -0
- package/runtime/managed/insight-heap/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll +0 -0
- package/runtime/managed/insight-managed/Insight.Managed.csproj +4 -0
- package/runtime/managed/insight-managed/Insight.Managed.deps.json +41 -0
- package/runtime/managed/insight-managed/Insight.Managed.dll +0 -0
- package/runtime/managed/insight-managed/Insight.Managed.runtimeconfig.json +13 -0
- package/runtime/managed/insight-managed/LICENSE.dnlib.txt +20 -0
- package/runtime/managed/insight-managed/NuGet.Config +1 -0
- package/runtime/managed/insight-managed/Program.cs +31 -0
- package/runtime/managed/insight-managed/README.md +16 -0
- package/runtime/managed/insight-managed/dnlib.dll +0 -0
- package/runtime/managed/insight-managed/packages.lock.json +13 -0
- package/runtime/managed/insight-managed/provenance.json +40 -0
- package/runtime/native/binary/README.md +22 -0
- package/runtime/native/binary/dependencies.json +166 -0
- package/runtime/native/binary/helper.cpp +44 -0
- package/runtime/native/binary/insight-binary-darwin-arm64 +0 -0
- package/runtime/native/binary/notices/Catch2-3.12.0--Catch2-3.12.0__LICENSE.txt +23 -0
- package/runtime/native/binary/notices/LIEF-LICENSE.txt +202 -0
- package/runtime/native/binary/notices/LIEF-attribution.txt +37 -0
- package/runtime/native/binary/notices/Melkor_ELF_Fuzzer-ac2495b--elf_fuzzer-master__LICENSE.txt +674 -0
- package/runtime/native/binary/notices/expected-1.3.1--expected-1.3.1__COPYING +121 -0
- package/runtime/native/binary/notices/frozen-61dce5a--frozen-61dce5ae18ca59931e27675c468e64118aba8744__AUTHORS +3 -0
- package/runtime/native/binary/notices/frozen-61dce5a--frozen-61dce5ae18ca59931e27675c468e64118aba8744__LICENSE +202 -0
- package/runtime/native/binary/notices/json-LICENSE.MIT +21 -0
- package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--LICENSE +553 -0
- package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--framework__LICENSE +553 -0
- package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--tf-psa-crypto__LICENSE +552 -0
- package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--tf-psa-crypto__framework__LICENSE +553 -0
- package/runtime/native/binary/notices/nanobind-2.13.0.r18.g4db9ed3f--LICENSE +26 -0
- package/runtime/native/binary/notices/nanobind-2.13.0.r18.g4db9ed3f--ext__robin_map__LICENSE +21 -0
- package/runtime/native/binary/notices/span-LICENSE_1_0.txt +23 -0
- package/runtime/native/binary/notices/span-attribution.txt +11 -0
- package/runtime/native/binary/notices/spdlog-1.17.0--spdlog-1.17.0__LICENSE +25 -0
- package/runtime/native/binary/notices/utfcpp-4.0.9--utfcpp-4.0.9__LICENSE +23 -0
- package/runtime/native/binary/provenance.json +48 -0
- package/runtime/native/child-deadline-linux-x64 +0 -0
- package/runtime/native/child-deadline-linux.c +24 -0
- package/runtime/native/child-deadline-linux.provenance.json +17 -0
- package/runtime/native/deadline-alarm-darwin-universal.dylib +0 -0
- package/runtime/native/deadline-alarm.c +33 -0
- package/runtime/native/deadline-alarm.provenance.json +22 -0
- package/runtime/native/deadline-exec-darwin-arm64 +0 -0
- package/runtime/native/deadline-exec.c +24 -0
- package/runtime/native/deadline-exec.provenance.json +17 -0
- package/runtime/native/dnspy-extension/Bridge.cs +58 -0
- package/runtime/native/dnspy-extension/Insight.DnSpy.csproj +13 -0
- package/runtime/native/dnspy-extension/Insight.DnSpy.x.dll +0 -0
- package/runtime/native/dnspy-extension/NuGet.Config +1 -0
- package/runtime/native/dnspy-extension/UNICODE-LOADER.md +26 -0
- package/runtime/native/dnspy-extension/packages.lock.json +6 -0
- package/runtime/native/dnspy-extension/provenance.json +27 -0
- package/runtime/native/dnspy-extension/upstream-public-build.snk +0 -0
- package/runtime/native/dnspy-extension/vendor-files.json +4341 -0
- package/runtime/native/file-version.ps1 +7 -0
- package/runtime/native/insight-registry-win-x64.dll +0 -0
- package/runtime/native/mitmproxy/bridge.py +180 -0
- package/runtime/native/mitmproxy/notices.json +476 -0
- package/runtime/native/sources/detours-LICENSE.md +23 -0
- package/runtime/native/sources/detours-e4bfd6b.tar.gz +0 -0
- package/runtime/native/sources/detours-provenance.json +10 -0
- package/runtime/native/tshark-layout.json +2247 -0
- package/runtime/native/windows-job/DirectoryAlias.cs +24 -0
- package/runtime/native/windows-job/Insight.WindowsJob.csproj +1 -0
- package/runtime/native/windows-job/Insight.WindowsJob.dll +0 -0
- package/runtime/native/windows-job/NuGet.Config +1 -0
- package/runtime/native/windows-job/OwnedJob.cs +79 -0
- package/runtime/native/windows-job/RegistryRedirect.cs +45 -0
- package/runtime/native/windows-job/packages.lock.json +21 -0
- package/runtime/native/windows-job/provenance.json +16 -0
- package/runtime/native/windows-job/windows-job.ps1 +8 -0
- package/runtime/native/windows-registry.c +21 -0
- package/runtime/native/windows-registry.def +3 -0
- package/runtime/native/windows-registry.provenance.json +14 -0
- package/runtime/notices/diagnostics-10.0.750501.txt +23 -0
- package/runtime/tool-catalog.json +290 -0
- package/runtime/toolbox.json +1401 -0
- package/skill-bundle/insight-artifacts/SKILL.md +30 -0
- package/skill-bundle/insight-artifacts/references/agent-execution.md +36 -0
- package/skill-bundle/insight-artifacts/references/artifacts.md +52 -0
- package/skill-bundle/insight-binary/SKILL.md +46 -0
- package/skill-bundle/insight-binary/references/agent-execution.md +36 -0
- package/skill-bundle/insight-capture/SKILL.md +56 -0
- package/skill-bundle/insight-capture/references/agent-execution.md +36 -0
- package/skill-bundle/insight-cli/SKILL.md +42 -0
- package/skill-bundle/insight-cli/references/agent-execution.md +36 -0
- package/skill-bundle/insight-cli/references/agent-setup.md +61 -0
- package/skill-bundle/insight-die/SKILL.md +49 -0
- package/skill-bundle/insight-die/references/agent-execution.md +36 -0
- package/skill-bundle/insight-dnspy/SKILL.md +65 -0
- package/skill-bundle/insight-dnspy/references/agent-execution.md +36 -0
- package/skill-bundle/insight-dotnet-dump/SKILL.md +46 -0
- package/skill-bundle/insight-dotnet-dump/references/agent-execution.md +36 -0
- package/skill-bundle/insight-dotnet-stack/SKILL.md +39 -0
- package/skill-bundle/insight-dotnet-stack/references/agent-execution.md +36 -0
- package/skill-bundle/insight-dotnet-trace/SKILL.md +45 -0
- package/skill-bundle/insight-dotnet-trace/references/agent-execution.md +36 -0
- package/skill-bundle/insight-frida/SKILL.md +67 -0
- package/skill-bundle/insight-frida/references/agent-execution.md +36 -0
- package/skill-bundle/insight-ghidra/SKILL.md +91 -0
- package/skill-bundle/insight-ghidra/references/administration.md +34 -0
- package/skill-bundle/insight-ghidra/references/agent-execution.md +36 -0
- package/skill-bundle/insight-ghidra/references/archive.md +32 -0
- package/skill-bundle/insight-ghidra/references/artifacts.md +52 -0
- package/skill-bundle/insight-ghidra/references/debugger.md +62 -0
- package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +124 -0
- package/skill-bundle/insight-ghidra/references/managed-runtime.md +162 -0
- package/skill-bundle/insight-ghidra/references/native-workflows.md +122 -0
- package/skill-bundle/insight-ghidra/references/query-semantics.md +96 -0
- package/skill-bundle/insight-ghidra/references/recovery.md +53 -0
- package/skill-bundle/insight-ghidra/references/research.md +101 -0
- package/skill-bundle/insight-ghidra/references/setup.md +50 -0
- package/skill-bundle/insight-ilspy/SKILL.md +45 -0
- package/skill-bundle/insight-ilspy/references/agent-execution.md +36 -0
- package/skill-bundle/insight-ilspy/references/ilspy.md +33 -0
- package/skill-bundle/insight-interop/SKILL.md +54 -0
- package/skill-bundle/insight-interop/references/agent-execution.md +36 -0
- package/skill-bundle/insight-lldb/SKILL.md +54 -0
- package/skill-bundle/insight-lldb/references/agent-execution.md +36 -0
- package/skill-bundle/insight-llvm/SKILL.md +56 -0
- package/skill-bundle/insight-llvm/references/agent-execution.md +36 -0
- package/skill-bundle/insight-managed-heap/SKILL.md +43 -0
- package/skill-bundle/insight-managed-heap/references/agent-execution.md +36 -0
- package/skill-bundle/insight-managed-metadata/SKILL.md +52 -0
- package/skill-bundle/insight-managed-metadata/references/agent-execution.md +36 -0
- package/skill-bundle/insight-mitmproxy/SKILL.md +62 -0
- package/skill-bundle/insight-mitmproxy/references/agent-execution.md +36 -0
- package/skill-bundle/insight-overview/SKILL.md +79 -0
- package/skill-bundle/insight-overview/references/agent-execution.md +36 -0
- package/skill-bundle/insight-procmon/SKILL.md +49 -0
- package/skill-bundle/insight-procmon/references/agent-execution.md +36 -0
- package/skill-bundle/insight-re/SKILL.md +121 -0
- package/skill-bundle/insight-re/references/agent-execution.md +36 -0
- package/skill-bundle/insight-re/references/artifacts.md +52 -0
- package/skill-bundle/insight-re/references/recovery.md +53 -0
- package/skill-bundle/insight-sevenzip/SKILL.md +42 -0
- package/skill-bundle/insight-sevenzip/references/agent-execution.md +36 -0
- package/skill-bundle/insight-strace/SKILL.md +46 -0
- package/skill-bundle/insight-strace/references/agent-execution.md +36 -0
- package/skill-bundle/insight-tshark/SKILL.md +49 -0
- package/skill-bundle/insight-tshark/references/agent-execution.md +36 -0
- package/skill-bundle/insight-windbg/SKILL.md +46 -0
- package/skill-bundle/insight-windbg/references/agent-execution.md +36 -0
- package/skill-bundle/manifest.json +32 -0
- package/skills/insight-artifacts/SKILL.md +30 -0
- package/skills/insight-artifacts/references/agent-execution.md +36 -0
- package/skills/insight-artifacts/references/artifacts.md +52 -0
- package/skills/insight-binary/SKILL.md +46 -0
- package/skills/insight-binary/references/agent-execution.md +36 -0
- package/skills/insight-capture/SKILL.md +56 -0
- package/skills/insight-capture/references/agent-execution.md +36 -0
- package/skills/insight-die/SKILL.md +49 -0
- package/skills/insight-die/references/agent-execution.md +36 -0
- package/skills/insight-dnspy/SKILL.md +65 -0
- package/skills/insight-dnspy/references/agent-execution.md +36 -0
- package/skills/insight-dotnet-dump/SKILL.md +46 -0
- package/skills/insight-dotnet-dump/references/agent-execution.md +36 -0
- package/skills/insight-dotnet-stack/SKILL.md +39 -0
- package/skills/insight-dotnet-stack/references/agent-execution.md +36 -0
- package/skills/insight-dotnet-trace/SKILL.md +45 -0
- package/skills/insight-dotnet-trace/references/agent-execution.md +36 -0
- package/skills/insight-frida/SKILL.md +67 -0
- package/skills/insight-frida/references/agent-execution.md +36 -0
- package/skills/insight-ghidra/SKILL.md +91 -0
- package/skills/insight-ghidra/references/administration.md +34 -0
- package/skills/insight-ghidra/references/agent-execution.md +36 -0
- package/skills/insight-ghidra/references/archive.md +32 -0
- package/skills/insight-ghidra/references/artifacts.md +52 -0
- package/skills/insight-ghidra/references/debugger.md +62 -0
- package/skills/insight-ghidra/references/extensions-and-sync.md +124 -0
- package/skills/insight-ghidra/references/managed-runtime.md +162 -0
- package/skills/insight-ghidra/references/native-workflows.md +122 -0
- package/skills/insight-ghidra/references/query-semantics.md +96 -0
- package/skills/insight-ghidra/references/recovery.md +53 -0
- package/skills/insight-ghidra/references/research.md +101 -0
- package/skills/insight-ghidra/references/setup.md +50 -0
- package/skills/insight-ilspy/SKILL.md +45 -0
- package/skills/insight-ilspy/references/agent-execution.md +36 -0
- package/skills/insight-ilspy/references/ilspy.md +33 -0
- package/skills/insight-interop/SKILL.md +54 -0
- package/skills/insight-interop/references/agent-execution.md +36 -0
- package/skills/insight-lldb/SKILL.md +54 -0
- package/skills/insight-lldb/references/agent-execution.md +36 -0
- package/skills/insight-llvm/SKILL.md +56 -0
- package/skills/insight-llvm/references/agent-execution.md +36 -0
- package/skills/insight-managed-heap/SKILL.md +43 -0
- package/skills/insight-managed-heap/references/agent-execution.md +36 -0
- package/skills/insight-managed-metadata/SKILL.md +52 -0
- package/skills/insight-managed-metadata/references/agent-execution.md +36 -0
- package/skills/insight-mitmproxy/SKILL.md +62 -0
- package/skills/insight-mitmproxy/references/agent-execution.md +36 -0
- package/skills/insight-overview/SKILL.md +79 -0
- package/skills/insight-overview/references/agent-execution.md +36 -0
- package/skills/insight-procmon/SKILL.md +49 -0
- package/skills/insight-procmon/references/agent-execution.md +36 -0
- package/skills/insight-re/SKILL.md +22 -9
- package/skills/insight-re/references/agent-execution.md +36 -0
- package/skills/insight-re/references/artifacts.md +52 -0
- package/skills/insight-re/references/recovery.md +53 -0
- package/skills/insight-sevenzip/SKILL.md +42 -0
- package/skills/insight-sevenzip/references/agent-execution.md +36 -0
- package/skills/insight-strace/SKILL.md +46 -0
- package/skills/insight-strace/references/agent-execution.md +36 -0
- package/skills/insight-tshark/SKILL.md +49 -0
- package/skills/insight-tshark/references/agent-execution.md +36 -0
- package/skills/insight-windbg/SKILL.md +46 -0
- package/skills/insight-windbg/references/agent-execution.md +36 -0
- package/dist/src/runtime-archives.d.ts +0 -5
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type CommandContext, type CommandDefinition } from '@eyeauras/cli-factory';
|
|
2
|
+
import type { ToolProcessHooks } from './commands.js';
|
|
3
|
+
export interface ToolArtifact {
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
sha256: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
format: 'zip' | 'tgz';
|
|
9
|
+
root: string;
|
|
10
|
+
license: string;
|
|
11
|
+
delivery?: {
|
|
12
|
+
kind: 'vendor-direct';
|
|
13
|
+
publisher: string;
|
|
14
|
+
termsUrl: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ToolComponent {
|
|
19
|
+
id: string;
|
|
20
|
+
version: string;
|
|
21
|
+
artifacts: ToolArtifact[];
|
|
22
|
+
dependencies?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface ToolInstallation {
|
|
25
|
+
schema: 1;
|
|
26
|
+
tool: string;
|
|
27
|
+
id: string;
|
|
28
|
+
mode: 'managed' | 'external';
|
|
29
|
+
root: string;
|
|
30
|
+
executable: string;
|
|
31
|
+
fingerprint: string;
|
|
32
|
+
selectedAt: string;
|
|
33
|
+
uninstalledAt?: string;
|
|
34
|
+
components: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
export interface ToolProcess {
|
|
37
|
+
schema: 1;
|
|
38
|
+
id: string;
|
|
39
|
+
tool: string;
|
|
40
|
+
role: string;
|
|
41
|
+
installation: string;
|
|
42
|
+
state: 'starting' | 'running' | 'exited' | 'failed' | 'unverified';
|
|
43
|
+
executable: string;
|
|
44
|
+
pid?: number;
|
|
45
|
+
identity?: string;
|
|
46
|
+
session?: string;
|
|
47
|
+
target?: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
endedAt?: string;
|
|
50
|
+
exitCode?: number | null;
|
|
51
|
+
signal?: string | null;
|
|
52
|
+
elapsedMs?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ToolLifecycle {
|
|
55
|
+
download(options: Record<string, unknown>, context: CommandContext): Promise<unknown>;
|
|
56
|
+
install(options: Record<string, unknown>, context: CommandContext): Promise<unknown>;
|
|
57
|
+
uninstall(options: Record<string, unknown>, context: CommandContext): Promise<unknown>;
|
|
58
|
+
doctor(options: Record<string, unknown>, context: CommandContext): Promise<unknown>;
|
|
59
|
+
status?(options: Record<string, unknown>, context: CommandContext): Promise<unknown>;
|
|
60
|
+
}
|
|
61
|
+
export interface ToolDefinition {
|
|
62
|
+
id: string;
|
|
63
|
+
description: string;
|
|
64
|
+
components: ToolComponent[];
|
|
65
|
+
lifecycle: ToolLifecycle;
|
|
66
|
+
vendorDirect?: boolean;
|
|
67
|
+
installOptions?: NonNullable<CommandDefinition['options']>;
|
|
68
|
+
commands?: CommandDefinition[];
|
|
69
|
+
processes?: ToolProcessHooks;
|
|
70
|
+
}
|
|
71
|
+
/** Definitions are data/hooks. Factory remains the only parser, permission and output owner. */
|
|
72
|
+
export declare function defineTool(value: ToolDefinition): ToolDefinition;
|
|
73
|
+
export declare function lifecycleCommands(tool: ToolDefinition): CommandDefinition[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
|
+
import { fail } from '../model.js';
|
|
3
|
+
/** Definitions are data/hooks. Factory remains the only parser, permission and output owner. */
|
|
4
|
+
export function defineTool(value) {
|
|
5
|
+
if (!/^[a-z][a-z0-9-]*$/.test(value.id))
|
|
6
|
+
fail('invalid', 'Invalid tool name.');
|
|
7
|
+
const components = new Map(value.components.map(item => [item.id, item]));
|
|
8
|
+
if (components.size !== value.components.length)
|
|
9
|
+
fail('invalid', 'Duplicate tool component.');
|
|
10
|
+
const done = new Set(), pending = new Set();
|
|
11
|
+
function visit(id) {
|
|
12
|
+
const component = components.get(id);
|
|
13
|
+
if (!component)
|
|
14
|
+
fail('invalid', 'Unknown tool dependency.');
|
|
15
|
+
if (pending.has(id))
|
|
16
|
+
fail('invalid', 'Cyclic tool dependency.');
|
|
17
|
+
if (done.has(id))
|
|
18
|
+
return;
|
|
19
|
+
pending.add(id);
|
|
20
|
+
for (const dependency of component.dependencies ?? [])
|
|
21
|
+
visit(dependency);
|
|
22
|
+
pending.delete(id);
|
|
23
|
+
done.add(id);
|
|
24
|
+
for (const artifact of component.artifacts) {
|
|
25
|
+
if (!/^[a-f0-9]{64}$/.test(artifact.sha256) || new URL(artifact.url).protocol !== 'https:')
|
|
26
|
+
fail('invalid', 'Tool artifact requires HTTPS and a pinned SHA256.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const id of components.keys())
|
|
30
|
+
visit(id);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
export function lifecycleCommands(tool) {
|
|
34
|
+
const offline = { flags: '--offline', description: 'Use verified local archives and cache without network access' };
|
|
35
|
+
const vendor = tool.vendorDirect ? [{ flags: '--vendor-direct', description: 'Explicitly acquire pinned non-redistributable bytes from the named vendor' }] : [];
|
|
36
|
+
const source = [...vendor, { flags: '--archive <path>', description: 'Install from a local tool archive' },
|
|
37
|
+
{ flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 of the local tool archive' },
|
|
38
|
+
{ flags: '--executable <path>', description: 'Use an external executable; its files are never deleted' }, offline];
|
|
39
|
+
const leaf = (name, description, permission, options) => command(name, description, ({ options: o }, c) => tool.lifecycle[name](o, c), { permission, options });
|
|
40
|
+
return [
|
|
41
|
+
leaf('download', 'Download the pinned tool and required runtime components', Permission.Update, [offline, ...vendor]),
|
|
42
|
+
leaf('install', 'Prepare, verify and select the tool installation', Permission.Update, tool.installOptions ?? source),
|
|
43
|
+
leaf('uninstall', 'Remove owned software while preserving research and external files', 'Destructive', [
|
|
44
|
+
{ flags: '--purge-cache', description: 'Also remove owned downloaded archives' }
|
|
45
|
+
]),
|
|
46
|
+
leaf('doctor', 'Run bounded probes of the selected tool', Permission.Update, []),
|
|
47
|
+
...(tool.lifecycle.status ? [leaf('status', 'Inspect installation and process state without launching the tool', Permission.ReadOnly, [])] : []),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolLaunch } from './installer.js';
|
|
2
|
+
/** Shared private runtime dependency; it is not an independent analytical tool. */
|
|
3
|
+
export declare function dotnetArtifact(platform?: string, architecture?: NodeJS.Architecture): import("./definition.js").ToolArtifact;
|
|
4
|
+
export declare function dotnetLaunch(root: string, entryPoint: string): ToolLaunch;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { catalogArtifact } from './catalog.js';
|
|
3
|
+
import { fail } from '../model.js';
|
|
4
|
+
const runtimeHashes = {
|
|
5
|
+
'darwin-arm64': 'fdf7ef21688338ad5d1d99d7eca7f3cf2e159c86e552d3f5acd0553b11c80ca6',
|
|
6
|
+
'darwin-x64': '50fd6ea005731494a6144fd4617746f4155fdc0f3682d0ba7292eac9e9bf46e3',
|
|
7
|
+
'linux-x64': '958c952691d2c3f8ce21f717f4e911c02b5da0e21ead21bd576368c454b79c77',
|
|
8
|
+
'win32-x64': '8db74a746baa450925d01325a2108ccf6ac39af4018047475292ae155c013d89',
|
|
9
|
+
};
|
|
10
|
+
/** Shared private runtime dependency; it is not an independent analytical tool. */
|
|
11
|
+
export function dotnetArtifact(platform = process.platform, architecture = process.arch) {
|
|
12
|
+
const hash = runtimeHashes[platform + '-' + architecture];
|
|
13
|
+
if (!hash)
|
|
14
|
+
fail('configuration', 'No pinned private .NET runtime for this platform; select an external compatible tool executable.');
|
|
15
|
+
return catalogArtifact(hash);
|
|
16
|
+
}
|
|
17
|
+
export function dotnetLaunch(root, entryPoint) {
|
|
18
|
+
return {
|
|
19
|
+
executable: join(root, 'dotnet' + (process.platform === 'win32' ? '.exe' : '')), arguments: [entryPoint],
|
|
20
|
+
environment: { DOTNET_ROOT: root, DOTNET_MULTILEVEL_LOOKUP: '0', DOTNET_CLI_TELEMETRY_OPTOUT: '1', DOTNET_NOLOGO: '1' },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
const exec = promisify(execFile);
|
|
5
|
+
function unavailable(pid) { try {
|
|
6
|
+
process.kill(pid, 0);
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
if (e.code === 'ESRCH')
|
|
10
|
+
return;
|
|
11
|
+
} return { birth: 'unavailable', strong: false }; }
|
|
12
|
+
export async function processIdentity(pid) {
|
|
13
|
+
if (!Number.isSafeInteger(pid) || pid < 1)
|
|
14
|
+
return;
|
|
15
|
+
try {
|
|
16
|
+
if (process.platform === 'linux') {
|
|
17
|
+
const raw = await readFile('/proc/' + pid + '/stat', 'utf8'), parts = raw.slice(raw.lastIndexOf(')') + 2).split(' ');
|
|
18
|
+
if (parts[0] === 'Z')
|
|
19
|
+
return;
|
|
20
|
+
return { birth: (await readFile('/proc/sys/kernel/random/boot_id', 'utf8')).trim() + ':' + parts[19], strong: true, group: Number(parts[2]) };
|
|
21
|
+
}
|
|
22
|
+
if (process.platform === 'darwin') {
|
|
23
|
+
const r = await exec('/bin/ps', ['-p', String(pid), '-o', 'stat=', '-o', 'pgid=', '-o', 'lstart='], { env: { PATH: '/usr/bin:/bin', LC_ALL: 'C', TZ: 'UTC' }, timeout: 3000, maxBuffer: 4096 });
|
|
24
|
+
const match = r.stdout.trim().match(/^(\S+)\s+(\d+)\s+(.+)$/);
|
|
25
|
+
if (!match)
|
|
26
|
+
return unavailable(pid);
|
|
27
|
+
if (match[1].startsWith('Z'))
|
|
28
|
+
return;
|
|
29
|
+
// ps birth time is second-resolution; recovered macOS processes additionally need a tool identity hook.
|
|
30
|
+
return { birth: match[3], strong: false, group: Number(match[2]) };
|
|
31
|
+
}
|
|
32
|
+
if (process.platform === 'win32') {
|
|
33
|
+
const script = 'try{$p=[Diagnostics.Process]::GetProcessById(' + pid + ');try{$p.StartTime.ToUniversalTime().Ticks.ToString()}finally{$p.Dispose()}}catch [ArgumentException]{}';
|
|
34
|
+
const r = await exec('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: 4096 });
|
|
35
|
+
return r.stdout.trim() ? { birth: r.stdout.trim(), strong: true } : unavailable(pid);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
process.kill(pid, 0);
|
|
39
|
+
return { birth: 'unverified', strong: false };
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (['ENOENT', 'ESRCH', 'EACCES', 'EPERM'].includes(error.code ?? '') || error.code === 1)
|
|
47
|
+
return unavailable(pid);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { CommandContext } from '@eyeauras/cli-factory';
|
|
2
|
+
import type { ToolArtifact, ToolInstallation } from './definition.js';
|
|
3
|
+
export interface ToolLaunch {
|
|
4
|
+
executable: string;
|
|
5
|
+
arguments: string[];
|
|
6
|
+
environment: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectedTool extends ToolInstallation, ToolLaunch {
|
|
9
|
+
roots: Record<string, string>;
|
|
10
|
+
lastProbe: Record<string, unknown>;
|
|
11
|
+
externalInputs?: Record<string, string>;
|
|
12
|
+
noticeDigest?: string;
|
|
13
|
+
execution?: ToolLaunch;
|
|
14
|
+
executionFingerprint?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Read-only verification used by an owned child after the command owner has staged a runtime. */
|
|
17
|
+
export declare function verifyManagedInstallation(directory: string, tool: string, selected: SelectedTool): Promise<void>;
|
|
18
|
+
export interface InstallDescriptor {
|
|
19
|
+
id: string;
|
|
20
|
+
primary: string;
|
|
21
|
+
components: () => Record<string, ToolArtifact>;
|
|
22
|
+
launch: (roots: Record<string, string>) => ToolLaunch;
|
|
23
|
+
probe: (launch: ToolLaunch, c: CommandContext) => Promise<Record<string, unknown>>;
|
|
24
|
+
/** Reviewed nested packaging preparation inside owned staging, before probe/fingerprint. */
|
|
25
|
+
prepare?: (roots: Record<string, string>, c: CommandContext) => Promise<void>;
|
|
26
|
+
/** Exceptional upstream adaptation: prepare an owned execution copy, never rewrite external software. */
|
|
27
|
+
prepareExternal?: (executable: string, stage: string, c: CommandContext) => Promise<ToolLaunch>;
|
|
28
|
+
preparationId?: string;
|
|
29
|
+
/** Known sibling executables/data files needed by an external tool family. */
|
|
30
|
+
externalInputs?: (executable: string, c: CommandContext) => Promise<Record<string, string>>;
|
|
31
|
+
/** Full retained notices copied into owned installation storage, including external selections. */
|
|
32
|
+
noticeFiles?: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
/** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
|
|
35
|
+
export declare class ToolInstaller {
|
|
36
|
+
readonly c: CommandContext;
|
|
37
|
+
readonly descriptor: InstallDescriptor;
|
|
38
|
+
readonly directory: string;
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly cache: string;
|
|
41
|
+
constructor(c: CommandContext, descriptor: InstallDescriptor);
|
|
42
|
+
private receipt;
|
|
43
|
+
status(): Promise<{
|
|
44
|
+
retainedStages: string[];
|
|
45
|
+
processes: import("./supervisor.js").ProcessRecord[];
|
|
46
|
+
tool: string;
|
|
47
|
+
state: string;
|
|
48
|
+
mode: string;
|
|
49
|
+
installation: string | undefined;
|
|
50
|
+
executable: string | undefined;
|
|
51
|
+
components: Record<string, string>;
|
|
52
|
+
lastProbe: Record<string, unknown> | undefined;
|
|
53
|
+
recommended: string;
|
|
54
|
+
}>;
|
|
55
|
+
download(offline?: boolean, vendorDirect?: boolean): Promise<{
|
|
56
|
+
tool: string;
|
|
57
|
+
state: string;
|
|
58
|
+
items: {
|
|
59
|
+
component: string;
|
|
60
|
+
path: string;
|
|
61
|
+
sha256: string;
|
|
62
|
+
license: string;
|
|
63
|
+
url: string;
|
|
64
|
+
delivery: {
|
|
65
|
+
kind: "vendor-direct";
|
|
66
|
+
publisher: string;
|
|
67
|
+
termsUrl: string;
|
|
68
|
+
reason: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "owned-release";
|
|
71
|
+
};
|
|
72
|
+
}[];
|
|
73
|
+
}>;
|
|
74
|
+
install(o: Record<string, unknown>): Promise<{
|
|
75
|
+
tool: string;
|
|
76
|
+
state: string;
|
|
77
|
+
mode: "external" | "managed";
|
|
78
|
+
installation: string;
|
|
79
|
+
executable: string;
|
|
80
|
+
components: {
|
|
81
|
+
[k: string]: string;
|
|
82
|
+
};
|
|
83
|
+
checks: Record<string, unknown>;
|
|
84
|
+
}>;
|
|
85
|
+
private verify;
|
|
86
|
+
use<T>(action: (selection: SelectedTool) => Promise<T>): Promise<T>;
|
|
87
|
+
selected(): Promise<SelectedTool>;
|
|
88
|
+
doctor(): Promise<{
|
|
89
|
+
tool: string;
|
|
90
|
+
state: string;
|
|
91
|
+
installation: string;
|
|
92
|
+
checks: Record<string, unknown>;
|
|
93
|
+
}>;
|
|
94
|
+
uninstall(purgeCache?: boolean): Promise<{
|
|
95
|
+
tool: string;
|
|
96
|
+
state: string;
|
|
97
|
+
externalInstallationPreserved: boolean;
|
|
98
|
+
researchPreserved: boolean;
|
|
99
|
+
materialsPreserved: boolean;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { mkdir, stat, rm, readdir, writeFile, readFile } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve, sep, dirname } from 'node:path';
|
|
3
|
+
import { cacheArtifact, consumeArchive, extractArchive, fileSha256, archiveName } from './archives.js';
|
|
4
|
+
import { atomicWrite, readJson, toolRoot, withToolLock, installationStage, removeInstallation, treeFingerprint, assertUnused, withToolUse } from './store.js';
|
|
5
|
+
import { listProcesses } from './supervisor.js';
|
|
6
|
+
import { digest, fail, text } from '../model.js';
|
|
7
|
+
/** Read-only verification used by an owned child after the command owner has staged a runtime. */
|
|
8
|
+
export async function verifyManagedInstallation(directory, tool, selected) {
|
|
9
|
+
const root = join(toolRoot(directory, tool), 'installations', selected.id);
|
|
10
|
+
if (selected.schema !== 1 || selected.tool !== tool || selected.mode !== 'managed' || selected.uninstalledAt || !/^[a-f0-9]{64}$/.test(selected.id) || selected.root !== root || !resolve(selected.executable).startsWith(resolve(root) + sep))
|
|
11
|
+
fail('binding', 'Invalid managed tool installation receipt.');
|
|
12
|
+
const ready = await readJson(join(root, 'ready.json'));
|
|
13
|
+
const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
|
|
14
|
+
if (!ready || digest(binding(ready)) !== digest(binding(selected)))
|
|
15
|
+
fail('binding', 'Managed tool receipt differs from its verified installation.');
|
|
16
|
+
if (await treeFingerprint(root) !== selected.fingerprint)
|
|
17
|
+
fail('binding', 'Managed tool code differs from its verified installation.');
|
|
18
|
+
}
|
|
19
|
+
/** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
|
|
20
|
+
export class ToolInstaller {
|
|
21
|
+
c;
|
|
22
|
+
descriptor;
|
|
23
|
+
directory;
|
|
24
|
+
root;
|
|
25
|
+
cache;
|
|
26
|
+
constructor(c, descriptor) {
|
|
27
|
+
this.c = c;
|
|
28
|
+
this.descriptor = descriptor;
|
|
29
|
+
this.directory = c.appArguments.AppDataDirectory;
|
|
30
|
+
this.root = toolRoot(this.directory, descriptor.id);
|
|
31
|
+
this.cache = join(this.directory, 'runtime/cache');
|
|
32
|
+
}
|
|
33
|
+
async receipt() { return readJson(join(this.root, 'selection.json')); }
|
|
34
|
+
async status() {
|
|
35
|
+
const selected = await this.receipt();
|
|
36
|
+
let present = false;
|
|
37
|
+
if (selected && !selected.uninstalledAt)
|
|
38
|
+
try {
|
|
39
|
+
present = (await stat(selected.executable)).isFile() && (selected.mode === 'external' || Boolean(await readJson(join(this.root, 'installations', selected.id, 'ready.json'))));
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (e.code !== 'ENOENT')
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
const stages = await readdir(join(this.root, 'stages')).catch(e => { if (e.code === 'ENOENT')
|
|
46
|
+
return []; throw e; });
|
|
47
|
+
const processes = (await listProcesses(this.directory, { tool: this.descriptor.id })).filter(r => !['exited', 'failed'].includes(r.state));
|
|
48
|
+
return { retainedStages: stages.slice(0, 100), processes, tool: this.descriptor.id, state: present ? 'installed' : 'not_ready', mode: selected?.mode ?? 'unconfigured', installation: selected?.id, executable: selected?.executable, components: selected?.components ?? {}, lastProbe: selected?.lastProbe, recommended: 'managed' };
|
|
49
|
+
}
|
|
50
|
+
async download(offline = false, vendorDirect = false) {
|
|
51
|
+
const items = [];
|
|
52
|
+
for (const [component, a] of Object.entries(this.descriptor.components()))
|
|
53
|
+
items.push({ component, path: await cacheArtifact(a, this.cache, this.c.fetch, this.c.signal, offline, vendorDirect), sha256: a.sha256, license: a.license, url: a.url, delivery: a.delivery ?? { kind: 'owned-release' } });
|
|
54
|
+
return { tool: this.descriptor.id, state: 'downloaded', items };
|
|
55
|
+
}
|
|
56
|
+
async install(o) {
|
|
57
|
+
return withToolLock(this.directory, this.descriptor.id, async () => {
|
|
58
|
+
await assertUnused(this.directory, this.descriptor.id);
|
|
59
|
+
if (o.executable && o.archive)
|
|
60
|
+
fail('invalid', 'Choose --executable or --archive.');
|
|
61
|
+
const external = o.executable ? resolve(this.c.cwd, text(o.executable, 4096)) : undefined, parts = external ? {} : this.descriptor.components(), consumed = {};
|
|
62
|
+
for (const [id, artifact] of Object.entries(parts)) {
|
|
63
|
+
const key = id === this.descriptor.primary ? 'archive' : id + 'Archive', checksum = id === this.descriptor.primary ? 'archiveSha256' : id + 'ArchiveSha256';
|
|
64
|
+
if (o[checksum] && !o[key])
|
|
65
|
+
fail('invalid', 'Archive checksum requires its archive path.');
|
|
66
|
+
consumed[id] = o[key] ? await consumeArchive(resolve(this.c.cwd, text(o[key], 4096)), this.cache, artifact, o[checksum] === undefined ? undefined : text(o[checksum], 64), this.c.signal) : { path: await cacheArtifact(artifact, this.cache, this.c.fetch, this.c.signal, Boolean(o.offline), Boolean(o.vendorDirect)), artifact };
|
|
67
|
+
}
|
|
68
|
+
const components = Object.fromEntries(Object.entries(consumed).map(([id, v]) => [id, v.artifact.sha256]));
|
|
69
|
+
const externalDigest = external ? await fileSha256(external, this.c.signal) : undefined;
|
|
70
|
+
const externalInputs = external && this.descriptor.externalInputs ? await this.descriptor.externalInputs(external, this.c) : undefined;
|
|
71
|
+
const noticeDigest = this.descriptor.noticeFiles ? digest(this.descriptor.noticeFiles) : undefined;
|
|
72
|
+
const id = digest({ tool: this.descriptor.id, schema: 1, platform: process.platform, architecture: process.arch, external, externalDigest, components, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(this.descriptor.preparationId ? { preparationId: this.descriptor.preparationId } : {}) });
|
|
73
|
+
const rootsAt = (directory) => Object.fromEntries(Object.entries(consumed).map(([part, v]) => { archiveName(v.artifact.root); return [part, join(directory, part, v.artifact.root)]; }));
|
|
74
|
+
const selected = await installationStage(this.root, id, async (stage, installed) => {
|
|
75
|
+
for (const [part, v] of Object.entries(consumed))
|
|
76
|
+
await extractArchive(v.path, join(stage, part), v.artifact.format, this.c.signal);
|
|
77
|
+
if (!external)
|
|
78
|
+
await this.descriptor.prepare?.(rootsAt(stage), this.c);
|
|
79
|
+
const execution = external ? await this.descriptor.prepareExternal?.(external, stage, this.c) : undefined;
|
|
80
|
+
if (execution && !resolve(execution.executable).startsWith(resolve(stage) + sep))
|
|
81
|
+
fail('binding', 'Prepared external execution must use owned staging.');
|
|
82
|
+
for (const [name, body] of Object.entries(this.descriptor.noticeFiles ?? {})) {
|
|
83
|
+
archiveName(name);
|
|
84
|
+
if (!name || Buffer.byteLength(body) > 1024 ** 2)
|
|
85
|
+
fail('configuration', 'Invalid bundled license notice.');
|
|
86
|
+
const destination = join(stage, name);
|
|
87
|
+
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
88
|
+
await writeFile(destination, body, { flag: 'wx', mode: 0o600 });
|
|
89
|
+
}
|
|
90
|
+
const stageLaunch = external ? { executable: external, arguments: [], environment: {} } : this.descriptor.launch(rootsAt(stage));
|
|
91
|
+
const lastProbe = await this.descriptor.probe(execution ?? stageLaunch, this.c), launch = external ? stageLaunch : this.descriptor.launch(rootsAt(installed));
|
|
92
|
+
const fingerprint = external ? await fileSha256(external, this.c.signal) : await treeFingerprint(stage);
|
|
93
|
+
if (external && fingerprint !== externalDigest)
|
|
94
|
+
fail('binding', 'External tool changed during installation.');
|
|
95
|
+
if (externalInputs && digest(await this.descriptor.externalInputs(external, this.c)) !== digest(externalInputs))
|
|
96
|
+
fail('binding', 'External tool family changed during installation.');
|
|
97
|
+
const installedExecution = execution ? { ...execution, executable: join(installed, execution.executable.slice(stage.length + 1)) } : undefined;
|
|
98
|
+
return { schema: 1, tool: this.descriptor.id, id, mode: external ? 'external' : 'managed', root: installed, ...launch, roots: rootsAt(installed), components, fingerprint, lastProbe, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(installedExecution ? { execution: installedExecution, executionFingerprint: await treeFingerprint(stage) } : {}), selectedAt: new Date().toISOString() };
|
|
99
|
+
}, value => this.verify(value), this.c.signal);
|
|
100
|
+
await atomicWrite(join(this.root, 'selection.json'), { ...selected, selectedAt: new Date().toISOString() });
|
|
101
|
+
return { tool: this.descriptor.id, state: 'installed', mode: selected.mode, installation: id, executable: selected.executable, components, checks: selected.lastProbe };
|
|
102
|
+
}, this.c.signal);
|
|
103
|
+
}
|
|
104
|
+
async verify(selected) {
|
|
105
|
+
if (selected.schema !== 1 || selected.tool !== this.descriptor.id || !/^[a-f0-9]{64}$/.test(selected.id))
|
|
106
|
+
fail('binding', 'Invalid tool installation receipt.');
|
|
107
|
+
const root = join(this.root, 'installations', selected.id);
|
|
108
|
+
if (selected.root !== root || selected.mode === 'managed' && !resolve(selected.executable).startsWith(resolve(root) + sep))
|
|
109
|
+
fail('binding', 'Selected tool points outside its owned installation.');
|
|
110
|
+
const ready = await readJson(join(root, 'ready.json'));
|
|
111
|
+
const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
|
|
112
|
+
if (!ready || digest(binding(ready)) !== digest(binding(selected)))
|
|
113
|
+
fail('binding', 'Selected tool receipt differs from its verified installation.');
|
|
114
|
+
if (this.descriptor.noticeFiles) {
|
|
115
|
+
if (selected.noticeDigest !== digest(this.descriptor.noticeFiles))
|
|
116
|
+
fail('binding', 'Bundled license notices changed; reinstall the selected tool.');
|
|
117
|
+
for (const [name, body] of Object.entries(this.descriptor.noticeFiles)) {
|
|
118
|
+
archiveName(name);
|
|
119
|
+
try {
|
|
120
|
+
if (await readFile(join(root, name), 'utf8') !== body)
|
|
121
|
+
fail('binding', 'Installed license notice differs from its retained text.');
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
if (error.code === 'ENOENT')
|
|
125
|
+
fail('binding', 'Installed license notice is missing.');
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (selected.mode === 'managed')
|
|
131
|
+
await verifyManagedInstallation(this.directory, this.descriptor.id, selected);
|
|
132
|
+
else if (await fileSha256(selected.executable, this.c.signal) !== selected.fingerprint)
|
|
133
|
+
fail('binding', 'Selected tool code differs from its verified installation.');
|
|
134
|
+
if (selected.execution && (!resolve(selected.execution.executable).startsWith(resolve(root) + sep) || await treeFingerprint(root) !== selected.executionFingerprint))
|
|
135
|
+
fail('binding', 'Owned external-tool execution copy differs from its verified installation.');
|
|
136
|
+
if (selected.mode === 'external' && this.descriptor.externalInputs && (!selected.externalInputs || digest(await this.descriptor.externalInputs(selected.executable, this.c)) !== digest(selected.externalInputs)))
|
|
137
|
+
fail('binding', 'External tool family differs from its verified installation.');
|
|
138
|
+
}
|
|
139
|
+
async use(action) {
|
|
140
|
+
const lease = await withToolUse(this.directory, this.descriptor.id, () => this.selected(), this.c.signal);
|
|
141
|
+
try {
|
|
142
|
+
return await action({ ...lease.value, ...lease.value.execution });
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
lease.release();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async selected() {
|
|
149
|
+
const selected = await this.receipt();
|
|
150
|
+
if (!selected || selected.uninstalledAt)
|
|
151
|
+
fail('configuration', 'Tool is not installed; run insight-cli ' + this.descriptor.id + ' install.');
|
|
152
|
+
await this.verify(selected);
|
|
153
|
+
return selected;
|
|
154
|
+
}
|
|
155
|
+
async doctor() {
|
|
156
|
+
return withToolLock(this.directory, this.descriptor.id, async () => {
|
|
157
|
+
const selected = await this.selected(), checks = await this.descriptor.probe(selected.execution ?? selected, this.c);
|
|
158
|
+
await atomicWrite(join(this.root, 'last-check.json'), { fingerprint: selected.fingerprint, checkedAt: new Date().toISOString(), checks });
|
|
159
|
+
return { tool: this.descriptor.id, state: 'verified', installation: selected.id, checks };
|
|
160
|
+
}, this.c.signal);
|
|
161
|
+
}
|
|
162
|
+
async uninstall(purgeCache = false) {
|
|
163
|
+
return withToolLock(this.directory, this.descriptor.id, async () => {
|
|
164
|
+
await assertUnused(this.directory, this.descriptor.id);
|
|
165
|
+
const selected = await this.receipt();
|
|
166
|
+
if (!selected)
|
|
167
|
+
fail('configuration', 'No selected tool installation exists.');
|
|
168
|
+
await removeInstallation(this.root, selected.id);
|
|
169
|
+
if (purgeCache)
|
|
170
|
+
for (const sha of Object.values(selected.components)) {
|
|
171
|
+
if (!/^[a-f0-9]{64}$/.test(sha))
|
|
172
|
+
fail('binding', 'Invalid component digest.');
|
|
173
|
+
for (const extension of ['zip', 'tgz'])
|
|
174
|
+
await rm(join(this.cache, sha + '.' + extension), { force: true });
|
|
175
|
+
}
|
|
176
|
+
await atomicWrite(join(this.root, 'selection.json'), { ...selected, uninstalledAt: new Date().toISOString() });
|
|
177
|
+
return { tool: this.descriptor.id, state: 'uninstalled', externalInstallationPreserved: selected.mode === 'external', researchPreserved: true, materialsPreserved: true };
|
|
178
|
+
}, this.c.signal);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The Windows java launcher uses ACP, while Java 21 javac reads UTF-8 @files. */
|
|
2
|
+
export declare function encodeJavaLauncherFile(value: string): Promise<Buffer>;
|
|
3
|
+
/** Java's quoted argument-file grammar (not JSON: it has no \u escapes). */
|
|
4
|
+
export declare function quoteJavaArgument(value: string): string;
|
|
5
|
+
/** Keep all other argv entries in place, including JVM flags and application arguments. */
|
|
6
|
+
export declare function javaClasspathArguments(root: string, tool: string, executable: string, args: string[], platform?: string): Promise<string[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join, win32 } from 'node:path';
|
|
3
|
+
import { execFile } from 'node:child_process';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
const exec = promisify(execFile);
|
|
6
|
+
/** The Windows java launcher uses ACP, while Java 21 javac reads UTF-8 @files. */
|
|
7
|
+
export async function encodeJavaLauncherFile(value) {
|
|
8
|
+
if (!/[^\x00-\x7f]/.test(value))
|
|
9
|
+
return Buffer.from(value, 'ascii');
|
|
10
|
+
// Fixed script; text travels over stdin, never through PowerShell's command parser.
|
|
11
|
+
// Match the native launcher without silently replacing unmappable path characters.
|
|
12
|
+
const script = '[Console]::InputEncoding=[Text.UTF8Encoding]::new($false,$true);$s=[Console]::In.ReadToEnd();$e=[Text.Encoding]::GetEncoding([Text.Encoding]::Default.CodePage,[Text.EncoderExceptionFallback]::new(),[Text.DecoderExceptionFallback]::new());[Console]::Out.Write([Convert]::ToBase64String($e.GetBytes($s)))';
|
|
13
|
+
const pending = exec(join(process.env.SystemRoot ?? 'C:\\Windows', 'System32/WindowsPowerShell/v1.0/powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: Math.max(4096, Buffer.byteLength(value) * 4) });
|
|
14
|
+
pending.child.stdin?.on('error', () => { });
|
|
15
|
+
pending.child.stdin?.end(value, 'utf8');
|
|
16
|
+
try {
|
|
17
|
+
return Buffer.from((await pending).stdout.trim(), 'base64');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
throw new Error('Java classpath cannot be encoded for the Windows launcher; no process was started. Inspect the retained run and the JDK system-code-page path restrictions.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Java's quoted argument-file grammar (not JSON: it has no \u escapes). */
|
|
24
|
+
export function quoteJavaArgument(value) {
|
|
25
|
+
if (value.includes('\0'))
|
|
26
|
+
throw new Error('Java argument contains NUL');
|
|
27
|
+
return '"' + value.replace(/[\\"\n\r\t\f]/g, c => ({ '\\': '\\\\', '"': '\\"', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\f': '\\f' }[c])) + '"';
|
|
28
|
+
}
|
|
29
|
+
/** Keep all other argv entries in place, including JVM flags and application arguments. */
|
|
30
|
+
export async function javaClasspathArguments(root, tool, executable, args, platform = process.platform) {
|
|
31
|
+
if (platform !== 'win32' || tool !== 'ghidra' || !/^(java|javac)\.exe$/i.test(win32.basename(executable)))
|
|
32
|
+
return args;
|
|
33
|
+
// Conservative upper bound for Windows quoting, with room below CreateProcess's 32767 limit.
|
|
34
|
+
if (executable.length * 2 + args.reduce((n, arg) => n + arg.length * 2 + 3, 3) <= 28000)
|
|
35
|
+
return args;
|
|
36
|
+
const index = args.findIndex(arg => arg === '-cp' || arg === '-classpath' || arg === '--class-path');
|
|
37
|
+
if (index < 0 || args[index + 1] === undefined)
|
|
38
|
+
return args;
|
|
39
|
+
const path = join(root, 'java-classpath.args');
|
|
40
|
+
const content = '-classpath\n' + quoteJavaArgument(args[index + 1]) + '\n';
|
|
41
|
+
const bytes = /^java\.exe$/i.test(win32.basename(executable)) && process.platform === 'win32' ? await encodeJavaLauncherFile(content) : Buffer.from(content, 'utf8');
|
|
42
|
+
await writeFile(path, bytes, { flag: 'wx', mode: 0o600 });
|
|
43
|
+
return [...args.slice(0, index), '@' + path, ...args.slice(index + 2)];
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Internal POSIX exec gate, not a daemon. The record exists before the requested executable runs. */
|
|
2
|
+
import { createReadStream } from 'node:fs';
|
|
3
|
+
import { realpath } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
|
+
import { atomicWrite, readJson } from './store.js';
|
|
7
|
+
import { processIdentity } from './identity.js';
|
|
8
|
+
async function main() {
|
|
9
|
+
const [directory, id, fd] = process.argv.slice(2);
|
|
10
|
+
if (!directory || !id || !/^[a-f0-9-]{36}$/.test(id))
|
|
11
|
+
throw Error('Invalid launch identity');
|
|
12
|
+
const root = await realpath(directory), path = join(root, 'runtime/processes', id + '.json');
|
|
13
|
+
const record = await readJson(path);
|
|
14
|
+
if (!record || record.id !== id || record.pid || record.ownerPid !== process.ppid)
|
|
15
|
+
throw Error('Launch owner changed');
|
|
16
|
+
let input = '';
|
|
17
|
+
for await (const b of createReadStream('', { fd: Number(fd), autoClose: true })) {
|
|
18
|
+
input += b.toString();
|
|
19
|
+
if (input.length > 4 * 1024 ** 2)
|
|
20
|
+
throw Error('Launch input exceeds its bound');
|
|
21
|
+
}
|
|
22
|
+
if (await realpath(String(record.root)) !== join(root, 'runtime/runs', id))
|
|
23
|
+
throw Error('Launch storage changed');
|
|
24
|
+
const plan = JSON.parse(input);
|
|
25
|
+
if (plan.executable !== record.executable)
|
|
26
|
+
throw Error('Launch executable changed');
|
|
27
|
+
const identity = await processIdentity(process.pid);
|
|
28
|
+
if (!identity)
|
|
29
|
+
throw Error('Launch process identity unavailable');
|
|
30
|
+
Object.assign(record, { pid: process.pid, identity: identity.birth, strongIdentity: identity.strong, processGroup: identity.group, phase: 'armed' });
|
|
31
|
+
await atomicWrite(path, record);
|
|
32
|
+
await atomicWrite(join(String(record.root), 'armed.json'), { pid: process.pid, nonce: plan.nonce });
|
|
33
|
+
for (let i = 0; i < 400; i++) {
|
|
34
|
+
const grant = await readJson(join(String(record.root), 'go.json'));
|
|
35
|
+
if (grant?.nonce === plan.nonce) {
|
|
36
|
+
try {
|
|
37
|
+
process.execve(plan.executable, [plan.executable, ...plan.arguments], plan.environment);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
Object.assign(record, { state: 'failed', phase: 'exec_failed', launchError: error.code ?? 'exec', endedAt: new Date().toISOString() });
|
|
41
|
+
await atomicWrite(path, record);
|
|
42
|
+
throw Error('Owned executable could not start');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
process.kill(Number(record.ownerPid), 0);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
Object.assign(record, { state: 'failed', phase: 'owner_lost_before_exec' });
|
|
50
|
+
await atomicWrite(path, record);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
await delay(25);
|
|
54
|
+
}
|
|
55
|
+
Object.assign(record, { state: 'failed', phase: 'launch_grant_timeout' });
|
|
56
|
+
await atomicWrite(path, record);
|
|
57
|
+
}
|
|
58
|
+
await main().catch(() => { process.stderr.write('Owned tool launch gate failed.\n'); process.exitCode = 1; });
|