Skip to content

Instantly share code, notes, and snippets.

@prachauthit
Created August 9, 2017 13:52
Show Gist options
  • Save prachauthit/a475239f242186db21c4a70db394829e to your computer and use it in GitHub Desktop.
Save prachauthit/a475239f242186db21c4a70db394829e to your computer and use it in GitHub Desktop.
shellcode_compile.c
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>
//paste your shellcode in sc variable eg. /x00/x00
char sc[]="" ;
int main(){
void * a = mmap(0, 4096, PROT_EXEC |PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
printf("allocated executable memory at: %p\n", a);
((void (*)(void)) memcpy(a, sc, sizeof(sc)))();
}
//gcc -ggdb3 shellcode_compile.c -o test -m32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment