All pastes #984798 Raw Edit

Unnamed

public c v1 · immutable
·published 2008-04-14 15:56 UTC
rendered paste body
#include <stdlib.h>#include <stdio.h>#include <sys/ptrace.h> /* ptrace()           */#include <sys/wait.h>   /* wait()             */#include <unistd.h>     /* fork()  execve()   */#include <sys/types.h>int main(int argc, char *argv[]) {  int pid = 0, status = 0;  if(argc < 2) {    printf("\t[+]Erreur\n");    printf("\t\t[-] Utilisation: ./debugg path_to_programme\n");    return 1;  }  pid = fork();  switch(pid) {  case -1:    printf("\t[+]Erreur\n");    printf("\t\t[-]Fork échoué\n");    return 1;    break;  case 0:    ptrace(PTRACE_TRACEME, 0, 0, 0);    execl("/bin/ls", "t", NULL);    break;  default:    do{      wait(&status);      nmb_instruction++;      ptrace(PTRACE_SINGLESTEP, pid, 0 ,0);    }while(status == 1407);  }  return 0;}