mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-05-03 07:14:54 -04:00
some memory exploitation snippets
This commit is contained in:
parent
d987311195
commit
ab05e249d4
19 changed files with 2613 additions and 0 deletions
25
Memory_Exploits/C-codes/testing_shellcode4.c
Normal file
25
Memory_Exploits/C-codes/testing_shellcode4.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* 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;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue