Created
October 10, 2018 22:47
-
-
Save drole/6a4c2031b532be30e6b412fbd7ac395b to your computer and use it in GitHub Desktop.
use primarily to analyze shellcode using a debugger
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
| // shellcode.cpp : Defines the entry point for the console application. | |
| // | |
| // Shellcode_dnstxt.cpp : Defines the entry point for the console application. | |
| // | |
| #include "stdafx.h" | |
| #include<stdio.h> | |
| #include<windows.h> | |
| char shellcode[] = "<shellcode here>"; | |
| void ExecuteShellcode(); | |
| int main(int argc, char const *argv[]) | |
| { | |
| ExecuteShellcode(); | |
| getchar(); | |
| return 0; | |
| } | |
| void ExecuteShellcode() { | |
| char* BUFFER = (char*)VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT, PAGE_EXECUTE_READWRITE); | |
| memcpy(BUFFER, shellcode, sizeof(shellcode)); | |
| (*(void(*)())BUFFER)(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment