windows.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:vivisect-py3 作者: bat-serjo 项目源码 文件源码
def jit(vdb, line):
    '''
    Enable/Disable the current VDB location as the current Just-In-Time
    debugger for windows applications.

    Usage: jitenable [-D]
    -E  Enable VDB JIT debugging
    -D  Disable JIT debugging
    '''
    argv = e_cli.splitargs(line)
    try:
        opts, args = getopt.getopt(argv, "ED")
    except Exception as e:
        return vdb.do_help('jit')

    try:
        import winreg
    except Exception as e:
        vdb.vprint('Error Importing _winreg: %s' % e)
        return

    HKLM = winreg.HKEY_LOCAL_MACHINE
    HKCU = winreg.HKEY_CURRENT_USER
    REG_SZ = winreg.REG_SZ

    regpath = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug'
    # wow64path = r'SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug'

    # regkey = _winreg.CreateKey(HKLM, regpath)
    regkey = winreg.CreateKey(HKLM, regpath)

    vdb.vprint('JIT Currently: %s' % winreg.QueryValueEx(regkey, 'Debugger')[0])

    setval = None
    for opt, optarg in opts:

        if opt == '-D':
            setval = ''

        elif opt == '-E':
            vdbpath = os.path.abspath(sys.argv[0])
            setval = '%s %s -r -p %%ld -e %%Id' % (sys.executable, vdbpath)
            # _winreg.SetValue(HKLM

    if setval != None:
        vdb.vprint('Setting JIT: %s' % (setval,))
        winreg.SetValueEx(regkey, 'Debugger', None, REG_SZ, setval)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号