Selasa, Januari 23, 2024

Reversing Some C++ Io Operations

In general decompilers are not friendly with c++ let's analyse a simple program to get familiar with it.
Let's implement a simple code that loads a file into a vector and then save the vector with following functions:

  • err
  • load
  • save
  • main


Lets identify the typical way in C++ to print to stdout with the operator "<<"


The basic_ostream is initialized writing the word "error" to the cout, and then the operator<< again to add the endl.




The Main function simply calls  "vec = load(filename)"  but the compiler modified it and passed the vector pointer as a parĂ¡meter. Then it bulds and prints "loaded  " << size << " users".
And finally saves the vector to /tmp/pwd and print "saved".
Most of the mess is basically the operator "<<" to concat and print values.
Also note that the vectors and strings are automatically deallocated when exit the function.


And here is the code:


Let's take a look to the load function, which iterates the ifs.getline() and push to the vector.
First of all there is a mess on the function definition, __return_storage_ptr is the vector.
the ifstream object ifs is initialized as a basic_ifstream and then operator! checks if it wasn't possible to open the file and in that case calls err()
We see the memset and a loop, getline read a cstr like line from the file, and then is converted to a string before pushing it to the vector. lVar1 is the stack canary value.

In this situations dont obfuscate with the vector pointer vec initialization at the begining, in this case the logic is quite clear.



The function save is a bit more tricky, but it's no more than a vector iteration and ofs writing.
Looping a simple "for (auto s : *vec)" in the decompiler is quite dense, but we can see clearly two write, the second write DAT_0010400b is a "\n"



As we see, save implememtation is quite straightforward.




