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
- Hacker Tools For Ios
- What Is Hacking Tools
- Hacking Tools Hardware
- Hacker Techniques Tools And Incident Handling
- Kik Hack Tools
- Hacker Search Tools
- Hacker Tools Github
- Free Pentest Tools For Windows
- How To Hack
- Pentest Tools Url Fuzzer
- Hacking Tools For Beginners
- Hacking App
- Hacker Search Tools
- Hacker Tools List
- Hack Tools Download
- Hacking Tools For Windows 7
- Pentest Tools Subdomain
- Hacker Tools For Windows
- Hacker Tools List
- Hacking Tools For Kali Linux
- Pentest Reporting Tools
- Hacking Tools For Windows 7
- Hacks And Tools
- Hacker Hardware Tools
- Hacker Tools Free
- Hackrf Tools
- Nsa Hack Tools Download
- Pentest Tools Bluekeep
- Hacking Tools For Windows
- Pentest Tools For Windows
- Hacker Tools 2020
- Hack Rom Tools
- New Hacker Tools
- How To Hack
- Ethical Hacker Tools
- Hack And Tools
- Pentest Box Tools Download
- Pentest Tools Find Subdomains
- Pentest Tools Online
- Best Hacking Tools 2019
- Hacking Tools And Software
- Hacker Tools Linux
- Free Pentest Tools For Windows
- Hacking Tools Software
- Hack Website Online Tool
- How To Install Pentest Tools In Ubuntu
- Hackers Toolbox
- Hacking Tools Windows 10
- Hacker Techniques Tools And Incident Handling
- Android Hack Tools Github
- Pentest Tools Bluekeep
- Hack Tools 2019
- Hacking Tools Windows 10
- Pentest Tools Tcp Port Scanner
- Easy Hack Tools
- Hack Tools For Ubuntu
- Easy Hack Tools
- Pentest Tools Github
- Hack Website Online Tool
- New Hack Tools
- Hacker Tools 2020
- Hacker Tools List
- Hacking Tools And Software
- Pentest Tools Apk
- Hacker Tools List
- Pentest Tools Windows
- Hacking Tools Kit
- Hacker Tools For Mac
- Easy Hack Tools
- Hak5 Tools
- Hacking App
- Pentest Tools Website Vulnerability
- Pentest Tools For Mac
- Black Hat Hacker Tools
- Hack Tools 2019
- Underground Hacker Sites
- Bluetooth Hacking Tools Kali
- Pentest Tools Tcp Port Scanner
- Pentest Tools For Mac
- Hacking Tools 2020
- Hack Tools
- Nsa Hacker Tools
- Hack Tools For Windows
- Hacking Tools For Windows
- Beginner Hacker Tools
- Hacker Tools Apk
- What Is Hacking Tools
- Pentest Recon Tools
- Pentest Tools Subdomain
- Hack Rom Tools
- Pentest Tools Find Subdomains
- Pentest Tools Apk
- Hack Website Online Tool
- Hacking Tools Usb
- Hacking Tools For Windows 7
- Hacker
- Hacking Tools For Mac
- Pentest Tools Github
- Hacking Tools For Games
- Hackrf Tools
- Hacker Tools List
- Hack App
- Hacker Tools Apk
- Hacker Tools Online
- Ethical Hacker Tools
- Pentest Tools Free
- Pentest Tools Android
- Tools Used For Hacking
- Hack Tools For Windows
- Hacking Tools For Windows 7
- Hacker Tools 2019
- Android Hack Tools Github
- Hacking Tools For Games
- Hack Website Online Tool
- Hacker Hardware Tools
- Hacking Tools Software
- Bluetooth Hacking Tools Kali
- Termux Hacking Tools 2019
- Hack Tools
- Hacker Tools Mac
- Pentest Tools For Ubuntu
- Pentest Tools Free
- Growth Hacker Tools
- Tools Used For Hacking
- Hacking Apps
- Hack Rom Tools
- Pentest Tools Review
- Pentest Tools Framework
- Pentest Tools Review
- Hacker Tools Free
- Hack Tools For Games
- Pentest Tools Url Fuzzer
- Hacker Tools For Ios
- Hacks And Tools
- What Is Hacking Tools
- Hack Tools Online
- Hacker Tools Mac
- Hacker Tools Software
- Hack Tools For Mac
- Hacker Tools Hardware
- Tools For Hacker
- Kik Hack Tools
- Usb Pentest Tools
- Best Hacking Tools 2019
- Hacking App
- Pentest Tools For Mac
- Computer Hacker
- Pentest Tools Nmap
- Usb Pentest Tools
- Hack And Tools
- Usb Pentest Tools
- Hacker Tools For Ios
- Hack Tools
- Hack Tools Online
- Hack Tools Online
- Pentest Tools Github
- Beginner Hacker Tools
- Hacking Tools Usb
- Usb Pentest Tools
- Kik Hack Tools
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Alternative
- Hack Website Online Tool
- Hack Tools For Games
- Pentest Tools Open Source
- Hacking Tools Pc
- How To Install Pentest Tools In Ubuntu
- Hacking Tools 2019
- How To Install Pentest Tools In Ubuntu
- Growth Hacker Tools
- Pentest Tools Linux
- Hacking Tools Name











0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home