Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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,
         }