2024-06-08 18:13:36 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
// gcc -o test_shellcode -m32 -fno-stack-protector -fno-pie -z execstack -O0 test_shellcode.c
|
|
|
|
|
|
|
|
// Your shellcode goes here
|
2024-06-09 19:37:58 +02:00
|
|
|
char *shellcode = "\x31\xc0\x50\x68\x64\x61\x73\x68\x68\x2f\x2f\x2f\x2f\x68\x2f\x62\x69\x6e\x89\xe3\x89\xc1\x89\xc2\xb0\x0b\xcd\x80";
|
2024-06-08 18:13:36 +02:00
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// Print length of shellcode
|
|
|
|
fprintf(stdout,"Length: %d\n",strlen(shellcode));
|
|
|
|
// Execute shellcode
|
|
|
|
(*(void (*)()) shellcode)();
|
2024-06-09 19:37:58 +02:00
|
|
|
}
|