Advertisement
Guest User

Untitled

a guest
Aug 9th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <signal.h>
  3. #include <string.h>
  4. char * eax= 0;
  5.  
  6. void term_handler(int i);
  7. int test();
  8.  
  9. int main(int argc, char const *argv[])
  10. {
  11.     struct sigaction sa;
  12.     sigset_t newset;
  13.     sigemptyset(&newset);
  14.     sigaddset(&newset, SIGHUP);
  15.     sigprocmask(SIG_BLOCK, &newset, 0);
  16.     sa.sa_handler = term_handler;
  17.     sigaction(SIGSEGV, &sa, 0);
  18.     sigaction(SIGBUS, &sa, 0);
  19.     test();
  20.     return 0;
  21. }
  22.  
  23. void term_handler(int i)
  24. {
  25.     eax++;
  26.     test();
  27. }
  28.  
  29. int test(){
  30.     int iteration = 0;
  31.     char string[] = "#include";
  32.     int size = strlen((const char *)string);
  33.    
  34.     while(1){
  35.         if(*eax = string[iteration]){
  36.             iteration++;
  37.             eax++;
  38.         } else {
  39.             iteration = 0;
  40.         }
  41.         if(iteration == size)
  42.             printf("%s", (char *)eax);
  43.             return 0;
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement