Skip to content

Instantly share code, notes, and snippets.

@giuscri
Last active October 7, 2015 17:42
Show Gist options
  • Save giuscri/f67c12a3ac81af2b5ae8 to your computer and use it in GitHub Desktop.
Save giuscri/f67c12a3ac81af2b5ae8 to your computer and use it in GitHub Desktop.
## $ cc -ggdb3 -m32 -Og reverse.cool.s -o reverse.cool
.section .text
.type main, @function
.globl main
main:
pushl %ebp
movl %esp,%ebp
subl $0x10,%esp
movl %esp,-0x10(%ebp)
movl $message,%esi
movl %esp,%edi
1:
subl $0x4,%esp
movl %esp,%edi
xorl %ebx,%ebx
movl %ebx,(%edi)
xorl %ebx,%ebx
movb (%esi),%bl
cmpl $0xa,%ebx
je 2f
cmpl $0x0,%ebx
je 2f
movl %ebx,(%edi)
incl %esi
jmp 1b
2:
movl $message,%edi
1:
addl $0x4,%esp
movl %esp,%esi
movl -0x10(%ebp),%ebx
cmpl %ebx,%esi
je 2f
xorl %ebx,%ebx
movb (%esi),%bl
movb %ebx,(%edi)
incl %edi
jmp 1b
2:
subl $0x8,%esp
pushl $message
pushl $message_format
call printf
addl $0x10,%esp
leave
ret
.section .data
message:
.ascii "Pwn3d\0"
message_format:
.ascii "%s\n\0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment