Hi guys,
here is my problem : I'm writing a fuzzer for firefox using PyDBG. I need to run firefox with a .html file as arg and then after a while (i.e. XXX seconds) "kill" the process, and then move to another test case. But I had some problems in killing the process and re-start firefox. Here is an initial part of my code :
...
while(1):
...
dbg = pydbg()
dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, av_handler)
arg = "C:\\somefile.html"
dbg.load("C:\\Programs\\Mozilla Firefox\\firefox.exe", arg)
dbg.run()
...
# save some coverage infos
...
# here i kill the process
for (pid, proc_name) in dbg.enumerate_processes():
if proc_name.lower() == "firefox.exe":
hhh = kernel32.OpenProcess(PROCESS_ALL_ACCESS, False, pid)
kernel32.TerminateProcess(hhh, 0)
... # loop again
The problem here is that most of time I'm not doing the righ thing and firefox crashes (but not because of the input file :-P) or try to restore the previous page, while a would just close the browser when the html file computation ended. Can someone suggest me something better ? I also need a way to kill the process if it takes too long time to complete a computation (i.e. in case of DoS). Is it possible to put together this kind of stuff ?
Thank you
c.





