diff --git a/bof.s b/bof.s index c95feb3..9fac6db 100644 --- a/bof.s +++ b/bof.s @@ -1,43 +1,42 @@ -.code64 +#---------------------------------------------------------------# +.code64 # +#---------------------------------------------------------------# + # +.section .rodata # + money_str: .string "woohoo!! free money\n" # + # +#---------------------------------------------------------------# +.section .text # + .globl _start # + .extern printf # + .extern gets # + # + _get_input: # + push %rbp # + mov %rsp, %rbp # + sub $0x10, %rsp # + lea -0x8(%rbp),%rax # + mov %rax, %rdi # + call gets@plt # + nop # aaaaaaaa\x0\x0\x0\x0\x0\x0\x0\x0\x47\x10\x40 + leave # + ret # + # + _get_rich_fast: # + push %rbp # + mov %rsp, %rbp # + lea money_str, %rdi # + mov %rdi, %rax # + call printf@plt # + pop %rbp # + nop # + ret # -.section .rodata - money_str: .string "woohoo!! free money\n" - -.section .text - .globl _start - .extern printf - .extern gets - - _get_input: - push %rbp - mov %rsp, %rbp - sub $0x10, %rsp - lea -0x8(%rbp),%rax - mov %rax, %rdi - call gets@plt - nop ; aaaaaaaa\x0\x0\x0\x0\x0\x0\x0\x0\x47\x10\x40 - leave - ret - - _get_rich_fast: - push %rbp - mov %rsp, %rbp - lea money_str, %rdi - mov %rdi, %rax - call printf@plt - pop %rbp - nop - ret - - _start: - push %rbp - call _get_input - pop %rbp ; TODO: segfault - mov $0, %rax - mov $60, %rdi - syscall - ret - - -; .section bss -; .lcomm buf, 8 + _start: # + push %rbp # + call _get_input # + pop %rbp # TODO: segfault + pop %rsp # + mov $1, %al # + mov $0, %rbx # + syscall #