Advertisement
raisep0wn

NDH 2k10 public wargame, level7

May 8th, 2011
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. /***********************************
  2. |            level7.c              |
  3. |  http://wargame.nuitduhack.com/  |
  4. |  http://www.nuitduhack.com/      |
  5. ***********************************/
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9.  
  10. // gcc -o level7 level7.c -fno-stack-protector -z execstack -mpreferred-stack-boundary=2
  11.  
  12. unsigned int secret;
  13.  
  14. int vuln(char *arg) {
  15.     unsigned int cookie = secret;
  16.     char tmp[64] = {'\0'};
  17.  
  18.     strcpy(tmp, arg);
  19.     if(cookie!=secret) {
  20.         printf("It's not my cookie :(\n");
  21.         exit(0);
  22.     }
  23.  
  24.     return 1337;
  25. }
  26.  
  27. int main(int argc, char *argv[])
  28. {
  29.     if(argc != 2) {
  30.         printf("%s <P0wn Me!> \n", argv[0]);
  31.         exit(0);
  32.     }
  33.  
  34.     srand(time(NULL));
  35.     secret = rand();
  36.  
  37.     printf("GooD Boy :) %08X\n", secret);
  38.  
  39.     vuln(argv[1]);
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement