forked from tsuki/openroller
29 lines
1.2 KiB
Java
29 lines
1.2 KiB
Java
// GhidraScript: list functions whose entry points fall inside an address range.
|
|
// Usage: ListFunctionsRange.java 0x005b6700 0x005b8600
|
|
|
|
import ghidra.app.script.GhidraScript;
|
|
import ghidra.program.model.address.Address;
|
|
import ghidra.program.model.listing.Function;
|
|
import ghidra.program.model.listing.FunctionIterator;
|
|
|
|
public class ListFunctionsRange extends GhidraScript {
|
|
@Override
|
|
public void run() throws Exception {
|
|
String[] args = getScriptArgs();
|
|
if (args == null || args.length != 2) {
|
|
printerr("ListFunctionsRange: needs minAddr maxAddr");
|
|
return;
|
|
}
|
|
Address min = toAddr(Long.decode(args[0]));
|
|
Address max = toAddr(Long.decode(args[1]));
|
|
FunctionIterator it = currentProgram.getFunctionManager().getFunctions(min, true);
|
|
while (it.hasNext() && !monitor.isCancelled()) {
|
|
Function function = it.next();
|
|
Address entry = function.getEntryPoint();
|
|
if (entry.compareTo(max) > 0) break;
|
|
println(entry + " " + function.getName() + " size=0x" +
|
|
Long.toHexString(function.getBody().getNumAddresses()));
|
|
}
|
|
}
|
|
}
|