Пример #1
0
            LogLevel = logging.INFO

    logger.setLevel(LogLevel)

    ch = logging.StreamHandler()
    ch.setLevel(LogLevel)

    ch.setFormatter(formatter)
    logger.addHandler(ch)

    # register our own event callbacks
    mask = DbgEng.DEBUG_EVENT_BREAKPOINT
    event_callback = MyDebugEventCallbacks(mask)

    # initialize the debugger
    dbgx = PyDbgX(event_cb=event_callback)

    # bind PyDbgX instance to the event callbakcs
    event_callback.bind_pydbgx(dbgx)

    # create target process: notepad.exe
    # note: can not debug x64 executable with 32 bit python
    dbgx.create_process('notepad.exe')

    # active the process so that we can set breakpoints on it
    dbgx.active_process()

    # set a breakpoint on API CreateFileW
    BpId = dbgx.set_software_breakpoint_exp('Kernel32!CreateFileW')

    # set the effective processor to x86 if the target is a x86 application
Пример #2
0
            LogLevel = logging.INFO

    logger.setLevel(LogLevel)

    ch = logging.StreamHandler()
    ch.setLevel(LogLevel)

    ch.setFormatter(formatter)
    logger.addHandler(ch)
    
    # register our own event callbacks
    mask = DbgEng.DEBUG_EVENT_BREAKPOINT | DbgEng.DEBUG_EVENT_LOAD_MODULE
    event_callback = MyDebugEventCallbacks(mask)

    # initialize the debugger
    dbgx = PyDbgX(event_cb=event_callback)

    # bind PyDbgX instance to the event callbakcs
    event_callback.bind_pydbgx(dbgx)

    # create target process: iexplore.exe
    # note: can not debug x64 executable with 32 bit python
    dbgx.create_process('c:\\Program Files (x86)\\Internet Explorer\\iexplore.exe', True)

    # active the process
    dbgx.active_process()

    # set the effective processor to x86 if the target is a x86 application
    dbgx.set_effective_processor('x86')
    
    # wait for debug event