Recover and compare code
glaurung export
Export a project as Markdown, JSON, a C header, a bundle, or an import script.
use it for
JSON is round-trippable. IDA, Ghidra, and Binary Ninja formats emit scripts for those tools. Bundles can include pseudocode when --bodies and --binary are supplied.
Run glaurung export --help on your installed version before putting the command in a script.
Glaurung is still pre-1.0.
- input
- A .glaurung project. Some formats also need the original binary.
- output
- JSON, Markdown, a C header, an IDA/Ghidra/Binary Ninja import script, or a whole-binary bundle.
- mode
- read only. The examples leave the input unchanged.
command shape
syntax
$ glaurung export PROJECT --output-format FORMAT
The installed parser is authoritative: glaurung export --help
before the examples
project setup
The examples use the checked-in hello-c-clang-debug fixture and a
project named hello.glaurung.
$ glaurung kickoff samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug --db hello.glaurung run it
examples
Write an analyst-readable report
Markdown keeps names, types, comments, labels, and stack slots in a reviewable file.
run
$ glaurung export hello.glaurung --output-format markdown > hello.md output
# Glaurung KB export
- function_names: **16**
- prototypes: **114**
- comments: **0**
- data_labels: **0**
- stack_vars: **66**
- types: **56**
## Functions (first 32)
| entry | name | set_by |
|---|---|---|
| 0x1150 | main | analyzer |
| 0x11d0 | print_sum | analyzer | captured export, shortened.
Read the result: Markdown is for review. Use JSON when another program must preserve every field and schema version.
Generate a Ghidra import script
The script applies project names and annotations inside an existing Ghidra project.
run
$ glaurung export hello.glaurung --output-format ghidra > import_ghidra.py output
# Glaurung → Ghidra export (#190)
# Run via Window > Script Manager. Targets the active program.
# @category Glaurung
# @runtime Jython
from ghidra.program.model.symbol import SourceType first lines of the generated import script.
Read the result: Run this inside Ghidra's Script Manager, not as ordinary CPython. Review the active program and the generated changes before saving the Ghidra project.
used above
important options
These are the flags used by the examples. Run glaurung export --help for the complete parser help.
keep working