Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. //
  2. // This file was generated by the Retargetable Decompiler
  3. // Website: https://retdec.com
  4. // Copyright (c) 2018 Retargetable Decompiler <info@retdec.com>
  5. //
  6.  
  7. #include <stdint.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <sys/mman.h>
  12.  
  13. // ------------------- Function Prototypes --------------------
  14.  
  15. void __libc_csu_fini(void);
  16. int32_t __libc_csu_init(int32_t a1, int32_t a2, int32_t a3);
  17. int32_t _start(int32_t a1, int32_t a2);
  18. int main(int argc, char ** argv);
  19.  
  20. // --------------------- Global Variables ---------------------
  21.  
  22. int32_t g1 = 0; // eax
  23. int32_t g2 = 0; // edx
  24. char * g3 = "\xeb\x37\x5b\xec\xe9\xe8\x35\xfb\xb6\x35\xe3\xb2\x3d\x46\xb6\xca\xbc\x55\xee\x34\xbd\x8a\x40\x82\x0a\xcb\xf6\x34\xfd\xbf\x8a\x53\x82\x12\xcb\x81\x34\xfd\xbc\x8a\x74\x82\x39\xcb\x88\x34\xfd\xbd\x8a\x40\x82\x0b\xcb\x93\x34\xfd\xba\x8a\x40\x82\x2c\xcb\x9a\x34\xfd\xbb\x8a\x53\x82\x63\xcb\xa5\x34\xfd\xb8\x8a\x74\x82\x18\xcb\xac\x34\xfd\xb9\x8a\x40\x82\x3a\xcb\xb7\x55\xbe\x06\xbf\xbe\xbe\xbe\x55\xbb\x06\xbe\xbe\xbe\xbe\xe0\xe1\xe5\xe3\x7d\x50\x61\x73\x73\x77\x6f\x72\x64\x3a\x20"; // 0x8048810
  25.  
  26. // ------------------------ Functions -------------------------
  27.  
  28. // Address range: 0x8048430 - 0x804845f
  29. int32_t _start(int32_t a1, int32_t a2) {
  30. int32_t v1;
  31. int32_t result = __libc_start_main((int32_t * (*)(int32_t, char **, char **))main, v1, (char **)&a1, (void (**)())__libc_csu_init, (void (**)())__libc_csu_fini, (void (**)())g2); // 0x804844c
  32. g1 = result;
  33. return result;
  34. }
  35.  
  36. // Address range: 0x8048530 - 0x804878f
  37. int main(int argc, char ** argv) {
  38. int32_t str;
  39. int32_t v1 = &str; // 0x804854f_0
  40. int32_t v2;
  41. memcpy((char *)&v2, (char *)&g3, 109);
  42. memset((char *)&str, 0, 30);
  43. printf("Password: ");
  44. int32_t v3 = (int32_t)"%s"; // ecx
  45. scanf("%s", &str);
  46. // branch -> 0x8048633
  47. for (int32_t i = 0; i < 109; i++) {
  48. // 0x8048633
  49. int32_t v4;
  50. char * v5 = (char *)(i - 133 + (int32_t)&v4); // 0x8048639_0
  51. int32_t v6 = (int32_t)*v5 ^ 190; // 0x8048641
  52. v3 = v3 & -256 | v6;
  53. *v5 = (char)v6;
  54. // continue -> 0x8048633
  55. }
  56. char * v7 = mmap(NULL, 109, 7, 34, -1, 0); // 0x80486cc
  57. memcpy(v7, (char *)&v2, 109);
  58. g2 = v1;
  59. int32_t len = strlen((char *)&str); // 0x8048724
  60. g1 = v1;
  61. ((int32_t (*)(int32_t, int32_t))v7)(len, v1);
  62. if (g1 == 0) {
  63. // 0x8048747
  64. printf("incorrect!\n");
  65. // branch -> 0x8048774
  66. } else {
  67. // 0x8048760
  68. printf("correct!\n");
  69. // branch -> 0x8048774
  70. }
  71. // 0x8048774
  72. return 0;
  73. }
  74.  
  75. // Address range: 0x8048790 - 0x80487ec
  76. int32_t __libc_csu_init(int32_t a1, int32_t a2, int32_t a3) {
  77. // 0x8048790
  78. abort();
  79. // UNREACHABLE
  80. }
  81.  
  82. // Address range: 0x80487f0 - 0x80487f1
  83. void __libc_csu_fini(void) {
  84. // 0x80487f0
  85. return;
  86. }
  87.  
  88. // --------------- Dynamically Linked Functions ---------------
  89.  
  90. // int __libc_start_main(int *(main)(int, char **, char **), int argc, char ** ubp_av, void(* init)(void), void(* fini)(void), void(* rtld_fini)(void), void(* stack_end));
  91. // void * memcpy(void * restrict dest, const void * restrict src, size_t n);
  92. // void * memset(void * s, int c, size_t n);
  93. // void * mmap(void * addr, size_t len, int prot, int flags, int fd, __off_t offset);
  94. // int printf(const char * restrict format, ...);
  95. // int scanf(const char * restrict format, ...);
  96. // size_t strlen(const char * s);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement