Giter Site home page Giter Site logo

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 https://www.hex-rays.com/products/ida/support/idapython_docs/

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

Installation from binaries

  1. Install latest Python 3.x version from https://www.python.org/
  2. Copy the whole "python" directory to %IDADIR%
  3. Copy "idapython.cfg" to %IDADIR%\cfg

Usage

  • Run script: File / Script file (Alt+F7)
  • Execute Python statement(s) (Shift+F2)
  • 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 https://hex-rays.com/blog/running-scripts-from-the-command-line-with-idascript/)

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 idapython.cfg file.

Invoking Python from IDC

The IDAPython plugin exposes a new IDC function exec_python(string python_code) that allows execution of Python code from IDC.

Invoking IDC from Python

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

Switching the default language between Python and IDC

By default, IDA will use IDC to evaluate expressions in dialog boxes and in eval_expr().
It is possible to change the default language to Python.

In order to do that, use the following (IDC/Python) code:

load_and_run_plugin("idapython", 3)

To go back to IDC, use the following code:

load_and_run_plugin("idapython", 4)

idapython's Projects

pyhexraysdeob icon pyhexraysdeob

A port of Rolf Rolles' https://github.com/RolfRolles/HexRaysDeob to Python

src icon src

IDAPython project for Hex-Ray's IDA Pro

swig icon swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.