C++ 将外壳代码转换为asm以进行打印

C++ 将外壳代码转换为asm以进行打印,c++,c++17,C++,C++17,我试图从我的外壳代码中打印asm代码 假设我有这个向量 std::vector<std::vector<unsigned char>> shellcode = { { 0xB8, 0x00 ,0x00, 0x00, 0x00 }, //mov eax, 0 { 0xFF, 0x30 }, //push [eax] { 0xFF, 0x70, 0x04 }, //push [e

我试图从我的外壳代码中打印asm代码

假设我有这个向量

std::vector<std::vector<unsigned char>> shellcode  = {
    { 0xB8, 0x00 ,0x00, 0x00, 0x00 },   //mov eax, 0
    { 0xFF, 0x30 },                     //push [eax]
    { 0xFF, 0x70, 0x04 },               //push [eax+4]
    { 0xFF, 0x70, 0x08 },               //push [eax+8]
};

printf("Opcode generated:\n");
for (  const auto& row : shellcode )
{
    for ( const auto& byte : row )
    {
        printf(" 0x%02X", byte);
    }
    printf("\n");
}

C++中没有这样的功能。您需要手动转换它。为了支持您需要编写自己的反汇编程序的通用情况(任何字节)(对于一些想法,请看这里):C++中没有这样的功能。您需要手动转换它。要支持通用大小写(任何字节),您需要编写自己的反汇编程序(有关一些想法,请参见此处:)
mov eax, 0
push [eax]
push [eax+4]
push [eax+8]