Enter your email address:

Delivered by FeedBurner

Saturday, August 29, 2020

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.




More articles


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

No comments:

Post a Comment