Weird error with IDA plugin

554 views
Skip to first unread message

Jun Koi

unread,
Aug 22, 2012, 3:36:27 AM8/22/12
to idap...@googlegroups.com
hi IDA experts,

on Windows XP 32bit, IDA 6.3, i wrote a small python code. it works
perfectly if i run it from menu "File/Script file".

then i want to register my code as a plugin, so i have code like this
in my script file:

......
if __name__ == "__main__":
idaapi.add_menu_item("Edit/Plugins/", "Testing", None, 0, code_test, None)


then i ran my code (selected "File/Script file"), and got no problem.
next, i chose menu "Edit/Plugins/Testing", but i got weird error like
on below code:

op1 = GetOpnd(off, 0)

The error reported is: "TypeError: 'NoneType' object is not callable"

i have no idea why i got this problem, given that if i run my Python
code_test() directly from "File/Script file" menu) without going thru
the Plugin menu, there is no such a problem.

this is pretty confused. any hint for me?

thanks so much,
Jun

Elias Bachaalany

unread,
Aug 22, 2012, 3:50:14 AM8/22/12
to idap...@googlegroups.com
Hi Jun,

Idapython plugin scrips unlike regular idapython scripts has to have a
specific structure and a special function called PLUGIN_ENTRY.

Do you have that?

HTH,
Elias
> --
> You received this message because you are subscribed to the Google Groups "idapython" group.
> To post to this group, send email to idap...@googlegroups.com.
> To unsubscribe from this group, send email to idapython+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/idapython?hl=en.
>

Jun Koi

unread,
Aug 22, 2012, 5:08:59 AM8/22/12
to idap...@googlegroups.com
On Wed, Aug 22, 2012 at 3:50 PM, Elias Bachaalany
<elias.ba...@gmail.com> wrote:
> Hi Jun,
>
> Idapython plugin scrips unlike regular idapython scripts has to have a
> specific structure and a special function called PLUGIN_ENTRY.
>
> Do you have that?

oops, only now i know that!

so once i have a script in python, how can i install my plugin?

thanks,
Jun

nir izraeli

unread,
Aug 22, 2012, 5:22:16 AM8/22/12
to idap...@googlegroups.com

put the .py file in IDAs plugins directory.

Elias Bachaalany

unread,
Aug 22, 2012, 4:19:48 PM8/22/12
to idap...@googlegroups.com
Hi Jun,

Check this out: http://www.hexblog.com/?p=120

Jun Koi

unread,
Aug 23, 2012, 12:06:32 AM8/23/12
to idap...@googlegroups.com
On Thu, Aug 23, 2012 at 4:19 AM, Elias Bachaalany
<elias.ba...@gmail.com> wrote:
> Hi Jun,
>
This doesnt seem to say where to put the plugin.

OK, so following Nir's hints, i put my Python plugin under c:\program
files\IDA\plugins directory. the problem is that my code has more than
one .py files, and IDA seems to look at every .py files, and complains
that some .py file is not in correct form.

so in this case, what is the proper way to install my python plugin for me?

Nir Izraeli

unread,
Aug 23, 2012, 4:17:52 AM8/23/12
to idap...@googlegroups.com
Hi Jun,
I'd try creating a directory with the name you want and including the plug-in initialization code in the __init__.py file. I assume you did follow hex-ray's blog post and created a PLUGIN_ENTRY function (and the appropriate plug-in class).

Never tried it though, so please let me know if it works :)

- Nir
Scanned by Check Point Total Security Gateway.
Reply all
Reply to author
Forward
0 new messages