Related links

  1. Game Hacking
  2. Tools 4 Hack
  3. Hacker Tools For Pc
  4. Hacking Tools For Games
  5. Hacker Tools Software
  6. Hacking Tools For Pc
  7. Hacking App
  8. Hacker Tools 2019
  9. Pentest Tools Apk
  10. Hacking Tools For Pc
  11. Hacking Tools Pc
  12. Hacker Tools
  13. Hacking Tools For Pc
  14. Hacker Tools Apk Download
  15. Hack Tools For Windows
  16. Pentest Automation Tools
  17. Hack Tools Pc
  18. Pentest Tools Linux
  19. Hack Tool Apk
  20. Hack Tools
  21. Pentest Tools Subdomain
  22. Hacking Tools For Windows Free Download
  23. Black Hat Hacker Tools
  24. Hacker Tools For Pc
  25. Hack Tools For Games
  26. Android Hack Tools Github
  27. Hacker Tools List
  28. Hack Tools Download
  29. Termux Hacking Tools 2019
  30. Pentest Tools For Ubuntu
  31. Pentest Tools Find Subdomains
  32. Pentest Tools Website Vulnerability
  33. Pentest Tools For Mac
  34. Hacking Tools For Mac
  35. Pentest Tools Android
  36. Pentest Tools Windows
  37. Hack Tools
  38. Computer Hacker
  39. Hacker Tools Software
  40. Pentest Tools Download
  41. Tools Used For Hacking
  42. Hacker Tools For Mac
  43. Pentest Box Tools Download
  44. Android Hack Tools Github
  45. Nsa Hack Tools Download
  46. Hack Tools For Pc
  47. Pentest Tools Find Subdomains
  48. Pentest Tools For Windows
  49. Hack Tools
  50. Hacking Tools For Beginners
  51. Hacking Tools For Pc
  52. World No 1 Hacker Software
  53. Hack Tools For Pc
  54. Black Hat Hacker Tools
  55. Pentest Tools Download
  56. Hacker Tools Hardware
  57. Hack Tools Github
  58. Hacker Tools For Mac
  59. Pentest Tools Open Source
  60. Pentest Tools Github
  61. Nsa Hacker Tools
  62. Best Hacking Tools 2019
  63. Pentest Tools Tcp Port Scanner
  64. New Hack Tools
  65. Hacking Tools Windows 10
  66. Hacker Tools Github
  67. Pentest Tools List
  68. Install Pentest Tools Ubuntu
  69. What Is Hacking Tools
  70. Hacker
  71. Hack Tools Online
  72. Pentest Tools List
  73. Hacking Tools For Beginners
  74. Hak5 Tools
  75. Hack Tools For Windows
  76. Termux Hacking Tools 2019
  77. Hacker
  78. Growth Hacker Tools
  79. Pentest Automation Tools
  80. Hacker Tools List
  81. Hacking Tools For Windows Free Download
  82. Pentest Tools Free
  83. Hack Tools For Games
  84. Pentest Tools Url Fuzzer
  85. Hacking Tools Software
  86. Hak5 Tools
  87. Hacker Tools Github
  88. Hack Tools For Pc
  89. Hackrf Tools
  90. Kik Hack Tools
  91. Hacking Tools 2019
  92. Hack Tools Online
  93. Kik Hack Tools
  94. Pentest Tools Review
  95. Hacking Tools Usb
  96. Hacking Tools Windows
  97. Hacker Tools Apk Download
  98. Hack App
  99. Hacker
  100. Pentest Tools Open Source
  101. Pentest Tools Android
  102. Tools 4 Hack
  103. Hacker Tools Github
  104. Pentest Tools Github
  105. Hacking Tools And Software
  106. Hacker Tools Mac
  107. Hack Tools For Games
  108. Pentest Tools Windows
  109. Growth Hacker Tools
  110. Hacking Tools For Windows Free Download
  111. Hacking Tools Hardware
  112. Pentest Tools Apk
  113. Hacker Tool Kit
  114. Best Hacking Tools 2020
  115. Hack Apps
  116. Nsa Hack Tools Download
  117. Hacking Tools Pc
  118. Tools Used For Hacking
  119. Hacker Tools
  120. Best Hacking Tools 2019
  121. Hack Tools Pc
  122. Hacker Techniques Tools And Incident Handling
  123. Hack Tools
  124. Nsa Hack Tools Download
  125. Pentest Tools Linux
  126. Hacking Tools Online
  127. Termux Hacking Tools 2019
  128. New Hacker Tools
  129. Hack Apps
  130. Hack Tools For Mac
  131. Hack Tools For Pc
  132. Hack Tools
  133. Pentest Tools Online
  134. Black Hat Hacker Tools
  135. Android Hack Tools Github
  136. Wifi Hacker Tools For Windows
  137. Hacker Tools
  138. Hacker Techniques Tools And Incident Handling
  139. Hack Website Online Tool
  140. Ethical Hacker Tools
  141. Hacker Hardware Tools
  142. Hacking Tools Online
  143. Hacking Tools
  144. Pentest Tools Apk
  145. Black Hat Hacker Tools
  146. Hacking Tools Usb
  147. Hacker Tools Apk
  148. Beginner Hacker Tools
  149. Pentest Tools Github
  150. What Is Hacking Tools
  151. Hacking Tools Usb
  152. Hack Apps
  153. Blackhat Hacker Tools
  154. New Hacker Tools
  155. Pentest Reporting Tools
  156. Hacker Tools 2019
  157. Game Hacking
  158. Pentest Tools Url Fuzzer
  159. Hacker Tools Github
  160. Beginner Hacker Tools
  161. Hacking Tools Name
  162. Hacking Tools Download
  163. How To Install Pentest Tools In Ubuntu
  164. Github Hacking Tools
  165. Termux Hacking Tools 2019
  166. What Are Hacking Tools
  167. World No 1 Hacker Software
  168. Install Pentest Tools Ubuntu
  169. Hacking Tools 2020
  170. What Is Hacking Tools
  171. Nsa Hacker Tools
  172. Hacker Hardware Tools
  173. Hacker Tools 2020

Tiada ulasan: