Пример #1
0
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)

        if args.has_key('Command'):
            self.Command = str(args['Command']).replace("'''", "")
        else:
            self.Command = None

        if args.has_key('Arguments'):
            self.Arguments = str(args['Arguments']).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        self._name = "OsxProcess"
        self.pid = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #2
0
Файл: osx.py Проект: KurSh/peach
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)
        self._name = "CrashReporter"

        if args.has_key('ProcessName'):
            self.process_name = str(args['ProcessName']).replace("'''", "")
            self.process_name = os.path.basename(self.process_name)
        else:
            self.process_name = None

        if args.has_key('LogFolder'):
            self.log_folder = str(args['LogFolder']).replace("'''", "")
        else:
            self.logFolder = os.path.join(os.environ['HOME'], "Library/Logs/DiagnosticReports")

        if args.has_key('LookoutTime'):
            self.lookout_time = float(args['LookoutTime']).replace("''", "")
        else:
            self.lookout_time = None

        self.data = None
        self.starting_files = None
Пример #3
0
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)
        self._name = "CrashReporter"

        if args.has_key('ProcessName'):
            self.process_name = str(args['ProcessName']).replace("'''", "")
            self.process_name = os.path.basename(self.process_name)
        else:
            self.process_name = None

        if args.has_key('LogFolder'):
            self.log_folder = str(args['LogFolder']).replace("'''", "")
        else:
            self.logFolder = os.path.join(os.environ['HOME'],
                                          "Library/Logs/DiagnosticReports")

        if args.has_key('LookoutTime'):
            self.lookout_time = float(args['LookoutTime']).replace("''", "")
        else:
            self.lookout_time = None

        self.data = None
        self.starting_files = None
Пример #4
0
Файл: osx.py Проект: KurSh/peach
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)

        if args.has_key('Command'):
            self.Command = str(args['Command']).replace("'''", "")
        else:
            self.Command = None

        if args.has_key('Arguments'):
            self.Arguments = str(args['Arguments']).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        self._name = "OsxProcess"
        self.pid = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #5
0
		def __init__(self, args):
			Monitor.__init__(self, args)
			
			self.started = None
			# Set at start of exception handling
			self.handlingFault = None
			# Set when collection finished
			self.handledFault = None
			self.crashInfo = None
			self.fault = False
			self.thread = None
			
			if args.has_key('CommandLine'):
				self.CommandLine = str(args['CommandLine']).replace("'''", "")
			else:
				self.CommandLine = None
			
			if args.has_key('Service'):
				self.Service = str(args['Service']).replace("'''", "")
			else:
				self.Service = None
			
			if args.has_key('ProcessName'):
				self.ProcessName = str(args['ProcessName']).replace("'''", "")
			else:
				self.ProcessName = None
			
			if args.has_key('ProcessID'):
				self.ProcessID = int(args['ProcessID'].replace("'''", ""))
			else:
				self.ProcessID = None
			
			if args.has_key('KernelConnectionString'):
				self.KernelConnectionString = str(args['KernelConnectionString']).replace("'''", "")
			else:
				self.KernelConnectionString = None
			
			if args.has_key('SymbolsPath'):
				self.SymbolsPath = str(args['SymbolsPath']).replace("'''", "")
			else:
				self.SymbolsPath = "SRV*http://msdl.microsoft.com/download/symbols"
			
			if args.has_key("StartOnCall"):
				self.StartOnCall = True
				self.OnCallMethod = str(args['StartOnCall']).replace("'''", "").lower()
				
			else:
				self.StartOnCall = False
			
			if args.has_key("IgnoreFirstChanceGardPage"):
				self.IgnoreFirstChanceGardPage = True
			else:
				self.IgnoreFirstChanceGardPage = False
			
			if self.Service == None and self.CommandLine == None and self.ProcessName == None \
					and self.KernelConnectionString == None and self.ProcessID == None:
				raise PeachException("Unable to create WindowsDebugEngine, missing Service, or CommandLine, or ProcessName, or ProcessID, or KernelConnectionString parameter.")
Пример #6
0
    def __init__(self, args):
        Monitor.__init__(self, args)
        self._name = "ProcessID"

        self.command = getStringAttribute(args, "Command")
        if not self.command:
            raise ValueError("Command not provided or empty in %s" % __file__)
        self.arguments = shlex.split(self.command) + shlex.split(
            getStringAttribute(args, "Arguments"))

        self.process_environment = getStringAttribute(args, "Environment")
        if self.process_environment:
            os.environ.update(
                dict([
                    p.split("=") for p in self.process_environment.split("|")
                ]))

        self.asan_options = getStringAttribute(args, "ASanOptions")
        if self.asan_options:
            os.environ["ASAN_OPTIONS"] = "%s" % self.asan_options

        self.asan_library_path = getStringAttribute(args, "ASanMacOSRuntime")
        if isMacOS and self.asan_library_path:
            os.environ["DYLD_LIBRARY_PATH"] = getStringAttribute(
                args, "ASanMacOSRuntime")

        self.asan_symbolizer = getStringAttribute(args, "ASanSymbolizer")
        if self.asan_symbolizer:
            os.environ["ASAN_SYMBOLIZER_PATH"] = self.asan_symbolizer
        self.heartbeat = getFloatAttribute(args, "Heartbeat", "0.0")
        self.monitor_console = getBooleanAttribute(args, "NoConsoleLogging")
        self.gdb_cmd_batch = getStringAttribute(args, "GDBCommands")
        self.print_subprocess_output = getBooleanAttribute(
            args, "PrintSubprocessOutput")
        self.lookout_time = getFloatAttribute(args, "LookoutTime", "5.0")

        self.system_report_path = getStringAttribute(args, 'LogFolder')
        if self.system_report_path and not os.path.isdir(
                self.system_report_path):
            raise ValueError("Provided path for LogFolder is invalid.")
        elif isMacOS():
            self.system_report_path = os.path.join(
                os.environ['HOME'], "Library/Logs/DiagnosticReports")
            if os.path.isdir(self.system_report_path):
                try:
                    os.makedirs(self.system_report_path)
                except (IOError, OSError) as e:
                    if e.errno != 17:
                        raise

        self.pid = self.process = None
        self.console_log = self.crash_trace = []
        self.failure = False
        self.first_run = True
Пример #7
0
    def __init__(self, args):
        Monitor.__init__(self, args)
        self._name = "ProcessID"

        self.command = getStringAttribute(args, "Command")
        if not self.command:
            raise ValueError("Command not provided or empty in %s" % __file__)
        self.arguments = shlex.split(self.command) + shlex.split(getStringAttribute(args, "Arguments"))

        self.process_environment = getStringAttribute(args, "Environment")
        if self.process_environment:
            os.environ.update(dict([p.split("=") for p in self.process_environment.split("|")]))

        self.asan_options = getStringAttribute(args, "ASanOptions")
        if self.asan_options:
            os.environ["ASAN_OPTIONS"] = "%s" % self.asan_options

        self.asan_library_path = getStringAttribute(args, "ASanMacOSRuntime")
        if isMacOS and self.asan_library_path:
            os.environ["DYLD_LIBRARY_PATH"] = getStringAttribute(args, "ASanMacOSRuntime")

        self.asan_symbolizer = getStringAttribute(args, "ASanSymbolizer")
        if self.asan_symbolizer:
            os.environ["ASAN_SYMBOLIZER_PATH"] = self.asan_symbolizer
        self.heartbeat = getFloatAttribute(args, "Heartbeat", "0.0")
        self.monitor_console = getBooleanAttribute(args, "NoConsoleLogging")
        self.gdb_cmd_batch = getStringAttribute(args, "GDBCommands")
        self.print_subprocess_output = getBooleanAttribute(args, "PrintSubprocessOutput")
        self.lookout_time = getFloatAttribute(args, "LookoutTime", "5.0")

        self.system_report_path = getStringAttribute(args, 'LogFolder')
        if self.system_report_path and not os.path.isdir(self.system_report_path):
                raise ValueError("Provided path for LogFolder is invalid.")
        elif isMacOS():
            self.system_report_path = os.path.join(os.environ['HOME'], "Library/Logs/DiagnosticReports")
            if os.path.isdir(self.system_report_path):
                try:
                    os.makedirs(self.system_report_path)
                except (IOError, OSError) as e:
                    if e.errno != 17:
                        raise

        self.pid = self.process = None
        self.console_log = self.crash_trace = []
        self.failure = False
        self.first_run = True
Пример #8
0
    def __init__(self, args):
        Monitor.__init__(self, args)

        if args.has_key("URL"):
            self.publisherRequestPath = str(args["URL"]).replace("'''", "")
        else:
            raise Exception("No publisher URL provided.")

        if args.has_key("EmulatorScript"):
            self.emulatorStartScript = str(args["EmulatorScript"]).replace(
                "'''", "")
        else:
            raise Exception("No script provided to run the emulator.")

        if args.has_key("AppName"):
            self.appName = str(args["AppName"]).replace("'''", "")
        else:
            self.appName = "browser"

        if args.has_key("ScriptTimeout"):
            self.scriptTimeout = int(args["ScriptTimeout"]).replace("''", "")
        else:
            self.scriptTimeout = 600000

        if args.has_key("PortADB"):
            self.forwardedPortADB = int(args["PortADB"])
        else:
            self.forwardedPortADB = 2828

        self._name = "MarionetteEmulator"
        self.monitoringProcessId = -1
        self.monitoredProcessName = "/system/b2g/b2g"
        self.publisherHost = "10.0.2.2"
        self.publisherPort = network.runHTTPDThread()
        self.publisherURL = "http://%s:%d/%s" % (
            self.publisherHost, self.publisherPort, self.publisherRequestPath)
        self.isEmulatorInitialized = False
        self.isMonitorInitialized = False
        self.adb = ADB.AccessDebugBridge(isEmulator=True)
        self.emulatorProcess = None
        self.crashSuccess = False
        self.adbLogcat = self.adb.runCmd(["logcat"])
        self.debugLogData = str()
Пример #9
0
    def __init__(self, args):
        Monitor.__init__(self, args)
        self._name = "ASanConsoleMonitor"

        self.command = getStringAttribute(args, "Command")
        if not self.command:
            raise ValueError("Command not provided or empty in %s" % __file__)
        self.arguments = shlex.split(self.command) + shlex.split(
            getStringAttribute(args, "Arguments"))

        self.process_environment = getStringAttribute(args, "Environment")
        if self.process_environment:
            os.environ.update(
                dict([
                    p.split("=") for p in self.process_environment.split("|")
                ]))

        self.asan_options = getStringAttribute(args, "ASanOptions")
        if self.asan_options:
            os.environ["ASAN_OPTIONS"] = "%s" % self.asan_options

        self.asan_library_path = getStringAttribute(args, "ASanMacOSRuntime")
        if isMacOS and self.asan_library_path:
            os.environ["DYLD_LIBRARY_PATH"] = getStringAttribute(
                args, "ASanMacOSRuntime")

        self.asan_symbolizer = getStringAttribute(args, "ASanSymbolizer")
        if self.asan_symbolizer:
            os.environ["ASAN_SYMBOLIZER_PATH"] = self.asan_symbolizer

        if "StartOnCall" in args:
            self.start_on_call = True
            self.OnCallMethod = getStringAttribute(args, 'StartOnCall')
        else:
            self.start_on_call = False

        self.asan_regex = "(ERROR: AddressSanitizer:.*[Stats:|ABORTING|ERROR: Failed])"
        self.stderr = []
        self.stdout = []
        self.sanlog = []
        self.process = None
        self.failure = False
Пример #10
0
Файл: b2g.py Проект: KurSh/peach
    def __init__(self, args):
        Monitor.__init__(self, args)

        if args.has_key("URL"):
            self.publisherRequestPath = str(args["URL"]).replace("'''", "")
        else:
            raise Exception("No publisher URL provided.")

        if args.has_key("EmulatorScript"):
            self.emulatorStartScript = str(args["EmulatorScript"]).replace("'''", "")
        else:
            raise Exception("No script provided to run the emulator.")

        if args.has_key("AppName"):
            self.appName = str(args["AppName"]).replace("'''", "")
        else:
            self.appName = "browser"

        if args.has_key("ScriptTimeout"):
            self.scriptTimeout = int(args["ScriptTimeout"]).replace("''", "")
        else:
            self.scriptTimeout = 600000

        if args.has_key("PortADB"):
            self.forwardedPortADB = int(args["PortADB"])
        else:
            self.forwardedPortADB = 2828

        self._name = "MarionetteEmulator"
        self.monitoringProcessId = -1
        self.monitoredProcessName = "/system/b2g/b2g"
        self.publisherHost = "10.0.2.2"
        self.publisherPort = network.runHTTPDThread()
        self.publisherURL = "http://%s:%d/%s" % (self.publisherHost, self.publisherPort, self.publisherRequestPath)
        self.isEmulatorInitialized = False
        self.isMonitorInitialized = False
        self.adb = ADB.AccessDebugBridge(isEmulator=True)
        self.emulatorProcess = None
        self.crashSuccess = False
        self.adbLogcat = self.adb.runCmd(["logcat"])
        self.debugLogData = str()
Пример #11
0
    def __init__(self, args):
        Monitor.__init__(self, args)
        self._name = "ASanConsoleMonitor"

        self.command = getStringAttribute(args, "Command")
        if not self.command:
            raise ValueError("Command not provided or empty in %s" % __file__)
        self.arguments = shlex.split(self.command) + shlex.split(getStringAttribute(args, "Arguments"))

        self.process_environment = getStringAttribute(args, "Environment")
        if self.process_environment:
            os.environ.update(dict([p.split("=") for p in self.process_environment.split("|")]))

        self.asan_options = getStringAttribute(args, "ASanOptions")
        if self.asan_options:
            os.environ["ASAN_OPTIONS"] = "%s" % self.asan_options

        self.asan_library_path = getStringAttribute(args, "ASanMacOSRuntime")
        if isMacOS and self.asan_library_path:
            os.environ["DYLD_LIBRARY_PATH"] = getStringAttribute(args, "ASanMacOSRuntime")

        self.asan_symbolizer = getStringAttribute(args, "ASanSymbolizer")
        if self.asan_symbolizer:
            os.environ["ASAN_SYMBOLIZER_PATH"] = self.asan_symbolizer

        if "StartOnCall" in args:
            self.start_on_call = True
            self.OnCallMethod = getStringAttribute(args, 'StartOnCall')
        else:
            self.start_on_call = False

        self.asan_regex = "(ERROR: AddressSanitizer:.*[Stats:|ABORTING|ERROR: Failed])"
        self.stderr = []
        self.stdout = []
        self.sanlog = []
        self.process = None
        self.failure = False
Пример #12
0
Файл: osx.py Проект: flaub/Peach
    def __init__(self, args):
        """
		Constructor.  Arguments are supplied via the Peach XML
		file.
		
		@type	args: Dictionary
		@param	args: Dictionary of parameters
		"""

        Monitor.__init__(self, args)

        if args.has_key("Command"):
            self.Command = str(args["Command"]).replace("'''", "")
        else:
            self.Command = None

        if args.has_key("Arguments"):
            self.Arguments = str(args["Arguments"]).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key("StartOnCall"):
            self.StartOnCall = str(args["StartOnCall"]).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

            # Our name for this monitor
        self._name = "OsxProcess"
        self.pid = None
        self.currentCount = 0
        self.restartFinger = 1000
    def __init__(self, args):
        '''
		Constructor.  Arguments are supplied via the Peach XML
		file.
		
		@type	args: Dictionary
		@param	args: Dictionary of parameters
		'''

        Monitor.__init__(self, args)

        if args.has_key('Command'):
            self.Command = str(args['Command']).replace("'''", "")
        else:
            self.Command = None

        if args.has_key('Arguments'):
            self.Arguments = str(args['Arguments']).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        # Our name for this monitor
        self._name = "OsxProcess"
        self.pid = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #14
0
Файл: osx.py Проект: flaub/Peach
    def __init__(self, args):
        """
		Constructor.  Arguments are supplied via the Peach XML
		file.
		
		@type	args: Dictionary
		@param	args: Dictionary of parameters
		"""

        Monitor.__init__(self, args)

        if args.has_key("Command"):
            self.Command = str(args["Command"]).replace("'''", "")
        else:
            self.Command = None

        if args.has_key("Arguments"):
            self.Arguments = str(args["Arguments"]).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key("StartOnCall"):
            self.StartOnCall = str(args["StartOnCall"]).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key("UseDebugMalloc"):
            self.UseDebugMalloc = str(args["UseDebugMalloc"]).replace("'''", "").lower() == "true"
        else:
            self.UseDebugMalloc = False

        if args.has_key("ExecHandler"):
            self.ExecHandler = str(args["ExecHandler"]).replace("'''", "")
        else:
            raise PeachException("Error, CrashWrangler monitor requires 'ExecHandler' parameter.")

        if args.has_key("ExploitableReads") and str(args["ExploitableReads"]).replace("'''", "").lower() == "false":
            self.ExploitableReads = False
        else:
            self.ExploitableReads = True

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        if args.has_key("CwLogFile"):
            self.CwLogFile = str(args["CwLogFile"]).replace("'''", "")
        else:
            self.CwLogFile = "cw.log"

        if args.has_key("CwLockFile"):
            self.CwLockFile = str(args["CwLockFile"]).replace("'''", "")
        else:
            self.CwLockFile = "cw.lck"

        if args.has_key("CwPidFile"):
            self.CwPidFile = str(args["CwPidFile"]).replace("'''", "")
        else:
            self.CwPidFile = "cw.pid"

            # Our name for this monitor
        self._name = "CrashWrangler"
        self.pid = None
        self.pid2 = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #15
0
Файл: osx.py Проект: KurSh/peach
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)

        if args.has_key('EnvironmentCommand'):
            self.EnvCommand = str(args['EnvironmentCommand']).replace("'''", "")
            try:
                self.EnvCommand = os.environ[self.EnvCommand]
            except KeyError:
                self.EnvCommand = None
        else:
            self.EnvCommand = None

        if args.has_key('EnvironmentArguments'):
            self.EnvArguments = str(args['EnvironmentArguments']).replace("'''", "")
            try:
                self.EnvArguments = os.environ[self.EnvArguments]
            except KeyError:
                self.EnvArguments = ""
        else:
            self.EnvArguments = ""

        if not self.EnvCommand:
            if args.has_key('Command'):
                self.Command = str(args['Command']).replace("'''", "")
            else:
                self.Command = None
        else:
            self.Command = self.EnvCommand

        if not self.EnvArguments:
            if args.has_key('Arguments'):
                self.Arguments = str(args['Arguments']).replace("'''", "")
            else:
                self.Arguments = ""
        else:
            self.Arguments = self.EnvArguments

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key('UseDebugMalloc'):
            self.UseDebugMalloc = str(args['UseDebugMalloc']).replace("'''", "").lower() == 'true'
        else:
            self.UseDebugMalloc = False

        if args.has_key('EnvironmentExecHandler'):
            self.EnvExecHandler = str(args['EnvironmentExecHandler']).replace("'''", "")
            try:
                self.EnvExecHandler = os.environ[self.EnvExecHandler]
            except KeyError:
                self.EnvExecHandler = ""
        else:
            self.EnvExecHandler = ""

        if not self.EnvExecHandler:
            if args.has_key('ExecHandler'):
                self.ExecHandler = str(args['ExecHandler']).replace("'''", "")
            else:
                raise PeachException("Error, CrashWrangler monitor requires 'ExecHandler' parameter.")
        else:
            self.ExecHandler = self.EnvExecHandler

        if args.has_key('ExploitableReads') and str(args['ExploitableReads']).replace("'''", "").lower() == "false":
            self.ExploitableReads = False
        else:
            self.ExploitableReads = True

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        if args.has_key('CwLogFile'):
            self.CwLogFile = str(args['CwLogFile']).replace("'''", "")
        else:
            self.CwLogFile = "cw.log"

        if args.has_key('CwLockFile'):
            self.CwLockFile = str(args['CwLockFile']).replace("'''", "")
        else:
            self.CwLockFile = "cw.lck"

        if args.has_key('CwPidFile'):
            self.CwPidFile = str(args['CwPidFile']).replace("'''", "")
        else:
            self.CwPidFile = "cw.pid"

        # Our name for this monitor
        self._name = "CrashWrangler"
        self.pid = None
        self.pid2 = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #16
0
    def __init__(self, args):
        """
        Arguments are supplied via the Peach XML file.

        :param args: dict of parameters
        :type args: dict
        """
        Monitor.__init__(self, args)

        if args.has_key('EnvironmentCommand'):
            self.EnvCommand = str(args['EnvironmentCommand']).replace(
                "'''", "")
            try:
                self.EnvCommand = os.environ[self.EnvCommand]
            except KeyError:
                self.EnvCommand = None
        else:
            self.EnvCommand = None

        if args.has_key('EnvironmentArguments'):
            self.EnvArguments = str(args['EnvironmentArguments']).replace(
                "'''", "")
            try:
                self.EnvArguments = os.environ[self.EnvArguments]
            except KeyError:
                self.EnvArguments = ""
        else:
            self.EnvArguments = ""

        if not self.EnvCommand:
            if args.has_key('Command'):
                self.Command = str(args['Command']).replace("'''", "")
            else:
                self.Command = None
        else:
            self.Command = self.EnvCommand

        if not self.EnvArguments:
            if args.has_key('Arguments'):
                self.Arguments = str(args['Arguments']).replace("'''", "")
            else:
                self.Arguments = ""
        else:
            self.Arguments = self.EnvArguments

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key('UseDebugMalloc'):
            self.UseDebugMalloc = str(args['UseDebugMalloc']).replace(
                "'''", "").lower() == 'true'
        else:
            self.UseDebugMalloc = False

        if args.has_key('EnvironmentExecHandler'):
            self.EnvExecHandler = str(args['EnvironmentExecHandler']).replace(
                "'''", "")
            try:
                self.EnvExecHandler = os.environ[self.EnvExecHandler]
            except KeyError:
                self.EnvExecHandler = ""
        else:
            self.EnvExecHandler = ""

        if not self.EnvExecHandler:
            if args.has_key('ExecHandler'):
                self.ExecHandler = str(args['ExecHandler']).replace("'''", "")
            else:
                raise PeachException(
                    "Error, CrashWrangler monitor requires 'ExecHandler' parameter."
                )
        else:
            self.ExecHandler = self.EnvExecHandler

        if args.has_key('ExploitableReads') and str(
                args['ExploitableReads']).replace("'''",
                                                  "").lower() == "false":
            self.ExploitableReads = False
        else:
            self.ExploitableReads = True

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        if args.has_key('CwLogFile'):
            self.CwLogFile = str(args['CwLogFile']).replace("'''", "")
        else:
            self.CwLogFile = "cw.log"

        if args.has_key('CwLockFile'):
            self.CwLockFile = str(args['CwLockFile']).replace("'''", "")
        else:
            self.CwLockFile = "cw.lck"

        if args.has_key('CwPidFile'):
            self.CwPidFile = str(args['CwPidFile']).replace("'''", "")
        else:
            self.CwPidFile = "cw.pid"

        # Our name for this monitor
        self._name = "CrashWrangler"
        self.pid = None
        self.pid2 = None
        self.currentCount = 0
        self.restartFinger = 1000
    def __init__(self, args):
        '''
		Constructor.  Arguments are supplied via the Peach XML
		file.
		
		@type	args: Dictionary
		@param	args: Dictionary of parameters
		'''

        Monitor.__init__(self, args)

        if args.has_key('Command'):
            self.Command = str(args['Command']).replace("'''", "")
        else:
            self.Command = None

        if args.has_key('Arguments'):
            self.Arguments = str(args['Arguments']).replace("'''", "")
        else:
            self.Arguments = ""

        if args.has_key('StartOnCall'):
            self.StartOnCall = str(args['StartOnCall']).replace("'''", "")
        else:
            self.StartOnCall = None

        if args.has_key('UseDebugMalloc'):
            self.UseDebugMalloc = str(args['UseDebugMalloc']).replace(
                "'''", "").lower() == 'true'
        else:
            self.UseDebugMalloc = False

        if args.has_key('ExecHandler'):
            self.ExecHandler = str(args['ExecHandler']).replace("'''", "")
        else:
            raise PeachException(
                "Error, CrashWrangler monitor requires 'ExecHandler' parameter."
            )

        if args.has_key('ExploitableReads') and str(
                args['ExploitableReads']).replace("'''",
                                                  "").lower() == "false":
            self.ExploitableReads = False
        else:
            self.ExploitableReads = True

        if args.has_key("NoCpuKill"):
            self.NoCpuKill = True
        else:
            self.NoCpuKill = False

        if args.has_key('CwLogFile'):
            self.CwLogFile = str(args['CwLogFile']).replace("'''", "")
        else:
            self.CwLogFile = "cw.log"

        if args.has_key('CwLockFile'):
            self.CwLockFile = str(args['CwLockFile']).replace("'''", "")
        else:
            self.CwLockFile = "cw.lck"

        if args.has_key('CwPidFile'):
            self.CwPidFile = str(args['CwPidFile']).replace("'''", "")
        else:
            self.CwPidFile = "cw.pid"

        # Our name for this monitor
        self._name = "CrashWrangler"
        self.pid = None
        self.pid2 = None
        self.currentCount = 0
        self.restartFinger = 1000
Пример #18
0
		def __init__(self, args):
			Monitor.__init__(self, args)
			
			print "WindowsDebugEngine::__init__()"
			
			self.started = None
			# Set at start of exception handling
			self.handlingFault = None
			# Set when collection finished
			self.handledFault = None
			self.crashInfo = None
			self.fault = False
			self.thread = None
			self.tempfile = None
			self.WinDbg = None
			
			if args.has_key('CommandLine'):
				self.CommandLine = str(args['CommandLine']).replace("'''", "")
			else:
				self.CommandLine = None
			
			if args.has_key('Service'):
				self.Service = str(args['Service']).replace("'''", "")
			else:
				self.Service = None
			
			if args.has_key('ProcessName'):
				self.ProcessName = str(args['ProcessName']).replace("'''", "")
			else:
				self.ProcessName = None
			
			if args.has_key('ProcessID'):
				self.ProcessID = int(args['ProcessID'].replace("'''", ""))
			else:
				self.ProcessID = None
			
			if args.has_key('KernelConnectionString'):
				self.KernelConnectionString = str(args['KernelConnectionString']).replace("'''", "")
			else:
				self.KernelConnectionString = None
			
			if args.has_key('SymbolsPath'):
				self.SymbolsPath = str(args['SymbolsPath']).replace("'''", "")
			else:
				self.SymbolsPath = "SRV*http://msdl.microsoft.com/download/symbols"
			
			if args.has_key("StartOnCall"):
				self.StartOnCall = True
				self.OnCallMethod = str(args['StartOnCall']).replace("'''", "").lower()
			else:
				self.StartOnCall = False
				
			if args.has_key("WinDbg"):
				self.WinDbg = str(args['WinDbg']).replace("'''", "").lower()
				
			
			if args.has_key("IgnoreFirstChanceGardPage"):
				self.IgnoreFirstChanceGardPage = True
			else:
				self.IgnoreFirstChanceGardPage = False
			
			if args.has_key("IgnoreSecondChanceGardPage"):
				self.IgnoreSecondChanceGardPage = True
			else:
				self.IgnoreSecondChanceGardPage = False
			
			if args.has_key("NoCpuKill"):
				self.NoCpuKill = True
			else:
				self.NoCpuKill = False
			
			if args.has_key("FaultOnEarlyExit"):
				self.FaultOnEarlyExit = True
			else:
				self.FaultOnEarlyExit = False
			
			if self.Service == None and self.CommandLine == None and self.ProcessName == None \
					and self.KernelConnectionString == None and self.ProcessID == None:
				raise PeachException("Unable to create WindowsDebugEngine, missing Service, or CommandLine, or ProcessName, or ProcessID, or KernelConnectionString parameter.")
			
			self.handlingFault = None
			self.handledFault = None