Cannot get command output

Jan 29, 2015 at 1:03 AM

I want to use pykd to run the !exploitable extension and obtain the output. Below is my code:
import pykd


#The app will crash

#Prints crash site information
r_o = pykd.dbgCommand('r')
print r_o

# Obtain diagnosis info from !exploitable
loadRet = pykd.dbgCommand("!load msec.dll")
expRet = pykd.dbgCommand("!exploitable")
print loadRet
print expRet
However, the last two lines only prints out empty strings.

If I directly run the two commands in windbg, I will get the expected result:

*** ERROR: Symbol file could not be found. Defaulted to export symbols for NitroPDFReader.exe -
Exploitability Classification: UNKNOWN
Recommended Bug Title: Data from Faulting Address controls Branch Selection starting at npdf!ProvideCoreHFT2+0x0000000000024db0 (Hash=0x74643704.0xe1564712)

Could you please tell me how can I properly obtain the result in Python?

Thank you!
Jan 29, 2015 at 5:23 AM
loadRet = pykd.dbgCommand("!load msec.dll")
I think it is misprint and It shhould be:
loadRet = pykd.dbgCommand(".load msec.dll")
Jan 29, 2015 at 12:27 PM
Thank you, but changing "!" to "." gives the same empty result.

Also, the following two commands are what I use when manually do the debugging

!load msec.dll
Jan 29, 2015 at 4:29 PM
  • try use full path to msec.dll: pykd.dbgCommand(".load c:\dir\msec.dll")
  • try call pykd.loadExt, example:
class ext_loader:
    def __init__(self, name):
        self._name = name
    def __enter__(self):
        self._ext = pykd.loadExt(self._name)
    def __exit__(self, exc_type, exc_value, exc_tb):
    with ext_loader(os.path.join(windbg_dir, "winext\\ext.dll")):
        for line in pykd.dbgCommand("!analyze -v").split("\n"):
            print line
  • check python.exe and msec.dll platform mismatch (x86/x64)
Jan 29, 2015 at 5:15 PM
Thank you! The full path solves this problem!