Пример #1
0
    def __init__(self):
        reg_infos = idaapi.dbg_get_registers()
        if not reg_infos:
            raise RuntimeError("Debugger not present.")

        self._reg_infos = [
            self.RegisterInfo(*reg_info) for reg_info in reg_infos
        ]
Пример #2
0
def test_getregs():
    L = idaapi.dbg_get_registers()
    # name flags class dtyp bit_strings bit_strings_default_mask
    for (name, flags, cls, dtype, bit_strings, bit_strings_default_mask) in L:
        print "name=<%s> flags=%x class=%x dtype=%x bit_strings_mask=%x" % (name, flags, cls, dtype, bit_strings_default_mask)
        if bit_strings:
            for s in bit_strings:
                print "  %s" % s
Пример #3
0
def test_getregs():
    L = idaapi.dbg_get_registers()
    # name flags class dtyp bit_strings bit_strings_default_mask
    for (name, flags, cls, dtype, bit_strings, bit_strings_default_mask) in L:
        print "name=<%s> flags=%x class=%x dtype=%x bit_strings_mask=%x" % (
            name, flags, cls, dtype, bit_strings_default_mask)
        if bit_strings:
            for s in bit_strings:
                print "  %s" % s
Пример #4
0
def get_arch_dynamic():
    """
    Determine the execution environments architecture.
    :return: 'x64' or 'x86' if arch could be determined, else None
    """
    info = idaapi.get_inf_structure()
    if info.is_64bit():
        return 64
    elif info.is_32bit():
        return 32
    else:
        env = idaapi.dbg_get_registers()
        if env[17][0] == 'RAX':
            return 64
        elif env[17][0] == 'EAX':
            return 32
        else:
            return None
Пример #5
0
def get_arch_dynamic():
    """
    Determine the execution environments architecture.
    :return: 'x64' or 'x86' if arch could be determined, else None
    """
    info = idaapi.get_inf_structure()
    if info.is_64bit():
        return 64
    elif info.is_32bit():
        return 32
    else:
        env = idaapi.dbg_get_registers()
        if env[17][0] == 'RAX':
            return 64
        elif env[17][0] == 'EAX':
            return 32
        else:
            return None
Пример #6
0
def get_arch():
    global Arch
    """
    Get the target architecture.
    Supported archs: x86 32-bit, x86 64-bit, ARM 32-bit
    """
    arch = None
    bits = None
    _common_dbg()
    registers = idaapi.dbg_get_registers()
    if not registers:
        print('please select debugger first')
        return None
    for x in registers:
        name = x[0]
        if name == 'RAX':
            arch = 'amd64'
            bits = 64
            break
        elif name == 'EAX':
            arch = 'x86'
            bits = 32
            Arch = X86()
            break
        elif name == 'R0':
            arch = 'arm'
            bits = 32
            Arch = ARM32()
            break
        elif name == 'X0':
            arch = 'arm64'
            bits = 64
            Arch = ARM64()
            break

    return arch, bits
Пример #7
0
    def __init__(self):
        reg_infos = idaapi.dbg_get_registers()
        if not reg_infos:
            raise RuntimeError("Debugger not present.")

        self._reg_infos = [self.RegisterInfo(*reg_info) for reg_info in reg_infos]
Пример #8
0
# coding=utf-8
from PyQt5 import QtCore, QtGui, QtWidgets
import idaapi, idc
from Qing.common import WordObj
from Qing import config, common
from Qing.config import DebugMode
import re
import Qing.func_utils as func_utils
from Qing.struct_utils import WatchVar
from Qing.QtBase import QtUiShow

_watch_debug = common.Debugger()
regs = set()
for _r in idaapi.dbg_get_registers():
    regs.add(_r[0])
_watch_debug.off()


class VarWatcher(QtUiShow):
    def __init__(self, dbginfo):
        super(VarWatcher, self).__init__()
        self.dbginfo = dbginfo
        self.funcargs = dbginfo.funcarg
        self.watchfn = {}
        self.funclist = {}
        # self.parent = None
        self.bptree = None
        self.watchtree = None
        self.bpinput = None
        self.addrinput = None
        self.printout = None