1

Im tryiong to print the asm code from my shellcode.

Lets say i have this vector

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");
}

how could i print it so it returns the asm like this

mov eax, 0
push [eax]
push [eax+4]
push [eax+8]
werico4026
  • 73
  • 1
  • 6
  • 1
    There's no such functionality in C++ at all. You need to convert it manually. To support generic case (any bytes) you need to write your own disassembler (for some ideas look here: https://stackoverflow.com/questions/924303/how-to-write-a-disassembler ) – Georgy Firsov Apr 13 '20 at 14:30

0 Answers0