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.
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"
Read more
- Hacking Tools Pc
- Pentest Box Tools Download
- Tools For Hacker
- Hacking Tools Download
- Hacking Tools Kit
- Hacking Tools For Games
- Hacking Tools Windows 10
- Hacker Tools Apk
- Nsa Hack Tools
- Underground Hacker Sites
- Hacker Tools Hardware
- Hacker Tools Github
- Hack And Tools
- Hacker Tools For Pc
- Hack Tools For Games
- Install Pentest Tools Ubuntu
- Hacker Search Tools
- Hack Tools For Ubuntu
- Hack Tools Online
- Physical Pentest Tools
- Best Hacking Tools 2019
- Pentest Automation Tools
- What Is Hacking Tools
- Hack Tools For Ubuntu
- Hack Tools For Windows
- Pentest Tools For Android
- Pentest Tools Kali Linux
- Hacking Tools For Beginners
- Hacking Tools
- Ethical Hacker Tools
- Pentest Tools
- Free Pentest Tools For Windows
- Hack Tools For Windows
- Hack Tools
- Hacker Tools Mac
- Hacker Tools Mac
- Install Pentest Tools Ubuntu
- Pentest Tools Windows
- Hack Tool Apk No Root
- Growth Hacker Tools
- Wifi Hacker Tools For Windows
- Pentest Tools Website
- Hack Tools Pc
- Hacking Tools Windows 10
- Hacking Tools Usb
- Hack And Tools
- New Hacker Tools
- Hacking Tools Kit
- Pentest Tools Download
- Nsa Hack Tools Download
- Android Hack Tools Github
- Hacking Apps
- Hacking Tools Kit
- Hacking Tools For Mac
- Usb Pentest Tools
- Pentest Tools Alternative
- What Are Hacking Tools
- Hack Tools 2019
- Hack Tools
- Pentest Tools Kali Linux
- Hacker Tools Windows
- Hacker Hardware Tools
- Hacker Hardware Tools
- Hacker Tools 2019
- Best Pentesting Tools 2018
- Hack Tool Apk No Root
- Top Pentest Tools
- Best Hacking Tools 2020
- Hacker Security Tools
- Hack Tools For Pc
- Hack Website Online Tool
- Beginner Hacker Tools
- Hack Tool Apk No Root
- Hacking Tools For Pc
- Hack Tools For Mac
- Hak5 Tools
- Hack Tools For Games
- Hacker Hardware Tools
- Pentest Tools Windows
- Hack Tools For Mac
- Hacker Tools For Windows
- Free Pentest Tools For Windows
- Top Pentest Tools
- Pentest Tools Framework
- Hacking Tools For Mac
- Hacker
- Nsa Hack Tools
- New Hack Tools
- Termux Hacking Tools 2019
- Hacker Tools Software
- Pentest Tools Nmap
- What Are Hacking Tools
- Pentest Tools Url Fuzzer
- Hacker
- Pentest Tools Subdomain
- Pentest Tools For Windows
- Hacking Tools 2019
- Tools 4 Hack
- Hacker Tools
- Pentest Tools
- How To Hack
- Android Hack Tools Github
- Hacker Hardware Tools
- Hacking Tools For Kali Linux
- Hacking Apps
- Hackrf Tools
- Pentest Tools Windows
- Underground Hacker Sites
- Hacking Tools Mac
- Hacking Tools 2019
- Pentest Recon Tools
- Hacker Tools Hardware
- Hacking Tools Kit
- Hacker Tools Linux
- Hacker Search Tools
- Growth Hacker Tools
- Hackrf Tools
- Beginner Hacker Tools
- Easy Hack Tools
- Hacking Tools Mac
- Pentest Tools Apk
- Hacker Tools Apk Download
- Hack Tool Apk
- Hacking Tools For Windows
- Hacker Tool Kit
- Hacking Tools For Pc
- Hack Tool Apk No Root
- Pentest Tools Website
- Pentest Tools Github
- Hacker Tools For Pc
- Pentest Tools For Windows
- Hacking Tools For Windows 7
- Hacking Tools Kit
- Best Hacking Tools 2020
- Hacking Tools Windows
- Termux Hacking Tools 2019
- Game Hacking
- Pentest Tools Open Source
- Pentest Tools Review
- Hack Tools
- Nsa Hack Tools
- Hack Tool Apk
- Pentest Tools Url Fuzzer
- Hacker Tools For Mac
- Tools 4 Hack
- Pentest Recon Tools
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home