All pastes #161058 Raw Edit

Something

public text v1 · immutable
·published 2006-09-04 23:42 UTC
rendered paste body
/* do the md5 checksum thing */
/* maybe elfcrypt ? */
#include <stdio.h>
#include <stdlib.h>
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <openssl/md5.h>

#ifdef MACOS                    // ??
int ptdenyhave = 1;
#endif

void hello(void) {
                printf("Hello world!\n");
}
int main(int argc, char *argv[]) {
#ifdef MACOS
                if(ptdenyhave == 1) 
                                ptrace(PT_DENY_ATTACH, 0, 0, 0);
#endif
                /* this is easily circumventible, so strip symbols */
                if(ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) { 
                                printf("ptrace called\n");
                                return 1;
                }               
                /* not directly related to ptrace, works on breakpoints though. do i still get points? */
                if((*(volatile unsigned *)((unsigned)hello + 6) & 0xFF) == 0xCC) {
                                printf("trap called\n");
                                return 1;
                }                       
                                
                                
                hello();        
                return 0;       
}