A forum for reverse engineering, OS internals and malware analysis 

Discussion on reverse-engineering and debugging.
 #5650  by Cr4sh
 Fri Mar 25, 2011 9:15 pm
I'm using IDA 6.0 with IDAPython 1.4.3, and I need to create thread from the .py script.
My code looks like this:
Code: Select all
import time, thread

def test_proc(msg):

    while True:

        print msg
        time.sleep(1)

thread.start_new_thread(test_proc, ("Test", ))
But it doesn't work properly: created thread freezes immediately after the script execution.
So, anybody knows some working solution, to run background thread from python code in IDA?
 #5657  by newgre
 Sat Mar 26, 2011 4:51 am
IDA is inherently NOT multithreading safe. Many APIs rely upon global state which will cause problems with multiple threads.
You can however create multiple threads if these do not interface the IDA API.
 #5695  by Cr4sh
 Mon Mar 28, 2011 3:30 pm
newgre wrote:IDA is inherently NOT multithreading safe. Many APIs rely upon global state which will cause problems with multiple threads.
You can however create multiple threads if these do not interface the IDA API.
I need in thread creation for running XMLRPC server to dispatch callback events from Ubigraph.
Finally, I solved problem with thread creation from python code by writing a small DLL, that makes CreateThread() + PyRun_SimpleString("my_module.dispatch_callbacks()").

Some interesting pics:
http://dl.dropbox.com/u/22903093/Ubigraph_and_IDA.gif
http://dl.dropbox.com/u/22903093/Worspace.JPG