Skip to content

Instantly share code, notes, and snippets.

@kafkaesqu3
Created August 14, 2019 13:35
Show Gist options
  • Save kafkaesqu3/4ebae8f2dba6ed84f749c7bf20ffb7f4 to your computer and use it in GitHub Desktop.
Save kafkaesqu3/4ebae8f2dba6ed84f749c7bf20ffb7f4 to your computer and use it in GitHub Desktop.
#include "pch.h"
#include <windows.h>
int main() {
unsigned char shellcode[] = "\x00..";
//Execute shellcode
void *exec = VirtualAlloc(0, shellcodeSize, MEM_COMMIT, PAGE_READWRITE);
DWORD OldProtect = NULL;
memcpy(exec, shellcode_decrypt, shellcodeSize);
VirtualProtect(exec, shellcodeSize, PAGE_EXECUTE_READ, &OldProtect);
((void(*)())exec)();
//Clean-up memory
VirtualFree(exec, NULL, MEM_RELEASE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment