def run(self,processConfig): from dispatcher.core.structures.Tracer import InputMonitor as InputMonitor from dispatcher.core.structures.Tracer.Arch.x86.Windows import WindowsApiCallbacks as WindowsApiCallbacks from dispatcher.core.structures.Tracer.Arch.x86.Linux import LinuxApiCallbacks as LinuxApiCallbacks EThook = self.setDebuggerOptions(processConfig,False) filters = dict() os_type = processConfig.getOsType() fileFilter = processConfig.getFileFilter() networkFilter = processConfig.getNetworkFilter() if os_type == "macosx": Print( "Setting MacOsxApiCallbacks" ) EThook.checkInput = InputMonitor.checkMacLibs elif os_type == "windows": Print( "Setting WindowsApiCallbacks" ) EThook.checkInput = InputMonitor.checkWindowsLibs if fileFilter is not None: Print( "Setting file filters for windows" ) filters['file'] = fileFilter EThook.bCheckFileIO = True self.windowsFileIO.SetDebuggerInstance(EThook) self.windowsFileIO.SetFilters(filters) self.windowsFileIO.SetLoggerInstance(self.logger) if networkFilter is not None: Print( "Setting network filters for windows" ) filters['network'] = networkFilter EThook.bCheckNetworkIO = True self.windowsNetworkIO.SetDebuggerInstance(EThook) self.windowsNetworkIO.SetFilters(filters) self.windowsNetworkIO.SetLoggerInstance(self.logger) elif os_type == "linux": Print( "Setting LinuxsApiCallbacks" ) EThook.checkInput = InputMonitor.checkLinuxLibs if fileFilter is not None: filters['file'] = fileFilter EThook.bCheckFileIO = True self.linuxFileIO.SetDebuggerInstance(EThook) self.linuxFileIO.SetFilters(filters) self.linuxFileIO.SetLoggerInstance(self.logger) if networkFilter is not None: filters['network'] = networkFilter EThook.bCheckNetworkIO = True self.linuxNetworkIO.SetDebuggerInstance(EThook) self.linuxNetworkIO.SetFilters(filters) self.linuxNetworkIO.SetLoggerInstance(self.logger) self.logger.info("Starting to trace..please wait...") idaapi.run_to(idaapi.cvar.inf.maxEA)
def interactive(self,processConfig): from dispatcher.core.structures.Tracer import InteractivemodeCallbacks as InteractivemodeCallbacks EThook = self.setDebuggerOptions(processConfig,True) self.interactivemodeCallback.SetDebuggerInstance(EThook) self.interactivemodeCallback.SetLoggerInstance(self.logger) idaapi.run_to(idaapi.cvar.inf.maxEA)