Skip to content

Instantly share code, notes, and snippets.

@drole
Created October 10, 2018 22:47
Show Gist options
  • Select an option

  • Save drole/6a4c2031b532be30e6b412fbd7ac395b to your computer and use it in GitHub Desktop.

Select an option

Save drole/6a4c2031b532be30e6b412fbd7ac395b to your computer and use it in GitHub Desktop.
use primarily to analyze shellcode using a debugger
// 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