19 lines
732 B
Java
19 lines
732 B
Java
import ghidra.app.script.GhidraScript;
|
|
import ghidra.app.decompiler.*;
|
|
import ghidra.program.model.listing.*;
|
|
import java.io.*;
|
|
public class DumpAll extends GhidraScript {
|
|
public void run() throws Exception {
|
|
DecompInterface d = new DecompInterface();
|
|
d.openProgram(currentProgram);
|
|
PrintWriter w = new PrintWriter(new FileWriter(getScriptArgs()[0]));
|
|
for (Function f : currentProgram.getFunctionManager().getFunctions(true)) {
|
|
DecompileResults r = d.decompileFunction(f, 60, monitor);
|
|
w.println("// ==== " + f.getName() + " @ " + f.getEntryPoint());
|
|
if (r.decompileCompleted()) w.println(r.getDecompiledFunction().getC());
|
|
else w.println("// decompile failed");
|
|
}
|
|
w.close();
|
|
}
|
|
}
|