IDAPyEmu
Our first example will be to load an example binary into IDA Pro and use PyEmu to emulate a simple function call. The binary is a simple C++ application called addnum.exe that is available with the rest of the source for this book at http://www.nostarch.com/ghpython.htm. This binary simply takes two numbers as command-line parameters and adds them together before outputting the result. Let's take a quick peek at the source before looking at the disassembly.
addnum.cpp
addnum.cpp
#include <stdlib.h> #include <stdio.h> #include <windows.h> int add_number( int num1, int num2 ) { int sum; sum = num1 + num2; return sum; } int main(int argc, char* argv[]) { int num1, num2; int return_value; if( argc < 2 ) { printf("You need to enter two numbers ...
Get Gray Hat Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.