mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
18 lines
668 B
JavaScript
18 lines
668 B
JavaScript
function monitorMemory(base, length, interceptedInstructions = new Set()) {
|
|
const baseAddress = ptr(base.toString());
|
|
MemoryAccessMonitor.enable({ base: baseAddress, size: length }, {
|
|
onAccess: function(details) {
|
|
console.log(details.from + " " + details.operation + " " + details.address);
|
|
let instruction = Instruction.parse(details.from);
|
|
const nextInstr = ptr(instruction.next.toString());
|
|
if (interceptedInstructions.has(nextInstr.toString())) {
|
|
return;
|
|
}
|
|
interceptedInstructions.add(nextInstr.toString());
|
|
Interceptor.attach(nextInstr, function(_) {
|
|
monitorMemory(baseAddress, length, inteceptedInstructions);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|