gpt4 book ai didi

c - 助记符中的无效字符 '\'

转载 作者:行者123 更新时间:2023-12-01 14:04:29 25 4
gpt4 key购买 nike

我是 asm/shellcode 新手,在编译 ParrotOS 中作为模板包含的示例 shellcode 时遇到了问题。

我浏览了以下主题,但无法解决我的问题:

Assembly error: invalid character '$' in mnemonic

Invalid character (0xe2) in mnemonic

我尝试使用 as 命令代替 gcc,但是我遇到了同样的错误。

char code[] = 

"\xe9\x1e\x00\x00\x00" // jmp 8048083 <MESSAGE>
"\xb8\x04\x00\x00\x00" // mov $0x4,%eax
"\xbb\x01\x00\x00\x00" // mov $0x1,%ebx
"\x59" // pop %ecx
"\xba\x0f\x00\x00\x00" // mov $0xf,%edx
"\xcd\x80" // int $0x80
"\xb8\x01\x00\x00\x00" // mov $0x1,%eax
"\xbb\x00\x00\x00\x00" // mov $0x0,%ebx
"\xcd\x80" // int $0x80
"\xe8\xdd\xff\xff\xff" // call 8048065 <GOBACK>
"give me a bottle of rum!\r\n"; // OR "\x48\x65\x6c\x6c\x6f\x2c\x20\x57"
// "\x6f\x72\x6c\x64\x21\x0d\x0a"


int main(int argc, char **argv)
{
(*(void(*)())code)();

return 0;
}
gcc shellcode.s

shellcode.s: Assembler messages:
shellcode.s:1: Error: no such instruction: `char code[]='
shellcode.s:3: Error: invalid character '\' in mnemonic
shellcode.s:4: Error: invalid character '\' in mnemonic
shellcode.s:5: Error: invalid character '\' in mnemonic
shellcode.s:6: Error: invalid character '\' in mnemonic
shellcode.s:7: Error: invalid character '\' in mnemonic
shellcode.s:8: Error: invalid character '\' in mnemonic
shellcode.s:9: Error: invalid character '\' in mnemonic
shellcode.s:10: Error: invalid character '\' in mnemonic
shellcode.s:11: Error: invalid character '\' in mnemonic
shellcode.s:12: Error: invalid character '\' in mnemonic
shellcode.s:13: Error: no such instruction: `give me a bottle of rum!\r\n"'
shellcode.s:17: Error: junk `(int argc,char **argv)' after expression
shellcode.s:17: Error: operand size mismatch for `int'
shellcode.s:18: Error: no such instruction: `{'
shellcode.s:19: Error: junk at end of line, first unrecognized character is `('
shellcode.s:21: Error: no such instruction: `return 0'
shellcode.s:22: Error: junk at end of line, first unrecognized character is `}'

最佳答案

这是 C 代码,但它有一个 .s 扩展名,表示汇编。将文件重命名为 shellcode.c

关于c - 助记符中的无效字符 '\',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60394371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com