Skip to content

Instantly share code, notes, and snippets.

@aaronpuchert
Last active October 4, 2025 22:20
Show Gist options
  • Save aaronpuchert/e472a58572786c7391aa7c8b3c6e34df to your computer and use it in GitHub Desktop.
Save aaronpuchert/e472a58572786c7391aa7c8b3c6e34df to your computer and use it in GitHub Desktop.
Disassembly helpers
alias diff="diff -u --color=always"
disas() {
objdump --disassemble --no-show-raw-insn --visualize-jumps=color --disassembler-color=color $@ | less
}
disas-fn() {
SYMBOL=$1
shift
objdump --disassemble=$SYMBOL --no-show-raw-insn --visualize-jumps=color --disassembler-color=color $@ | less
}
disas-strip() {
objdump --disassemble --no-addresses --no-show-raw-insn --disassembler-color=color $@ | strip-hex-from-disas
}
disas-diff() {
diff --show-function-line="^<" <(disas-strip $1) <(disas-strip $2) | less
}
#!/usr/bin/sed -f
# Eliminate nop padding
/nop[lw]/d
# Strip control characters from the middle of hex literals.
s/0x\x1b\[0m\x1b\[35m/0x/g
# Obfuscate hex literals.
s/0x[0-9a-f]*/0x[HEX]/g
s/[0-9a-f]* </[HEX] </g
# Obfuscate ThinLTO hashes.
s/llvm\.[0-9]*/llvm.[HASH]/g
# Obfuscate register choices.
s/%rsp/%sp/g
s/%r[[:alnum:]]*/%r/g
s/%e[[:alnum:]]*/%e/g
s/%[[:alpha:]]*l/%l/g
s/%xmm[0-9]*/%xmm/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment