Annotations & fix DumpCurrentFunctionRecursive script
This commit is contained in:
parent
836c856258
commit
4dc6fb2176
|
@ -1,6 +1,7 @@
|
||||||
// Decompile selected function recursively (until a given number of new functions is reached)
|
// Decompile selected function recursively (until a given number of new functions is reached)
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Dump N Functions
|
// @menupath Reman3.Dump N Functions
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -50,7 +51,6 @@ public class DumpCurrentFunctionN extends GhidraScript {
|
||||||
try (FunctionDatabase functionDatabase = new FunctionDatabase(this)) {
|
try (FunctionDatabase functionDatabase = new FunctionDatabase(this)) {
|
||||||
|
|
||||||
GlobalDumper globalDumper = new GlobalDumper(this, functionDatabase);
|
GlobalDumper globalDumper = new GlobalDumper(this, functionDatabase);
|
||||||
globalDumper.loadGlobalManifest();
|
|
||||||
|
|
||||||
FunctionDumper functionDumper = new FunctionDumper(this, functionDatabase, globalDumper);
|
FunctionDumper functionDumper = new FunctionDumper(this, functionDatabase, globalDumper);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Decompile selected function recursively
|
// Decompile selected function recursively
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Dump Current Function (recursive)
|
// @menupath Reman3.Dump Current Function (recursive)
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,13 +33,24 @@ public class DumpCurrentFunctionRecursive extends GhidraScript {
|
||||||
List<Function> functionsToDump = new ArrayList<>();
|
List<Function> functionsToDump = new ArrayList<>();
|
||||||
List<Function> functionsToDumpNew = new ArrayList<>();
|
List<Function> functionsToDumpNew = new ArrayList<>();
|
||||||
for (Function func : tracer.out) {
|
for (Function func : tracer.out) {
|
||||||
if (FunctionDumper.isDumpedFix(func))
|
List<FunctionDatabase.FunctionEntry> entries = functionDatabase.findEntriesByAddress(func.getEntryPoint());
|
||||||
|
boolean shouldDump = true;
|
||||||
|
boolean isNew = true;
|
||||||
|
for (FunctionDatabase.FunctionEntry entry : entries) {
|
||||||
|
if (entry.type == FunctionDatabase.Type.Fix) {
|
||||||
|
shouldDump = false;
|
||||||
|
}
|
||||||
|
if (entry.type == FunctionDatabase.Type.Fix || entry.type == FunctionDatabase.Type.Auto) {
|
||||||
|
isNew = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!shouldDump)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
println("Dump: " + func.getName());
|
println("Dump: " + func.getName());
|
||||||
functionsToDump.add(func);
|
functionsToDump.add(func);
|
||||||
|
|
||||||
if (!FunctionDumper.isDumpedAuto(func))
|
if (isNew)
|
||||||
functionsToDumpNew.add(func);
|
functionsToDumpNew.add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Script to refresh all custom globals & types from Ghidra
|
// Script to refresh all custom globals & types from Ghidra
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Redump Globals and Types
|
// @menupath Reman3.Redump Globals and Types
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import re3lib.GlobalDumper;
|
import re3lib.GlobalDumper;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Script to dump all custom types from Ghidra
|
// Script to dump all custom types from Ghidra
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Dump Types
|
// @menupath Reman3.Dump Types
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Script to find hardcoded addresses in the binary that need to be relocated
|
// Script to find hardcoded addresses in the binary that need to be relocated
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Find and dump Relocations
|
// @menupath Reman3.Find and dump Relocations
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Script to regenerate all dumped stub functions
|
// Script to regenerate all dumped stub functions
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Redump Stub Functions
|
// @menupath Reman3.Redump Stub Functions
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Script to sanitize global symbols in Ghidra
|
// Script to sanitize global symbols in Ghidra
|
||||||
// @category _Reman3
|
// @category _Reman3
|
||||||
// @menupath Reman3.Sanitize Global Symbols
|
// @menupath Reman3.Sanitize Global Symbols
|
||||||
|
// @importpackage org.sqlite
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import re3lib.GlobalDumper;
|
import re3lib.GlobalDumper;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class RemanConfig {
|
||||||
|
|
||||||
this.script = script;
|
this.script = script;
|
||||||
|
|
||||||
rootDir = new File(script.getSourceFile().getAbsolutePath()).getParentFile().getParentFile().getParentFile().toString();
|
rootDir = new File(script.getSourceFile().getAbsolutePath()).getParentFile().getParentFile().toString();
|
||||||
outputDir = new File(rootDir, RECOMPILE_PREFIX).toString();
|
outputDir = new File(rootDir, RECOMPILE_PREFIX).toString();
|
||||||
script.println("Output path: " + outputDir);
|
script.println("Output path: " + outputDir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue