Ejemplo n.º 1
0
        }
        #There is a capstone branch that should fix all these annoyances... soon
        #https://github.com/aquynh/capstone/tree/next
        used = set()
        for ri in reg_sizes.keys():
            if instruction.reg_read(ri) or instruction.reg_write(ri):
                if not(instruction.reg_read(reg_sizes[ri]) or instruction.reg_write(reg_sizes[ri])):
                    if str(instruction.reg_name(reg_sizes[ri]).upper()) not in registers.keys():
                        used.add(ri)

        for ri in used:
            reg_name = str(instruction.reg_name(ri).upper())
            registers[reg_name] = gdb.getR(reg_name)

        #special case for flags...                
        if instruction.mnemonic.upper() in flags.keys():
            EFLAGS = gdb.getR('EFLAGS')
            for fl in flags[instruction.mnemonic.upper()]['tested']:
                registers[fl] = (EFLAGS&flags_maks[fl]) != 0
            for fl in flags[instruction.mnemonic.upper()]['defined']:
                registers[fl] = (EFLAGS&flags_maks[fl]) != 0
            if 'regs' in flags[instruction.mnemonic.upper()]:
                for rg in flags[instruction.mnemonic.upper()]['regs']:
                    registers[rg] = gdb.getR(rg)




        #operands
        for o in instruction.operands:
            if o.type == X86_OP_IMM:
Ejemplo n.º 2
0
        }
        #There is a capstone branch that should fix all this annoyances .. soon
        #https://github.com/aquynh/capstone/tree/next
        used = set()
        for ri in reg_sizes.keys():
            if instruction.reg_read(ri) or instruction.reg_write(ri):
                if not(instruction.reg_read(reg_sizes[ri]) or instruction.reg_write(reg_sizes[ri])):
                    if str(instruction.reg_name(reg_sizes[ri]).upper()) not in registers.keys():
                        used.add(ri)

        for ri in used:
            reg_name = str(instruction.reg_name(ri).upper())
            registers[reg_name] = gdb.getR(reg_name)

        #special case for flags...                
        if instruction.mnemonic.upper() in flags.keys():
            EFLAGS = gdb.getR('EFLAGS')
            for fl in flags[instruction.mnemonic.upper()]['tested']:
                registers[fl] = (EFLAGS&flags_maks[fl]) != 0
            for fl in flags[instruction.mnemonic.upper()]['defined']:
                registers[fl] = (EFLAGS&flags_maks[fl]) != 0
            if 'regs' in flags[instruction.mnemonic.upper()]:
                for rg in flags[instruction.mnemonic.upper()]['regs']:
                    registers[rg] = gdb.getR(rg)




        #operands
        for o in instruction.operands:
            if o.type == X86_OP_IMM: