O'Reilly logo

Gray Hat Python by Justin Seitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required