29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
// GhidraScript: FindAddressRefs.java
|
|
// Usage: ... -postScript FindAddressRefs.java 0x401000 [...]
|
|
|
|
import ghidra.app.script.GhidraScript;
|
|
import ghidra.program.model.address.Address;
|
|
import ghidra.program.model.listing.Function;
|
|
import ghidra.program.model.symbol.Reference;
|
|
|
|
public class FindAddressRefs extends GhidraScript {
|
|
@Override
|
|
public void run() throws Exception {
|
|
for (String arg : getScriptArgs()) {
|
|
Address target = toAddr(Long.decode(arg));
|
|
println("================================================================================");
|
|
println("target: " + target);
|
|
Reference[] refs = getReferencesTo(target);
|
|
println("refs: " + refs.length);
|
|
for (Reference ref : refs) {
|
|
Address from = ref.getFromAddress();
|
|
Function function = getFunctionContaining(from);
|
|
println(" " + from + " -> " +
|
|
(function == null ? "(no function)" :
|
|
function.getName() + " @ " + function.getEntryPoint()) +
|
|
" type=" + ref.getReferenceType());
|
|
}
|
|
}
|
|
}
|
|
}
|