IDAPython project for Hex-Ray's IDA Pro
Clone or download
aundro Merge pull request #14 from chehsunliu/master
Add a missing closing tag in idapython.vcxproj.
Latest commit a3855ab Jun 19, 2018
Permalink
Failed to load latest commit information.
Scripts IDAPython for IDA 7.1 Feb 28, 2018
docs IDAPython for IDA 7.0: Initial commit, plus bugfixes up to 2017 Oct, … Oct 13, 2017
examples IDAPython for IDA 7.1 Feb 28, 2018
out_of_tree IDAPython for IDA 7.1 Feb 28, 2018
python IDAPython for IDA 7.1 Feb 28, 2018
pywraps IDAPython for IDA 7.1 Feb 28, 2018
swig IDAPython for IDA 7.1 Feb 28, 2018
tools IDAPython for IDA 7.1 Feb 28, 2018
AUTHORS.txt IDA Pro 6.6 support Jul 4, 2014
BUILDING.txt Fix 'dist' phase on windows Jan 8, 2016
CONTRIBUTING.md Let's make the octocat happy with a nice 'CONTRIBUTING.md' page. Jul 9, 2015
COPYING.txt IDAPython 1.4.0 - IDA Pro 5.7 support Jun 28, 2010
HOWTO.md IDAPython for IDA 7.1 Feb 28, 2018
README.md IDAPython for IDA 7.0: Initial commit, plus bugfixes up to 2017 Oct, … Oct 13, 2017
STATUS.txt IDAPython for IDA 7.0: Initial commit, plus bugfixes up to 2017 Oct, … Oct 13, 2017
api_contents.txt IDAPython for IDA 7.1 Feb 28, 2018
build.py IDAPython for IDA 7.1 Feb 28, 2018
idaapi.i IDA Pro 6.7 support Feb 8, 2015
idapython.sln IDA Pro 6.8 support Apr 20, 2015
idapython.vcxproj Add a missing closing tag in idapython.vcxproj. Jun 19, 2018
idapython.vcxproj.filters IDAPython for IDA 7.0: Initial commit, plus bugfixes up to 2017 Oct, … Oct 13, 2017
makefile IDAPython for IDA 7.1 Feb 28, 2018
pydoc_injections.txt IDAPython for IDA 7.1 Feb 28, 2018
python.cfg IDAPython for IDA 7.1 Feb 28, 2018
python.cpp IDAPython for IDA 7.1 Feb 28, 2018
pywraps.cpp IDAPython for IDA 7.1 Feb 28, 2018
pywraps.hpp IDAPython for IDA 7.1 Feb 28, 2018

README.md

IDAPython

Python plugin for Interactive Disassembler

IDAPython is an IDA plugin which makes it possible to write scripts for IDA in the Python programming language. IDAPython provides full access to both the IDA API and any installed Python module.

Check the scripts in the examples directory to get an quick glimpse.

Availability

Latest stable versions of IDAPython are available from https://github.com/idapython/src

Resources

The full function cross-reference is readable online at http://www.hex-rays.com/idapro/idapython_docs/

Mailing list for the project is hosted by Google Groups at http://groups.google.com/group/idapython

Installation from binaries

  1. Install 2.6 or 2.7 from http://www.python.org/
  2. Copy the whole "python" directory to %IDADIR%
  3. Copy the contents of the "plugins" directory to the %IDADIR%\plugins\
  4. Copy "python.cfg" to %IDADIR%\cfg

Usage

  • Run script: File / Script file (Alt-F7)
  • Execute Python statement(s) (Ctrl-F3)
  • Run previously executed script again: View / Recent Scripts (Alt+F9)
  • Batch mode execution:

Start IDA with the following command line options:

-A -OIDAPython:yourscript.py file_to_work_on or -Syourscript.py or -S"yourscript.py arg1 arg2 arg3"

(Please see http://www.hexblog.com/?p=128)

If you want fully unattended execution mode, make sure your script exits with a qexit() call.

By default scripts run after the database is opened. Extended option format is:

-OIDAPython:[N;]script.py

Where N can be: 0: run script after opening database (default) 1: run script when UI is ready 2: run script immediately on plugin load (shortly after IDA starts and before processor modules and loaders)

  • User init file

You can place your custom settings to a file called 'idapythonrc.py' that should be placed to

${HOME}/.idapro/

or

%AppData%\Hex-Rays\IDA Pro

The user init file is read and executed at the end of the init process.

Please note that IDAPython can be configured with "python.cfg" file.

  • Invoking Python from IDC

The IDAPython plugin exposes a new IDC function "RunPythonStatement(string idc_code)" that allows execution of Python code from IDC

  • Invoking IDC from Python

It is possible to use the idc.eval() to evaluate IDC expressions from Python

  • Making Python the default language

By default, IDA will use IDC to evaluate expressions. It is possible to change the default language to use Python instead of IDC.

In order to do that, please use the following IDC code:

load_and_run_plugin("python", 3)

To disable Python language and revert back to IDC: load_and_run_plugin("python", 4)