I have the following assembly code:
.data
.globl shellcode
shellcode:
jmp over_string
string_addr:
.ascii "/bin/shNAAAAAAAABBBBBBBB"
over_string:
leaq string_addr(%rip), %rdi
xorl %eax, %eax
movb %al, 0x07(%rdi)
movq %rdi, 0x08(%rdi)
movq %rax, 0x10(%rdi)
leaq 0x08(%rdi), %rsi
movq %rax, %rdx
movb $0x3b, %al
syscall
.byte 0
I am trying to compile this code with the following command:
as --32 shellcode.s -o shellcode.o
I get the following errors:
shellcode.s: Assembler messages:
shellcode.s:8: Error: bad register name `%rip)'
shellcode.s:10: Error: bad register name `%rdi)'
shellcode.s:11: Error: bad register name `%rdi'
shellcode.s:12: Error: bad register name `%rax'
shellcode.s:13: Error: bad register name `%rdi)'
shellcode.s:14: Error: bad register name `%rax'
I tried removing the % on every register that the assembler said I had an error with but more errors appeared.