Advertisement
Guest User

code

a guest
Mar 7th, 2014
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /* Written by Reno Robert
  2. Difficulty: Easy */
  3.  
  4. #include <stdio.h>
  5. #include <time.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <unistd.h>
  9.  
  10. void success() {
  11. char *arg[] = {"/bin/sh", 0};
  12. printf("\nSuccess! Right code\n");
  13. execve("/bin/sh", arg, 0);
  14. }
  15.  
  16. void fail() {
  17. printf("Wrong Code!\n");
  18. }
  19.  
  20. int main() {
  21. int code;
  22. char buf[64];
  23.  
  24. printf("Working! Please Wait...\n");
  25. sleep(3);
  26. srand(time(0));
  27. code = rand();
  28.  
  29. memset(buf, 0, sizeof(buf));
  30. printf("Enter code to get ur message: ");
  31. fgets(buf, sizeof(buf), stdin);
  32.  
  33. if(code == atoi(buf))
  34. success();
  35.  
  36. else
  37. fail();
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement