Flag: Tornado! Hurricane!

 Forums >>  Debuggers  >>  pydbg thread missing context

Topic created on: December 30, 2009 22:09 CST by mangel12321 .

Greeting everyone,

First of all, great job for site, this is one the only real community I've found so far around pydbg, anyways I just started playing with pydbg not too long ago (after reading Gray Hat Python). I need to get information for a Windows app. API hooking will not work in this case, so I am forced to go lower and get the data from the stack. The main thread does not contain the information I am looking for, it is in one of its child processes. Anyways, the approach I am trying to follow goes something like this:

1. Attach to the main process
2. Find the Thread I am interested on
3. Set some event handlers to know when an event has happened (I guess the appropiate way would be to use breakpoints, but at this point I dont know where exactly put them)
4. Look over the stack for ASCII/UNICODE text until I find what I am interested on.

The problem I am encountering is on how to print the stack for strings that I am interested on. As I understand, on pydbg, you have to first stop all the threads, take a snapshot (then is when you get the context) and finally resume the threads. My problem is that I can not seem to initialize a context for any of the threads (neither the father nor the childs).

At this point I am stuck, I am aware this is not the most elegant way to do it, but it is the only I could think on.
Any feedback or suggestions are more than welcome!

Thank you very much!
Miguel

  ResearchAviator     December 31, 2009 21:36.52 CST
Hi Miguel,

I have also faced the same issue while working with snapshots. I suppose many of the source code examples illustrated in the text "Gray Hat Python" is not working as claimed. I was able to tweak the rest of the examples except this.

Regards,
VLD.

> mangel12321: Greeting everyone,
>
> First of all, great job for site, this is one the only real community I\'ve found so far around pydbg, anyways I just started playing with pydbg not too long ago (after reading Gray Hat Python). I need to get information for a Windows app. API hooking will not work in this case, so I am forced to go lower and get the data from the stack. The main thread does not contain the information I am looking for, it is in one of its child processes. Anyways, the approach I am trying to follow goes something like this:
>
> 1. Attach to the main process
> 2. Find the Thread I am interested on
> 3. Set some event handlers to know when an event has happened (I guess the appropiate way would be to use breakpoints, but at this point I dont know where exactly put them)
> 4. Look over the stack for ASCII/UNICODE text until I find what I am interested on.
>
> The problem I am encountering is on how to print the stack for strings that I am interested on. As I understand, on pydbg, you have to first stop all the threads, take a snapshot (then is when you get the context) and finally resume the threads. My problem is that I can not seem to initialize a context for any of the threads (neither the father nor the childs).
>
> At this point I am stuck, I am aware this is not the most elegant way to do it, but it is the only I could think on.
> Any feedback or suggestions are more than welcome!
>
> Thank you very much!
> Miguel

Note: Registration is required to post to the forums.

Active in Last 5 Minutes
jesucito81

There are 28,225 total registered users.


Recently Created Topics
Reverse Engineering ...
Jan/23
Career: DoD Agency I...
Jan/22
"Disappearing&q...
Jan/17
Career: Software Sec...
Jan/11
Where is the call st...
Jan/07
IDA Pro 6.1 Breakpoi...
Jan/01
How to create data s...
Dec/30
can i search all mod...
Dec/23
IDA symbol table exp...
Dec/20
An anti-attach trick
Dec/17


Recent Forum Posts
Reverse Engineering ...
NirIzr
"Disappearing&q...
NirIzr
Reverse Engineering ...
charlie
"Disappearing&q...
charlie
An anti-attach trick
Bass
An anti-attach trick
waleeda...
An anti-attach trick
Bass
An anti-attach trick
waleeda...
An anti-attach trick
Bass
Looking for value in...
NirIzr


Recent Blog Entries
cmathieu
Feb/07
Hacker Carnival

waleedassar
Feb/06
OllyDbg v1.10 And Hardware ...

waleedassar
Jan/31
Yet Another Anti-Debug Trick

RolfRolles
Jan/22
Finding Bugs in VMs with a ...

waleedassar
Jan/13
An OllyDbg Bug Disables Sof...

More ...


Recent Blog Comments
waleedassar on:
Feb/07
OllyDbg v1.10 And Hardware ...

NirIzr on:
Feb/07
OllyDbg v1.10 And Hardware ...

NirIzr on:
Feb/05
Yet Another Anti-Debug Trick

trolotou on:
Feb/05
Doudoune Moncler -Pennies F...

waleedassar on:
Feb/01
Yet Another Anti-Debug Trick

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit