Skip to content

Ghidra

15 commands

The NSA’s open-source reverse-engineering suite with a powerful decompiler; scriptable headless analysis from the command line.

  • decompiler
  • reverse engineering
  • malware analysis

Install Ghidra

brew install --cask ghidra

Running4

ghidraRun

Starts the Ghidra GUI (ghidraRun.bat on Windows). Requires a supported JDK (21 for current releases).

Link
<ghidra>/support/analyzeHeadless <project_dir> <project> -import <binary>

Headless mode: creates a project, imports a binary and runs auto-analysis without the GUI.

Link
analyzeHeadless <project_dir> <project> -import <dir> -recursive

Imports and analyses every file under a directory.

Link
analyzeHeadless <project_dir> <project> -process <file> -noanalysis

Opens an existing program in a project without reanalysing it.

Link

Scripting5

analyzeHeadless <project_dir> <project> -import <binary> -postScript <script>

Runs a script after analysis — useful for batch decompilation or IOC extraction.

Link
analyzeHeadless … -scriptPath <dir>

Adds a directory of your own scripts.

Link
analyzeHeadless … -deleteProject

Removes the temporary project afterwards.

Link
analyzeHeadless … -processor <lang>

Forces a processor for raw firmware with no headers.

Link
analyzeHeadless … -log <file> -scriptlog <file>

Writes analysis and script logs to files.

Link

GUI shortcuts6

G

Go to an address or label.

Link
L

Rename the selected function, variable or label.

Link
Ctrl-L

Retype a variable in the decompiler.

Link
Ctrl-Shift-F

Find references to the selected item.

Link
Search → For Strings

Lists defined and undefined strings, a quick way to find interesting code.

Link
Window → Function Graph

Shows the control-flow graph of the current function.

Link