Skip to content

Instantly share code, notes, and snippets.

Created Jan 25, 2014
What would you like to do?
Javascript snippet for comments in the Matasano/Square CTF disassembler
Running this javascript snippet on
will allow you to add comments to the Disassembly window. It also backs up
every 10 seconds to local storage and will restore if a backup exists when
first run.
Needs to be run manually on pageload (paste into chrome console) and doesn't
preserve existing breakpoint highlights (so do it before setting them).
Will also wipe out the current PC highlight but this will return next step.
I found it particularly helpful for Chernobyl.
- @Sebbity
var a = document.getElementById('asmbox');
a.onkeydown = function(e) {
if (e.keyCode == 9) {
var range,sel = window.getSelection();
if (sel.rangeCount) {
range = sel.getRangeAt(0);
cpu.get("/whoami", function(t) {
var level = t.level;
var asmBackup = level + '_backup_asmbox';
if (localStorage[asmBackup]) {
a.innerHTML = localStorage[asmBackup];
window.setInterval(function() {
var asm = document.getElementById('asmbox').cloneNode(true);
var instructions = asm.getElementsByClassName('insn');
for (i in instructions) {
if (instructions[i] && instructions[i].removeAttribute) {
localStorage[asmBackup] = asm.innerHTML;
}, 10 * 1000);
Copy link

frumpel commented Feb 5, 2014

Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment