Created
August 9, 2017 13:52
-
-
Save prachauthit/a475239f242186db21c4a70db394829e to your computer and use it in GitHub Desktop.
shellcode_compile.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 <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