📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Debuggers  >>  ImportError in Immunity Debugger importing gtk the 2nd time

Topic created on: October 29, 2009 00:16 CDT by sagar .

Hi everybody,
I'm having a strange problem with immunity debugger v1.73

I have a simple script that I run:

import immlib
import gtk

def main():
    imm = immlib.Debugger()    
    imm.Log("Testing import gtk...")  
    imm.Log("GTK = %s" % str(gtk))
    
if __name__=="__main__":
    pass


This works fine the first time I run it (ALT + F3)
I doesn't show anything abnormal.

But if I run the script a second time, I get this error message:

Traceback (most recent call last):
File "C:\Program Files\Immunity Inc\Immunity Debugger\PyScript\TestGTK.py", line 3, in <module>
  import gtk
File "./Libs\immutils.py", line 89, in __MOSDEFimport__
  return sys.modules['__builtin__'].__import__orig(*args)
File "D:\Python25\Lib\site-packages\gtk-2.0\gtk\__init__.py", line 50, in <module>
  import gdk
File "./Libs\immutils.py", line 89, in __MOSDEFimport__
  return sys.modules['__builtin__'].__import__orig(*args)
ImportError: No module named gdk


I have tried deactivating the MOSDEFimport hook inside immutils.py but the same error happens.
The strange thing is that it seems to happen only with gtk module. I'm able to import other external modules without problems.
If I try to run the script a third time, then the debugger fails and closes.

The weird thing is that the first time works ok... I'm able to create windows and use gtk module, but only once.

I've tried to modify the immutils.py to import gtk module and add a function that simply returns that module object. Then I changed my simple script to import immutils and use that function instead of importing gtk, and the first time it works, but the second time the gtk module it is not defined...

Any ideas?

Regards,

Sagar

  sagar     October 29, 2009 07:37.35 CDT
Another test that showed strange behavior importing gtk module is this:

- open the immunity debugger python shell
- import gtk
- close the shell window

If you just try to open the shell, the whole debugger hangs...and you have to kill the process.

gtk module must be doing something strange...

  hockeyhater   November 4, 2011 08:05.49 CDT
Hello there, it occurs to me, that a very possible fix to this is, keep up with the hockey, bro.


> sagar: Hi everybody,
> I\'m having a strange problem with immunity debugger v1.73
>
> I have a simple script that I run:
>
> import immlib
> import gtk
>
> def main():
>     imm = immlib.Debugger()    
>     imm.Log(\"Testing import gtk...\")  
>     imm.Log(\"GTK = %s\" % str(gtk))
>    
> if __name__==\"__main__\":
>     pass
>

>
> This works fine the first time I run it (ALT + F3)
> I doesn\'t show anything abnormal.
>
> But if I run the script a second time, I get this error message:
>
> Traceback (most recent call last):
> File \"C:\\Program Files\\Immunity Inc\\Immunity Debugger\\PyScript\\TestGTK.py\", line 3, in <module>
>   import gtk
> File \"./Libs\\immutils.py\", line 89, in __MOSDEFimport__
>   return sys.modules[\'__builtin__\'].__import__orig(*args)
> File \"D:\\Python25\\Lib\\site-packages\\gtk-2.0\\gtk\\__init__.py\", line 50, in <module>
>   import gdk
> File \"./Libs\\immutils.py\", line 89, in __MOSDEFimport__
>   return sys.modules[\'__builtin__\'].__import__orig(*args)
> ImportError: No module named gdk
>

>
> I have tried deactivating the MOSDEFimport hook inside immutils.py but the same error happens.
> The strange thing is that it seems to happen only with gtk module. I\'m able to import other external modules without problems.
> If I try to run the script a third time, then the debugger fails and closes.
>
> The weird thing is that the first time works ok... I\'m able to create windows and use gtk module, but only once.
>
> I\'ve tried to modify the immutils.py to import gtk module and add a function that simply returns that module object. Then I changed my simple script to import immutils and use that function instead of importing gtk, and the first time it works, but the second time the gtk module it is not defined...
>
> Any ideas?
>
> Regards,
>
> Sagar

Note: Registration is required to post to the forums.

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