fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define COMMANDE "/bin/cat /home/level01a/.password"
  6.  
  7. int flag=0;
  8.  
  9. int check(char *password)
  10. {
  11.  
  12. char verif[29];
  13. char buffer[16];
  14.  
  15. strcpy(buffer, password);
  16. strcpy(verif, "Donotcareitisnotusefull");
  17.  
  18. printf("%s\n",verif);
  19. printf("%s\n",buffer);
  20. if(strcmp(buffer, verif) == 0)
  21. flag = 1;
  22.  
  23. return flag;
  24. }
  25.  
  26. int main(int argc, char ** argv)
  27. {
  28.  
  29. if(check("Donotcareitis")==1)
  30. {
  31. printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  32. printf(" Access Granted for my grand ma !\n");
  33. printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  34. system(COMMANDE);
  35. }
  36. else
  37. {
  38. printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  39. printf("\nAccess Denied!\n");
  40. printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  41. }
  42. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Donotcareitisnotusefull
Donotcareitis

-=-=-=-=-=-=-=-=-=-=-=-=-=-

Access Denied!
-=-=-=-=-=-=-=-=-=-=-=-=-=-