diff options
Diffstat (limited to 'tools/ghidra/gsp-fwimage-570.144/scripts/MemCheck.java')
| -rw-r--r-- | tools/ghidra/gsp-fwimage-570.144/scripts/MemCheck.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/ghidra/gsp-fwimage-570.144/scripts/MemCheck.java b/tools/ghidra/gsp-fwimage-570.144/scripts/MemCheck.java new file mode 100644 index 0000000..6cb573e --- /dev/null +++ b/tools/ghidra/gsp-fwimage-570.144/scripts/MemCheck.java @@ -0,0 +1,26 @@ +import ghidra.app.script.GhidraScript; +import ghidra.program.model.address.Address; +import ghidra.program.model.listing.Instruction; +import ghidra.program.model.listing.Listing; +import ghidra.program.model.mem.Memory; + +public class MemCheck extends GhidraScript { + @Override + protected void run() throws Exception { + String[] args = getScriptArgs(); + Memory mem = currentProgram.getMemory(); + println("min=" + mem.getMinAddress() + " max=" + mem.getMaxAddress()); + for (String arg : args) { + Address a = toAddr(arg.trim()); + boolean c = mem.contains(a); + println(arg + " contains=" + c); + if (c) { + byte[] b = new byte[16]; + int n = mem.getBytes(a, b); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < n; i++) sb.append(String.format("%02x ", b[i])); + println(" bytes: " + sb); + } + } + } +} |
