level04: source code done
This commit is contained in:
parent
132e604f3b
commit
c6db5f49cd
42
level04/source.c
Normal file
42
level04/source.c
Normal file
@ -0,0 +1,42 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user