level04: done

This commit is contained in:
0x35c
2025-05-06 18:19:06 +02:00
parent 6fee805bf3
commit 69275059ec
3 changed files with 57 additions and 5 deletions

View File

@ -13,7 +13,7 @@ int main(void)
pid = fork();
memset(s, 0, sizeof(s));
if (pid) {
if (pid) { // parent code
do {
wait(&wstatus);
if (WIFSIGNALED(wstatus) ||
@ -23,10 +23,10 @@ int main(void)
}
} while (ptrace(PTRACE_PEEKUSER, pid, 44, 0) != 11);
puts("no exec() for you");
kill(pid, 9);
} else {
prctl(1, 1);
ptrace(PTRACE_TRACEME, 0, 0, 0);
kill(pid, SIGKILL);
} else { // child code
prctl(1, PR_SET_PDEATHSIG);
ptrace(PTRACE_TRACEME, 0, NULL, NULL);
puts("Give me some shellcode, k");
gets(s);
}