blob: 6cb573e241f1023b9f447f35a6f9bcbe2177ecd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}
}
}
}
|