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 29,898 total registered users.


Recently Created Topics
Decompiling raw bina...
May/22
Incorrect bitness wh...
May/20
PaiMei stalker modul...
May/19
Attach to program us...
May/13
IDA PRO how to make ...
May/12
FACT: OpenRCE is dead.
May/08
Int 3 anti debug?
May/05
help needed - Beginn...
May/03
Attaching IDA Pro to...
Apr/27
File type
Apr/21


Recent Forum Posts
Ollydbg 2.0 - Plugin...
openrce...
IDA PRO how to make ...
codeinject
FACT: OpenRCE is dead.
codeinject
IDA Resource Viewer ...
r2x64
FACT: OpenRCE is dead.
djnemo
FACT: OpenRCE is dead.
codeinject
FACT: OpenRCE is dead.
pedram
help needed - Beginn...
araujo
Attaching IDA Pro to...
codeinject
Int 3 anti debug?
codeinject


Recent Blog Entries
lowpriority
Apr/13
OllyMigrate Plugin for Olly...

everdox
Mar/08
2 anti-trace mechanisms spe...

everdox
Mar/07
Advanced debugging techniques

everdox
Mar/06
Branch tracing and LBR acce...

everdox
Mar/05
Using pre-paged in virtual ...

More ...


Recent Blog Comments
clarisonic on:
Apr/03
New version of Ollydbg!

clarisonic on:
Apr/03
New version of Ollydbg!

trackerx90 on:
Mar/04
SuppressDebugMsg As Anti-De...

coachfactory on:
Feb/25
Portable Executable Format ...

coachfactory on:
Feb/25
A new Anti-Olly trick.

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit