mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-04-27 19:16:08 -04:00
26 lines
525 B
C
26 lines
525 B
C
/* Sys mman shellcode tester */
|
|
#include <stdio.h>
|
|
#include <sys/mman.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int (*shellcodetotest)();
|
|
char shellcode[] = ""; /* Put your shellcode here */
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
void *ptr = mmap(0, 150, PROT_EXEC | PROT_WRITE| PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0);
|
|
if(ptr == MAP_FAILED)
|
|
{
|
|
perror("mmap");
|
|
exit(-1);
|
|
}
|
|
|
|
memcpy(ptr, shellcode, sizeof(shellcode));
|
|
shellcodetotest = ptr;
|
|
shellcodetotest();
|
|
return 0;
|
|
}
|
|
|