Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import idaapi
import idautils
import jayutils
import vivisect
import vivisect.impemu as viv_imp
import vivisect.impemu.monitor as viv_imp_monitor
from visgraph import pathcore as vg_path
########################################################################
#
#
########################################################################
class RegMonitor(viv_imp_monitor.EmulationMonitor):
'''
This tracks all register changes, even if it's not currently an interesting reg
because we need to trace register changes backwards.
'''
def __init__(self, regs):
viv_imp_monitor.EmulationMonitor.__init__(self)
self.logger = jayutils.getLogger('argracker.RegMonitor')
self.regs = regs[:]
self.reg_map = {}
def prehook(self, emu, op, starteip):
try:
#self.logger.debug('prehook: 0x%08x', starteip)
self.cachedRegs = emu.getRegisters()
self.startEip = starteip