Ghidra 12.1.2 headless decompilation of Steam client version 1788652215: - decomp/linux64_steamclient.so, ubuntu12_32_steamclient.so, ubuntu12_32_steam: per-class pseudo-C (RTTI class recovery + Class::Method string naming), functions.tsv and strings.tsv - decomp/protos: 107 .proto files and descriptors.pb extracted from steamclient.so - decomp/steamui: prettified Library UI JS; steamclient_js_api.txt lists the SteamClient.* backend API it calls - tools/: decompile/recover/export scripts and proto extractor GCC exception-handler analysis is disabled: it truncated ~47% of function bodies on these binaries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
25 lines
1.1 KiB
Bash
Executable File
25 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Headless Ghidra analysis, C++ class/name recovery, and pseudo-C export.
|
|
# Usage: tools/decompile.sh <binary> [<binary>...]
|
|
# Output: decomp/<dir>_<binary>/{src/*.c,functions.tsv,strings.tsv}
|
|
# Resource knobs: see tools/ghidra-env.sh.
|
|
set -euo pipefail
|
|
source "$(dirname "$0")/ghidra-env.sh"
|
|
# Ghidra's GCC exception analyzer misparses steamclient.so's LSDA tables and
|
|
# truncates function bodies (half of all functions decompiled empty).
|
|
ANALYSIS_OPTS="${ANALYSIS_OPTS:-GCC Exception Handlers=false}"
|
|
mkdir -p "$ROOT/ghidra_projects" "$ROOT/decomp/logs"
|
|
for bin in "$@"; do
|
|
name="$(basename "$(dirname "$bin")")_$(basename "$bin")"
|
|
run_headless "$ROOT/ghidra_projects" "$name" \
|
|
-import "$bin" -overwrite \
|
|
-scriptPath "$ROOT/tools/ghidra" \
|
|
-preScript SetAnalysisOptions.java "$ANALYSIS_OPTS" \
|
|
-postScript RecoverClassesFromRTTIScript.java \
|
|
-postScript RecoverNamesFromStrings.java \
|
|
-postScript ExportDecompiled.java "$ROOT/decomp" \
|
|
-analysisTimeoutPerFile 86400 \
|
|
-log "$ROOT/decomp/logs/$name.log" \
|
|
-scriptlog "$ROOT/decomp/logs/$name.script.log"
|
|
done
|