View Full Version : Precompiled PySide binaries for IDA Pro

Hex Blog
May 18th, 2011, 12:20
In a previous blog post ("http://www.hexblog.com/?p=229") we mentioned that it is possible to use IDA Pro with PySide ("http://www.pyside.org/") (Python + Qt) after applying some minor code patches to PySide.

For convenience purposes, we precompiled the PySide libraries that work with IDA Pro 6.0+ and Python 2.6.*Below is a brief explanation on how to install and use those*binaries ("http://hex-rays.com/idapro/idadown.htm").

Installing on Windows

Please download the package ("http://hex-rays.com/idapro/ida/windows_pyside_python26_package.zip") and unpack it to Path_to_Python26.

Installing on Linux or Mac OS

Please download the appropriate package (Linux ("http://hex-rays.com/idapro/ida/linux_pyside_python26_package.tgz") or Mac OS ("http://hex-rays.com/idapro/ida/mac_pyside_python26_package.tgz")) and unpack it:

sudo tar xvfz os_package_pyside_python26_package.tgz -C /

Building PySide from the sources

In order to build PySide for IDA Pro you need to use the modified PySide source files ("http://hex-rays.com/idapro/freefiles/pyside_patch_20110328.zip"). Please note that those modifications only apply to the PySide version that was released on 03/28/2011. To use newer versions of PySide merge those files with the new files.

Testing the installation

To test if PySide is installed properly, you can try running the following script ("http://idapython.googlecode.com/svn/trunk/Scripts/ImportExportViewer.py") which creates a tree widget and displays all imports and exports from the opened database:

http://www.hexblog.com/wp-content/uploads/2011/05/pyside_bins_thumb.gif ("http://www.hexblog.com/wp-content/uploads/2011/05/pyside_bins.gif")

Mixing C++ and Python

With PySide and IDAPython it is possible to write powerful scripts with a rich UI. Now the question is “how to write a UI in Python (with PySide) and still be able to call C/C++ functions?”

To achieve this, you need to expose your C/C++ functions to Python. It can be done with Ctypes ("http://docs.python.org/library/ctypes.html"),*SIP ("http://www.riverbankcomputing.co.uk/software/sip/download"),*SWIG ("http://swig.org/"), Shiboken ("http://www.pyside.org/docs/shiboken/"), other Python binding generators or with simple manual wrapping as demonstrated here ("http://www.hexblog.com/?p=126").

On the*Lynxline ("http://lynxline.com/")website you can find two interesting blog posts*demonstrating how to mix C++ and Python using SIP ("http://lynxline.com/qt-python-superhybrids/") or*Shiboken ("http://lynxline.com/superhybrids-part-2-now-qt-pyside/").

Happy coding! http://www.hexblog.com/wp-includes/images/smilies/icon_smile.gif