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








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  IDA pro and pydbg

Topic created on: April 10, 2012 11:57 CDT by tosanjay .

Hi,
Is it possible to use pydbg within IDA pro? I am using pydbg for hooking. The script runs fine normally, but when i try to use the same script within IDA pro, via IDAPython, it fails. any suggestions?
thanks

  NirIzr     April 10, 2012 15:40.56 CDT
would be helpful if you could specify what exactly do you see, and what exactly the problem is.

  tosanjay     April 12, 2012 04:25.41 CDT
> NirIzr: would be helpful if you could specify what exactly do you see, and what exactly the problem is.
Ok. As i mentioned, I am using pydbg to hook certain API, e.g. ReadFile. When i run the script under IDA, it is able to attach to the process, but after that it does nothing (though I am printing certain information). I see the dialog box which says that executing python script... When i cancel that box, the script fails with the following error:
---------------------------------
---------------------------------------------------------------------------
[*] Trying to attach to existing player.exe
[*] Attaching to player.exe (4816)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:Program FilesIDApythoninit.py", line 65, in runscript
    execfile(script, g)
  File "E:/readFileHook.py", line 379, in <module>
    main()
  File "E:/readFileHook.py", line 326, in main
    hook_addressRead=dbg.func_resolve_debuggee("kernel32", "ReadFile")
  File "C:Python25Libsite-packagespydbgpydbg.py", line 1785, in func_resolve_debuggee
    dos_header   = self.read_process_memory(base_address, 0x40)
  File "C:Python25Libsite-packagespydbgpydbg.py", line 2811, in read_process_memory
    raise pdx("ReadProcessMemory(%08x, %d, read=%d)" % (address, length, count.value), True)
pydbg.pdx.pdx: [6] ReadProcessMemory(7c800000, 64, read=0): The handle is invalid.

---------------------------------
From this, what I undersstand is that is it not able to find the address of the ReadFile function from kernel32.dll. Without IDA, it is working fine.

I am using IDA pro because I want to get some high level info regarding functions during pydbg run.
Any suggestions why it is failing?
thanks

  tosanjay     April 12, 2012 05:01.50 CDT
The above problem is solved. there was an incorrect code in my script. But, now i am having another problem. In certain cases, IDA pro is itself terminating abnormally. Once I run my script, before i could start getting any information out of my script, I get an error message in IDA from saying "access violation in address xxxxxxx in hexrays.plw. Read of address 00000004." I have no idea why it is happening with certain exes. some help plz!!

  vavsnz     April 14, 2012 12:44.32 CDT

  tosanjay     April 17, 2012 09:09.16 CDT
> vavsnz:
there is an empty mail from you. Did you write something that got lost somehow? I asked this as I am waiting for someone to give some hints.
thanks

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