Reversing Some C++ Io Operations
Posted on 5:38 AM by Tina
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"
Continue reading
- Pentest Tools Framework
- Hacking Apps
- Hacker Hardware Tools
- Hacker Tool Kit
- Hacker Tools Apk Download
- Hack Tools Download
- Hacker Tools Linux
- Pentest Tools For Ubuntu
- Hacker Tools For Mac
- Ethical Hacker Tools
- Hack Tool Apk No Root
- Pentest Tools Subdomain
- Computer Hacker
- Game Hacking
- Best Hacking Tools 2020
- Hack Tools For Windows
- Hacking Tools Software
- Hack Website Online Tool
- Install Pentest Tools Ubuntu
- Hacking Tools Windows 10
- Hacking Tools Kit
- Hacker Tools Github
- Hacking Apps
- Hacker Tools For Windows
- Pentest Automation Tools
- Hacking App
- Hacking Tools Usb
- Hacker Tools Software
- Hacks And Tools
- Hacking Tools
- Blackhat Hacker Tools
- Hacker Tools Github
- Hack Tools For Pc
- Hacking Tools For Windows 7
- Hacking Tools For Windows 7
- Hack Tools Mac
- Pentest Tools Framework
- Computer Hacker
- Pentest Tools Online
- Hacker Tools 2019
- Hacking Tools 2020
- Hacker Tools Linux
- Pentest Tools For Ubuntu
- Hack Tools Mac
- Hacker Tools For Mac
- Hacker Tools Github
- New Hacker Tools
- Hacker Tools 2020
- Hack Tool Apk
- How To Hack
- Hacking Tools Name
- Hack Tools Github
- Blackhat Hacker Tools
- Hacking Tools Software
- Hacker Tools Github
- Hacker Tools Apk
- What Is Hacking Tools
- Pentest Tools For Windows
- Pentest Tools Kali Linux
- Pentest Tools Framework
- Hacker Tools Free
- Pentest Reporting Tools
- Github Hacking Tools
- Beginner Hacker Tools
- Hacking Tools Usb
- Hacking Tools 2020
- Pentest Tools For Ubuntu
- Hacker Tools Free
- What Are Hacking Tools
- Tools For Hacker
- Pentest Tools Kali Linux
- Pentest Tools Url Fuzzer
- Hack Tools 2019
- Hack Website Online Tool
- Hacking Tools And Software
- Kik Hack Tools
- Hacker Tools Online
- Hacker Tools Online
- Pentest Tools
- Hacking Tools Usb
- World No 1 Hacker Software
- Kik Hack Tools
- Nsa Hacker Tools
- Hacking Tools For Windows 7
- Hacking Tools For Pc
- Pentest Tools Online
- Hacking Tools Online
- Hack And Tools
- Hacking Tools 2020
- Pentest Tools Alternative
- Hacking Tools For Windows
- Hacking Tools Hardware
- Hack Tools Pc
- Pentest Tools Url Fuzzer
- Hacking Tools
- Hacking Tools Kit
- Hacking Tools Github
- Hack Apps
- Hacking Tools 2020
- Pentest Tools For Ubuntu
- Pentest Reporting Tools
- Hack Tool Apk
- Hack Tools Download
- Hack Tools For Games
- Hacker Tools For Mac
- Pentest Tools Online
- Game Hacking
- Hacker Tools
- Hack And Tools
- Pentest Tools Online
- Pentest Tools Url Fuzzer
- Pentest Tools Alternative
- Hack Rom Tools
- Pentest Tools For Android
- Hack Tools Github
- Hacker Tools 2020
- Pentest Tools Review
- Install Pentest Tools Ubuntu
- Pentest Tools For Mac
- Pentest Tools For Android
- Termux Hacking Tools 2019
- Hack Tools Mac
- Hacking Tools 2020
- Hack Website Online Tool
- Hack Tool Apk
- Pentest Tools Online
- Hacker Tools For Ios
- Hack Tools Pc
- Pentest Tools Framework
- Blackhat Hacker Tools
- Install Pentest Tools Ubuntu
- Pentest Tools Bluekeep
- Hacker Tools List
- Nsa Hack Tools
- New Hacker Tools
- Tools Used For Hacking
- Pentest Tools Kali Linux
- What Is Hacking Tools
- Wifi Hacker Tools For Windows
- Pentest Tools Port Scanner
- What Is Hacking Tools
- Best Pentesting Tools 2018
- Pentest Tools For Windows
- Growth Hacker Tools
- Hacker Tools Free
- Tools For Hacker
- Pentest Tools Github
0 comments:
Post a Comment