Skip to content

Commit

Permalink
Fix punctuation in disassemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk committed Jan 31, 2019
1 parent 3ecd151 commit 9609374
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions pwnlib/asm.py
Expand Up @@ -36,7 +36,7 @@
To disassemble code, simply invoke :func:`disasm` on the bytes to disassemble.
>>> disasm('\xb8\x0b\x00\x00\x00')
' 0: b8 0b 00 00 00 mov eax,0xb'
' 0: b8 0b 00 00 00 mov eax, 0xb'
"""
from __future__ import absolute_import
Expand Down Expand Up @@ -737,15 +737,15 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
Examples:
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386')
0: b8 5d 00 00 00 mov eax,0x5d
0: b8 5d 00 00 00 mov eax, 0x5d
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0)
0: mov eax,0x5d
0: mov eax, 0x5d
>>> print disasm('b85d000000'.decode('hex'), arch = 'i386', byte = 0, offset = 0)
mov eax,0x5d
mov eax, 0x5d
>>> print disasm('b817000000'.decode('hex'), arch = 'amd64')
0: b8 17 00 00 00 mov eax,0x17
0: b8 17 00 00 00 mov eax, 0x17
>>> print disasm('48c7c017000000'.decode('hex'), arch = 'amd64')
0: 48 c7 c0 17 00 00 00 mov rax,0x17
0: 48 c7 c0 17 00 00 00 mov rax, 0x17
>>> print disasm('04001fe552009000'.decode('hex'), arch = 'arm')
0: e51f0004 ldr r0, [pc, #-4] ; 0x4
4: 00900052 addseq r0, r0, r2, asr r0
Expand Down Expand Up @@ -816,4 +816,4 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True):
line += i
lines.append(line)

return '\n'.join(lines)
return re.sub(',([^ ])', r', \1', '\n'.join(lines))
2 changes: 1 addition & 1 deletion pwnlib/shellcraft/templates/aarch64/linux/cat.asm
Expand Up @@ -12,7 +12,7 @@ Example:
>>> print disasm(asm(shellcode))
0: d28d8cce mov x14, #0x6c66 // #27750
4: f2acec2e movk x14, #0x6761, lsl #16
8: f81f0fee str x14, [sp,#-16]!
8: f81f0fee str x14, [sp, #-16]!
c: d29ff380 mov x0, #0xff9c // #65436
10: f2bfffe0 movk x0, #0xffff, lsl #16
14: f2dfffe0 movk x0, #0xffff, lsl #32
Expand Down

0 comments on commit 9609374

Please sign in to comment.