【发布时间】:2015-10-12 08:50:34
【问题描述】:
void main()
{
__asm__
(
"jmp 0x2a
popl %esi
movl %esi, 0x8(%esi)
movb $0x0, 0x7(%esi)
movl $0x0, 0xc(%esi)
movl $0xb, %eax
movl %esi, %ebx
leal 0x8(%esi), %ecx
leal 0xc(%esi), %edx
int $0x80
movl $0x1, %eax
movl $0x0, %ebx
int $0x80
call -0x2f
.string \"/bin/sh\"
");
}
我遵循了shellcode 教程,但是当我使用gcc shellcodeasm.c 编译它时,我收到以下错误:
shellcodeasm.c: In function ‘main’:
shellcodeasm.c:5:4: warning: missing terminating " character [enabled by default]
"jmp 0x2a
^
shellcodeasm.c:5:4: error: missing terminating " character
shellcodeasm.c:6:4: error: expected string literal before ‘popl’
popl %esi
^
shellcodeasm.c:19:4: error: stray ‘\’ in program
.string \"/bin/sh\"
^
shellcodeasm.c:19:13: warning: missing terminating " character [enabled by default]
.string \"/bin/sh\"
^
shellcodeasm.c:19:4: error: missing terminating " character
.string \"/bin/sh\"
^
shellcodeasm.c:20:4: warning: missing terminating " character [enabled by default]
");
^
shellcodeasm.c:20:4: error: missing terminating " character
我是这方面的新手。
【问题讨论】:
-
试试
__asm__ { [NEWLINE] jmp 0x2a [NEWLINE] ... }带大括号不带引号。不确定。
标签: linux gcc compiler-errors x86 inline-assembly