def suri_bin(self): command = self.commands.get('suriBin') if not command: return False return_code, out, err = utils.system_execute(command.get('cmd'), command.get('params')) if not return_code and 'Suricata version' in out: return True else: return False
def stop_service(self): command = (self.commands.get('suricata') or {}).get('stop') if not command: return False return_code, out, err = utils.system_execute(command) if return_code: logger.error(err) return False else: logger.info(out) return True
def start_service(self): command = self.commands.get('start_engine') if not command: return False return_code, out, err = utils.system_execute(command) if return_code: logger.error(err) return False else: logger.info(out) return True
def running_status(self): command = self.commands.get('suriRunning') if not command: return False return_code, out, err = utils.system_execute(command.get('cmd'), command.get('params')) if not return_code and out.strip().isnumeric(): logger.info("PID = {}".format(out)) return True else: logger.error("Return_code: %s, out: %s, err: %s", return_code, out, err) return False
def running_status(self): command = self.commands.get('engine_status') if not command: return False return_code, out, err = utils.system_execute(command) if return_code: logger.error(err) return { "return_code": return_code, "error": err } else: return { "engine_status": out, }