Tuesday, December 2, 2008

fun with ptrace

sys/types.h
sys/ptrace.h
unistad.h

if (fork() == 0) {
if (ptrace(PT_ATTACH, getppid(), (caddr_t)0, 0) == -1) {
printf("Debugger found!\n");
//alert!
} else {
ptrace(PT_CONTINUE, getppid(), (caddr_t)1, 0);
//continue on
}




No comments: