Last active
January 3, 2016 19:59
-
-
Save staticshock/8511868 to your computer and use it in GitHub Desktop.
UCTF bookmarklets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bind F7 to 'step' | |
javascript:$(document).bind('keydown', function(e) { e.which == 118 && parse('s'); }); void(0) | |
// Add a 'readhex' command that works just like 'read' but dumps nothing but the hex | |
javascript:cpu._readhex = | |
function(e) { | |
if (!e[1]) return write(" Please give an expression to read the memory at."), void 0; | |
var t = cpu.to_addr(e[1]); | |
cpu.get("/cpu/dbg/memory/" + t + "?len=" + (parseInt(e[2], 16) + (15 - parseInt(e[2], 16) & 15) || 32), function(e) { | |
for (var n = atob(e.raw), i = "", o = " ", s = 0; s < n.length; s++) s % 2 == 0 && (o += " "), o += pad(n.charCodeAt(s).toString(16), 2), s % 8 == 7 && (i += " " + o + "\n", o = " "); | |
write(i); | |
}) | |
}; void(0) | |
// Add a 'disassemble' command that takes the same arguments as read/readhex | |
// and disassembles the instructions starting at that address | |
javascript:cpu._disassemble = | |
function(e) { | |
if (!e[1]) return write(" Please give an expression to read the memory at."), void 0; | |
var t = cpu.to_addr(e[1]); | |
cpu.get("/cpu/dbg/memory/" + t + "?len=" + (parseInt(e[2], 16) + (15 - parseInt(e[2], 16) & 15) || 32), function(e) { | |
for (var n = atob(e.raw), i = "", o = "", s = 0; s < n.length; s++) s % 2 == 0 && (o += ""), o += pad(n.charCodeAt(s).toString(16), 2), s % 8 == 7 && (i += o, o = ""); | |
cpu.get("/cpu/dbg/disasm?obj=" + i, function(e) { | |
write(e.error ? "ERROR: " + e.error : e.data.insns.join("\n")); | |
}, 1) | |
}) | |
}; void(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment