Greetings, SO.
I have code that I tried to compile with gcc, but my attempts were thwarted. Can anyone better understand this issue, maybe something is missing for me there.
I am compiling this code on Linux Kitchen 2.6.28-15-generiC # 49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU / Linux.
int main(void) { __asm__( "xorq %rdx,%rdx" "movq $0x68732f6e69622fff, %rdx" "shr $0x8, %rbx" "push %rbx" "movq %rsp,%rdi" "xorq %rax,%rax" "pushq %rax" "pushq %rdi" "movq %rsp,%rsi" "mov $0x3b, %al" "syscall" "pushq $0x1" "pop %rdi" "pushq $0x3c" "pop %rax" "syscall" ); return 0; }
Return Error:
$ gcc -o shellcode shellcode.c shellcode.c: Assembler messages: shellcode.c:4: Error: bad register name `%rdxmovq $0x68732f6e69622fff'
Thank you all.
user165788
source share