Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <string.h>
  5.  
  6. #define BUFSIZE 16
  7.  
  8. #define PASSWORD "toutoune"
  9.  
  10. int main(int argc, char **argv)
  11. {
  12. int len_user = 0;
  13. int auth = 0;
  14. char pass[16];
  15. char *user = (char *)malloc(BUFSIZE);
  16. char *password = (char *)malloc(BUFSIZE);
  17.  
  18. len_user = strlen(argv[2]);
  19.  
  20. strcpy(pass, argv[1]);
  21.  
  22. strncpy(password, argv[1], strlen(argv[1]));
  23.  
  24. if (strncmp(password, PASSWORD, strlen(PASSWORD))) {
  25. printf("FAILED\n");
  26. return 1;
  27. }
  28.  
  29. strncpy(user, argv[2], strlen(argv[2]));
  30.  
  31. if (strlen(user) == strlen(password)) {
  32. printf("FAILED\n");
  33. return 1;
  34. }
  35.  
  36. if (auth < 0 && !strncmp(user, password, strlen(password))) {
  37. printf("THE FLAG SHOULD BE HERE ;)\n");
  38. return 0;
  39. }
  40.  
  41. printf("FAILED\n");
  42. return 1;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement