Initial public source release
Split reusable rendering and format support into vectorail-core and vectorail-gc.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// GhidraScript: dump an array of 32-bit pointers as ASCII strings.
|
||||
// Usage: DumpPointerStrings.java <address> [count]
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
|
||||
public class DumpPointerStrings extends GhidraScript {
|
||||
private String readAscii(Address at) throws MemoryAccessException {
|
||||
StringBuilder out = new StringBuilder();
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
int value = getByte(at.add(i)) & 0xff;
|
||||
if (value == 0) break;
|
||||
if (value < 0x20 || value > 0x7e) return "<non-ascii>";
|
||||
out.append((char)value);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
String[] args = getScriptArgs();
|
||||
if (args == null || args.length == 0) {
|
||||
printerr("DumpPointerStrings: needs address and optional count");
|
||||
return;
|
||||
}
|
||||
Address start = toAddr(Long.decode(args[0]));
|
||||
int count = args.length > 1 ? Integer.decode(args[1]) : 32;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
Address slot = start.add(i * 4L);
|
||||
long raw = getInt(slot) & 0xffffffffL;
|
||||
Address target = toAddr(raw);
|
||||
String value;
|
||||
try {
|
||||
value = currentProgram.getMemory().contains(target) ? readAscii(target) : "<outside>";
|
||||
} catch (Exception exc) {
|
||||
value = "<invalid>";
|
||||
}
|
||||
println(String.format("%4d %s -> %08x %s", i, slot, raw, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user