DSH-Ghidra: A bridge plugin in DSH leveraging Ghidra as a tool

Preface

When doing reverse engineering or malicious sample analysis in DeepSeek Harness (DSH), a common practice is: open a local Ghidra GUI, then manually paste decompiled snippets and function lists back into the conversation. The Agent lacks a unified “open binary → analyze → check xref → modify comments and persist” workflow, and it is also hard to align with GhidraMCP’s REST capabilities.

dsh-ghidra (maintainer spix18) is DSH’s Ghidra bridge client plugin: it registers capabilities such as importing, analyzing, decompiling, reading/writing Ghidra projects, composite analysis, and malicious code triage as DSH tools, callable from any workspace project. The plugin is published on npm as dsh-ghidra, current package version is 0.11.4 (MIT License); community directory at SkillHub plugin page, source code and documentation at GitHub repo.

What This Is

In one sentence: a complete reverse engineering workbench for DSH (and the Agents running inside it). At the bottom layer it launches Ghidra headless via PyGhidra, and maintains a persistent bridge via JSON-RPC; default single-JVM unified mode (mcpMode=unified), where upstream GhidraMCP REST and native PyGhidra tools bind to the same already-open program, avoiding state inconsistency between two sessions.

Ghidra 12’s headless Java script path is affected by a known upstream issue (README references NSA/ghidra#9551); this plugin therefore uses PyGhidra’s official Python interface: the plugin spawns pyghidra_launcher.py, communicating with a persistent server on local 127.0.0.1; ghidra_open may take several minutes for the first import and full analysis (background tasks can stream progress), after which most operations return in milliseconds.

Core Features

Capabilities verifiable in the documentation are as follows (total of 219 tools: 48 native + 3 lifecycle-related + 168 ghidra_mcp_* tools generated from the upstream GhidraMCP REST schema; also includes the cross-platform ghidra_doctor).

Read Side and Decompilation

  • Import and analyze binaries, decompile functions (ghidra_decompile)
  • List functions, strings, segments, imports/exports (ghidra_functions, ghidra_strings, ghidra_segments, ghidra_imports, ghidra_exports)
  • Cross-references, disassembly, read memory, variables and pcode (ghidra_xrefs, ghidra_disassemble, ghidra_read_memory, ghidra_variables, ghidra_pcode)
  • Regex search strings/functions, call relationships and BFS call graphs (ghidra_search_strings, ghidra_search_functions, ghidra_calls, ghidra_call_graph)

Write Side and Persistence

Supports renaming, comments, tags, function prototypes, local variables, creating/deleting functions, etc., and performs flush via ghidra_save (graceful bridge stop → write to disk → restart). README emphasizes: headless only writes the project back when the script ends normally; stopping the bridge must send {op:'shutdown'} for graceful exit; hard kill will cause unsaved analysis/changes to be lost.

Analysis and Automation

Run Ghidra scripts inline or from file, list/configure analyzers, reanalyze, search byte patterns, find code caves and dead code, etc. (e.g., ghidra_run_script_inline, ghidra_run_analysis, ghidra_search_byte_patterns).

Composite Analysis and Malicious Code

  • Composite: ghidra_function_context, ghidra_search_instructions, ghidra_hash, ghidra_compare_functions, ghidra_data_flow, etc.
  • Malicious code: ghidra_detect_crypto_constants, ghidra_detect_malware_behaviors, ghidra_extract_iocs_with_context, ghidra_find_anti_analysis_techniques, etc. (specific signatures and categories are subject to the table in the README)

Environment and Settings

  • ghidra_doctor: read-only self-check, does not start Ghidra; checks platform, Ghidra installation and version, headless launcher, PyGhidra/Python/Java, user directory, extension jars, path ASCII, project directory writability, ports, etc.; failed items include remediation hints
  • Settings → Ghidra: status, Run doctor, Download Ghidra, optionally specify an existing Ghidra installation directory, 12 hot-reloadable configuration items (no DSH restart needed when changing configuration)
  • Self-contained data directory: Ghidra installation, project cache, logs, etc. under <DSH_HOME>\profiles\<profile>\node_modules\dsh-ghidra-home\
  • On-demand tool exposure: when the bridge and REST are not ready, only 6 entry tools are advertised, and the reason for hidden groups is explained; ghidra_open / ghidra_mcp_start can bring up the remaining tools within the same session
  • Registers skills/dsh-ghidra/SKILL.md at load time, helping the Agent determine when to use this plugin

Installation and Activation

Environment requirements (from README): Windows / Linux / macOS; Ghidra 12.x; Python 3.13 with pyghidra installed; Node ≥ 20; DSH ≥ 0.2. If unsure about the environment, run ghidra_doctor first or click Run doctor in the settings page.

The following three steps are the standard installation flow given in the README (installation commands as-is below; do not rewrite them into github:owner/repo form):

# 1. install the plugin into your DSH profile
dsh plugin --profile web add dsh-ghidra

# 2. restart DSH  (browser-half changes need a restart)
# 3. open  Settings → Ghidra  in the sidebar, then press  "Download Ghidra"
#    → fetches the latest Ghidra release into the plugin's own data dir and configures it for you

After the above steps, the plugin will fetch Ghidra into the plugin’s own data directory and complete the configuration. If you already have Ghidra on this machine, you can use Browse in Settings → Ghidra → Ghidra install directory (optional) to point to the installation directory, skipping the download.

On Linux / macOS, doctor handles the Ghidra user directory, headless launcher, and process tools; see LINUX-PORT.md in the repo for details.

Typical Usage

After installation and Download Ghidra complete, just have the Agent open the sample in DSH. README examples:

  • Tell the Agent: use ghidra_open <path-to-binary> to open the binary and start working

Common session tools also include:

  • ghidra_status / ghidra_info: check status and program info
  • ghidra_save: flush in-memory changes such as renames and comments to disk
  • ghidra_close: close the current session
  • When the GhidraMCP REST surface is needed: ghidra_mcp_start (can take a file for automatic import and analysis), ghidra_mcp_stop, ghidra_mcp_status

When there is no GUI, a load check can be performed (paths vary with the profile):

node <profile>/node_modules/dsh-ghidra/verify-load.mjs <profile>/node_modules/dsh-ghidra

Use Cases and Notes

For whom: Those doing binary reverse engineering, vulnerability analysis, and sample triage in DSH, who want the Agent to call Ghidra directly instead of repeatedly exporting manually; also developers who need to align with GhidraMCP REST capabilities and want a default single-JVM unified session.

Permissions and Security: The plugin runs with the user privileges of the current DSH process, and will read/write local binaries, Ghidra project directories, and plugin data directories. Before installation, you should read the source code and LICENSE, and only handle samples you have the right to analyze.

Ecosystem Note: DSH adopts “everything is a plugin”; community directories like SkillHub are independent sites with no official affiliation with DeepSeek / High-Flyer. This article introduces the capabilities and installation method of the community plugin itself, not an official app store listing.

Cross-platform: README states support for Windows, Linux, macOS; when encountering environment issues, prioritize ghidra_doctor, and avoid guessing changes to JAVA_HOME or paths.

Conclusion

dsh-ghidra bundles Ghidra 12 + PyGhidra + GhidraMCP REST into a single package of tools within DSH: with built-in download/directory selection/Doctor, 219 reverse engineering-related entry points, and clear semantics for write-side persistence. To set up the environment from scratch, follow the three-step installation in the README and Download Ghidra in the settings; if you already have Ghidra, just point to the installation directory.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye