diff --git a/pwndbg/color/syntax_highlight.py b/pwndbg/color/syntax_highlight.py index 0156b2b43..f5cd7dbf7 100644 --- a/pwndbg/color/syntax_highlight.py +++ b/pwndbg/color/syntax_highlight.py @@ -33,7 +33,7 @@ def check_style(): style.value = style.default -def syntax_highlight(code, filename): +def syntax_highlight(code, filename='.asm'): # No syntax highlight if pygment is not installed if not pygments: return code diff --git a/pwndbg/enhance.py b/pwndbg/enhance.py index c554659ec..77ea14e34 100644 --- a/pwndbg/enhance.py +++ b/pwndbg/enhance.py @@ -20,12 +20,14 @@ import gdb import pwndbg.arch import pwndbg.color as color import pwndbg.color.enhance as E +import pwndbg.config import pwndbg.disasm import pwndbg.memoize import pwndbg.memory import pwndbg.strings import pwndbg.symbol import pwndbg.typeinfo +from pwndbg.color.syntax_highlight import syntax_highlight bad_instrs = [ '.byte', @@ -100,6 +102,8 @@ def enhance(value, code = True): instr = pwndbg.disasm.one(value) if instr: instr = "%-6s %s" % (instr.mnemonic, instr.op_str) + if pwndbg.config.syntax_highlight: + instr = syntax_highlight(instr) szval = pwndbg.strings.get(value) or None szval0 = szval