39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
// Script to regenerate all dumped stub functions
|
|
// @category _Reman3
|
|
// @menupath Reman3.Redump Stub Functions
|
|
// @importpackage org.sqlite
|
|
|
|
import java.util.List;
|
|
|
|
import ghidra.app.script.GhidraScript;
|
|
import ghidra.program.model.listing.Function;
|
|
import re3lib.GlobalDumper;
|
|
import re3lib.RemanConfig;
|
|
import re3lib.TypeDumper;
|
|
import re3lib.FunctionDatabase;
|
|
import re3lib.FunctionDumper;
|
|
|
|
public class RedumpStubFunctions extends GhidraScript {
|
|
@Override
|
|
protected void run() throws Exception {
|
|
RemanConfig.INSTANCE = new RemanConfig(this);
|
|
RemanConfig.INSTANCE.createDirectories();
|
|
|
|
try (FunctionDatabase functionDatabase = new FunctionDatabase(this)) {
|
|
List<FunctionDatabase.FunctionEntry> entries = functionDatabase.loadAllEntries();
|
|
FunctionDumper dumper = new FunctionDumper(this, functionDatabase, null);
|
|
for (FunctionDatabase.FunctionEntry entry : entries) {
|
|
if (entry.type == FunctionDatabase.Type.Stub) {
|
|
Function function = getFunctionAt(entry.address);
|
|
if (function == null) {
|
|
printerr("Function not found at address: " + entry.address);
|
|
continue;
|
|
}
|
|
// println("Dumping stub function: " + function.getName());
|
|
dumper.dumpStubFunction(function, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|