42_Override/level04/source.c
2025-05-06 14:00:36 +02:00

43 lines
727 B
C

#include <stdio.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
int main(void)
{
int stat_loc;
char s[128];
int v6;
int v7;
int v8;
pid_t v9;
v9 = fork();
memset(s, 0, sizeof(s));
v8 = 0;
stat_loc = 0;
if (v9) {
do {
wait(&stat_loc);
v6 = stat_loc;
if ((stat_loc & 0x7F) == 0 ||
(v7 = stat_loc,
(char)((stat_loc & 0x7F) + 1) >> 1 > 0)) {
puts("child is exiting...");
return 0;
}
v8 = ptrace(PTRACE_PEEKUSER, v9, 44, 0);
} while (v8 != 11);
puts("no exec() for you");
kill(v9, 9);
} else {
prctl(1, 1);
ptrace(PTRACE_TRACEME, 0, 0, 0);
puts("Give me some shellcode, k");
gets(s);
}
return 0;
}