Skip to content

Commit 7578beb

Browse files
committed
arch: extract reusable logic from Ghidra
1 parent 0a10b4f commit 7578beb

6 files changed

Lines changed: 501 additions & 359 deletions

File tree

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ extend-ignore = E203, E501, W503
55
# Exclude Ghidra Jython scripts - they use Ghidra's runtime globals
66
# (currentProgram, getScriptArgs, etc.) which are injected at runtime
77
exclude =
8-
ghidra_decompile.py,
8+
ghidra_decompile_lib.py,
99
ghidra_decompile_elf.py,
10+
ghidra_common.py,
1011
__pycache__,
1112
.git,
1213
*.pyc

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LibSurgeon is a powerful automated tool that performs surgical extraction of C/C
3434

3535
```bash
3636
# Clone the repository
37-
git clone https://github.com/YOUR_USERNAME/LibSurgeon.git
37+
git clone https://github.com/FASTSHIFT/LibSurgeon.git
3838
cd LibSurgeon
3939

4040
# Install Python dependencies (optional, for development)
@@ -89,15 +89,6 @@ Options:
8989
-c, --clean Clean previous output before processing
9090
```
9191

92-
### `batch_decompile.py` - Batch Decompilation
93-
94-
Standalone batch decompiler for object files.
95-
96-
```bash
97-
python batch_decompile.py -g /path/to/ghidra -i input.a -o output/
98-
python batch_decompile.py -g /path/to/ghidra -i extracted_dir/ -o output/ -j 4
99-
```
100-
10192
### `evaluate_quality.py` - Quality Assessment
10293

10394
Analyze decompilation quality with detailed metrics.
@@ -108,6 +99,16 @@ python evaluate_quality.py ./output/ --verbose
10899
python evaluate_quality.py ./output/ --json report.json
109100
```
110101

102+
### Ghidra Scripts
103+
104+
LibSurgeon uses specialized Ghidra headless scripts:
105+
106+
| Script | Purpose |
107+
|--------|---------|
108+
| `ghidra_common.py` | Shared utilities (type mapping, demangling, code enhancement) |
109+
| `ghidra_decompile_lib.py` | Decompiles `.o` files from static libraries |
110+
| `ghidra_decompile_elf.py` | Decompiles ELF binaries with module grouping and C++ analysis |
111+
111112
**Quality Metrics:**
112113
- `halt_baddata`: Ghidra analysis failures (critical)
113114
- `undefined types`: Generic type placeholders

0 commit comments

Comments
 (0)