📚
OpenRCE
is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.
About
Articles
Book Store
Distributed RCE
Downloads
Event Calendar
Forums
Live Discussion
Reference Library
RSS Feeds
Search
Users
What's New
Customize Theme
bluegrey
blackgreen
metal
simple
Flag:
Tornado!
Hurricane!
Login:
Password:
Remember Me
Register
Blogs
>>
sp
's Blog
Created: Saturday, January 21 2006 17:55.47 CST
Modified: Saturday, January 21 2006 17:55.47 CST
This is an imported entry.
View original
.
Printer Friendly ...
Porting the InstructionCounter plugin to Python
Author:
sp
# Views:
1844
The latest release of
IDAPython 0.8.0
gave me an incentive to look into the wonderful world of Python for the first time. Equipped with
the Python tutorial from the official Python website
and Google I decided to
port my InstructionCounter plugin to Python
, just to find out how Python and IDAPython work.
Here are my first impressions of Python:
1. Despite liberal use of empty lines the Python version is only 48 lines long, compared to the ~150 lines of the C++ plugin. I see four main reasons for this: The C++ plugin has 11 #include directives. Its also necessary to define the plugin structure and some functions IDA expects in the C++ version. If you use IDAPython this is done for you as part of the IDAPython IDA plugin. The third major reason is the lack of lambda expressions in C++ (unless you use something like Boost::lambda). The last reason is that my C++ plugin supports two versions of IDA (4.8 and 4.9) using some kind of conditional compilation which also takes a few lines of code. The actual functional code is pretty much the same in C++ and in Python.
2. Python string formatting using the well-known printf placeholders in combination with the % operator is pretty cool.
3. Where is the ternary operator? Seriously. Thats the main issue Im having with Python so far.
4. I like the Python collections a lot.
5. I think the : behind if-statements or loops should be dropped. Maybe theres some deeper meaning behind it but so far Ive only experienced it as syntax pollution.
6. Yay for aspects from functional programming (map, filter, reduce, ...).
7. IDAPython is pretty cool. A perfect intermediate step between IDC scripts and writing entire plugins. I dont think Ill ever write IDC scripts again.
If you wish to comment on this blog entry, please do so on the
original site
it was imported from.
There are
31,328
total registered users.
Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12
Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n
Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM
oleavr
Oct/24
Anatomy of a code tracer
hasherezade
Sep/24
IAT Patcher - new tool for ...
oleavr
Aug/27
CryptoShark: code tracer ba...
oleavr
Jun/25
Build a debugger in 5 minutes
More ...
Recent Blog Comments
nieo
on:
Mar/22
IAT Patcher - new tool for ...
djnemo
on:
Nov/17
Kernel debugger vs user mod...
acel
on:
Nov/14
Kernel debugger vs user mod...
pedram
on:
Dec/21
frida.github.io: scriptable...
capadleman
on:
Jun/19
Using NtCreateThreadEx for ...
More ...
Imagery
SoySauce Blueprint
Jun 6, 2008
[+] expand
View Gallery
(11) /
Submit