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. Beginner Hacker Tools
  2. What Are Hacking Tools
  3. Black Hat Hacker Tools
  4. Hack Tools Download
  5. Pentest Box Tools Download
  6. Hacking Tools Usb
  7. Hack Tools For Pc
  8. Hacking Tools Free Download
  9. Usb Pentest Tools
  10. Hack Tools For Pc
  11. Hacking Tools Hardware
  12. Hacker Tools For Windows
  13. Hacking Tools
  14. Hack Rom Tools
  15. Pentest Tools Tcp Port Scanner
  16. Ethical Hacker Tools
  17. Hacker Search Tools
  18. Hacking Apps
  19. How To Make Hacking Tools
  20. Pentest Tools For Mac
  21. Hacker Tools For Pc
  22. Free Pentest Tools For Windows
  23. Hacking Tools For Windows 7
  24. Hacking Tools Online
  25. Hacking Tools For Mac
  26. Black Hat Hacker Tools
  27. What Are Hacking Tools
  28. Free Pentest Tools For Windows
  29. Nsa Hack Tools Download
  30. Hackrf Tools
  31. Pentest Tools Website Vulnerability
  32. Best Pentesting Tools 2018
  33. Hacker Tools For Windows
  34. How To Hack
  35. Pentest Tools Framework
  36. Nsa Hack Tools
  37. Best Pentesting Tools 2018
  38. Pentest Tools Download
  39. Hacking Tools For Windows 7
  40. Pentest Tools Nmap
  41. Pentest Tools Github
  42. Hacker Tools List
  43. Pentest Tools Framework
  44. Pentest Tools Online
  45. Hack Tools For Mac
  46. Computer Hacker
  47. Hack And Tools
  48. Pentest Tools Alternative
  49. Hack Tool Apk No Root
  50. Pentest Tools Bluekeep
  51. Hack Tools 2019
  52. Hack Tools
  53. Usb Pentest Tools
  54. Pentest Automation Tools
  55. Hack Tools
  56. Nsa Hack Tools Download
  57. Hacking Tools Online
  58. Hacking Tools
  59. Hack Tools For Mac
  60. Hack Tools Download
  61. Pentest Tools Alternative
  62. Hacking Tools Kit
  63. Black Hat Hacker Tools
  64. Pentest Tools Review
  65. Hackrf Tools
  66. Pentest Tools Nmap
  67. Best Hacking Tools 2020
  68. Hacking Tools For Windows 7
  69. Hacker Tools For Ios
  70. Github Hacking Tools
  71. Hacker Tools Apk Download
  72. Hacking Tools 2019
  73. Hacker Tools Free
  74. Pentest Tools Open Source
  75. Hacking Tools Software
  76. Hacking Tools Kit
  77. How To Hack
  78. Hacking Tools Download
  79. Termux Hacking Tools 2019
  80. Pentest Tools Tcp Port Scanner
  81. Github Hacking Tools
  82. Hacker Tools Linux
  83. What Is Hacking Tools
  84. Hacking Tools For Games
  85. Hacking Tools Name
  86. Pentest Tools For Android
  87. Hack Tools
  88. Hack Tools For Games
  89. How To Make Hacking Tools
  90. Easy Hack Tools
  91. Hacker Tools Github
  92. Game Hacking
  93. Pentest Tools List
  94. Blackhat Hacker Tools
  95. How To Make Hacking Tools
  96. Best Pentesting Tools 2018
  97. Game Hacking
  98. Hacker Tools List
  99. Hacker Tools 2019
  100. Pentest Tools Download
  101. Hack Tools For Windows
  102. Hack Tools For Mac
  103. Pentest Tools For Windows
  104. Hacking Tools Windows 10
  105. Tools Used For Hacking
  106. New Hack Tools
  107. Hack Tools
  108. Pentest Tools Free
  109. How To Hack
  110. Hacker Tools Hardware
  111. Hack Tool Apk No Root
  112. Hacker Tools Hardware
  113. Nsa Hack Tools
  114. Hackrf Tools
  115. Hacking Tools Windows 10
  116. Computer Hacker
  117. Hacker Tools Windows
  118. Ethical Hacker Tools
  119. Hack Website Online Tool
  120. Top Pentest Tools
  121. Hacking Tools Hardware
  122. Hacker Tools Mac
  123. Hacker Tools Online

Leave a Reply