#pragma warning(disable:4996)
const char* _version = "0.0.5";
const char* _banner = " __________.__ ___. __________\n"
" \\______ \\ | ____\\_ |__\\______ \\__ __ ____ ____ ___________ \n"
" | | _/ | / _ \\| __ \\| _/ | \\/ \\ / \\_/ __ \\_ __ \\ \n"
" | | \\ |_( <_> ) \\_\\ \\ | \\ | / | \\ | \\ ___/| | \\/ \n"
" |______ /____/\\____/|___ /____|_ /____/|___| /___| /\\___ >__| \n"
" \\/ \\/ \\/ \\/ \\/ \\/ \n\n"
printf(_banner, _version);
LPVOID process_file(char* inputfile_name, bool jit, int offset, bool debug) {
file = fopen(inputfile_name, "rb");
printf(" [!] Error: Unable to open %s\n", inputfile_name);
printf(" [*] Reading file...\n");
fseek(file, 0, SEEK_END);
fileLen = ftell(file); //Get Length
printf(" [*] File Size: 0x%04x\n", fileLen);
fseek(file, 0, SEEK_SET); //Reset
buffer = (char*)malloc(fileLen); //Create Buffer
fread(buffer, fileLen, 1, file);
printf(" [*] Allocating Memory...");
lpvBase = VirtualAlloc(NULL, fileLen, 0x3000, 0x40);
printf(" [*] |-Base: 0x%08x\n", (int)(size_t)lpvBase);
printf(" [*] Copying input data...\n");
CopyMemory(lpvBase, buffer, fileLen);
void execute(LPVOID base, int offset, bool nopause, bool jit, bool debug)
const char msg[] = " [*] Navigate to the Thread Entry and set a breakpoint. Then press any key to resume the thread.\n";
const char msg[] = " [*] Navigate to the EP and set a breakpoint. Then press any key to jump to the shellcode.\n";
shell_entry = (LPVOID)((UINT_PTR)base + offset);
printf(" [*] Creating Suspended Thread...\n");
thread_handle = CreateThread(
0, // Stack size (Default)
shell_entry, // Thread EP
&thread_id); // Thread identifier
if (thread_handle == NULL) {
printf(" [!] Error Creating thread...");
printf(" [*] Created Thread: [%d]\n", thread_id);
printf(" [*] Thread Entry: 0x%016x\n", (int)(size_t)shell_entry);
// Force an exception by making the first byte not executable.
printf(" [*] Removing EXECUTE access to trigger exception...\n");
VirtualProtect(shell_entry, 1 , PAGE_READWRITE, &oldp);
printf(" [*] Resuming Thread..\n");
ResumeThread(thread_handle);
printf(" [*] Entry: 0x%08x\n", (int)(size_t)shell_entry);
printf(" [*] Jumping to shellcode\n");
printf(" [!] Error: No file!\n\n");
printf(" Required args: <inputfile>\n\n");
printf(" Optional Args:\n");
printf(" --offset <offset> The offset to jump into.\n");
printf(" --nopause Don't pause before jumping to shellcode. Danger!!! \n");
printf(" --jit Forces an exception by removing the EXECUTE permission from the alloacted memory.\n");
printf(" --debug Verbose logging.\n");
printf(" --version Print version and exit.\n\n");
int main(int argc, char* argv[])
printf(" [*] Using file: %s \n", argv[1]);
for (i = 2; i < argc; i++) {
if (strcmp(argv[i], "--offset") == 0) {
printf(" [*] Parsing offset...\n");
if (strncmp(argv[i], "0x", 2) == 0) {
offset = strtol(argv[i], &nptr, 16);
offset = strtol(argv[i], &nptr, 10);
else if (strcmp(argv[i], "--nopause") == 0) {
else if (strcmp(argv[i], "--jit") == 0) {
else if (strcmp(argv[i], "--debug") == 0) {
else if (strcmp(argv[i], "--version") == 0) {
printf("Version: %s", _version);
printf("[!] Warning: Unknown arg: %s\n", argv[i]);
base = process_file(argv[1], jit, offset, debug);
printf(" [!] Exiting...");
printf(" [*] Using offset: 0x%08x\n", offset);
execute(base, offset, nopause, jit, debug);
printf("Pausing - Press any key to quit.\n");