Beispiel #1
0
    def _startsensor(self):
        """ starts the DySKT sensor """
        flags = bits.bitmask_list(_STATE_FLAGS_, self._state)
        if flags['store'] and flags['nidus'] and not flags['dyskt']:
            # do we have a password
            if not self._pwd:
                pwd = self._getpwd()
                if pwd is None:
                    self.logwrite("Password entry canceled. Cannot continue",
                                  gui.LOG_WARN)
                    return
                self._pwd = pwd

            # start the sensor
            try:
                self.logwrite("Starting DySKT...", gui.LOG_NOTE)
                cmdline.service('dysktd', self._pwd)
                time.sleep(0.5)
                if not cmdline.dysktrunning(wraith.DYSKTPID):
                    raise RuntimeError('unknown')
            except RuntimeError as e:
                self.logwrite("Error starting DySKT: %s" % e, gui.LOG_ERR)
            else:
                self.logwrite("DySKT Started")
                self._setstate(_STATE_DYSKT_)
Beispiel #2
0
    def _startsensor(self):
        """ starts the Iyri sensor """
        flags = bits.bitmask_list(_STATE_FLAGS_, self._state)
        if flags['store'] and not flags['iyri']:
            # do we have a password
            if not self._pwd:
                pwd = self._getpwd()
                if pwd is None:
                    self.logwrite("Password entry canceled. Cannot continue",
                                  gui.LOG_WARN)
                    return
                self._pwd = pwd

            # start the sensor
            try:
                self.logwrite("Starting Iyri...", gui.LOG_NOTE)
                cmdline.service('iyrid', self._pwd)
                time.sleep(0.5)
                if not cmdline.runningservice(wraith.IYRIPID):
                    raise RuntimeError('unknown')
            except RuntimeError as e:
                self.logwrite("Error starting Iyri: {0}".format(e),
                              gui.LOG_ERR)
            else:
                self.logwrite("Iyri Started")
                self._setstate(_STATE_IYRI_)
Beispiel #3
0
def stoppsql(pwd):
    """
     shut down posgresql.
     pwd: the sudo password
    """
    try:
        cmdline.service('postgresql',pwd,False)
        while cmdline.runningprocess('postgres'): time.sleep(0.5)
    except RuntimeError:
        return False
    else:
        return True
Beispiel #4
0
def stopnidus(pwd):
    """
     stop nidus storage manager.
     pwd: Sudo password
    """
    try:
        cmdline.service('nidusd',pwd,False)
        while cmdline.nidusrunning(wraith.NIDUSPID): time.sleep(1.0)
    except RuntimeError as e:
        return False
    else:
        return True
Beispiel #5
0
def stopdyskt(pwd):
    """
     stop dyskt sensor
     pwd: Sudo password
    """
    try:
        cmdline.service('dysktd',pwd,False)
        while cmdline.nidusrunning(wraith.DYSKTPID): time.sleep(1.0)
    except RuntimeError as e:
        return False
    else:
        return True
Beispiel #6
0
def startpsql(pwd):
    """
     start postgresl server
      pwd: the sudo password
    """
    try:
        cmdline.service('postgresql',pwd)
        time.sleep(0.5)
        if not cmdline.runningprocess('postgres'): raise RuntimeError
    except RuntimeError:
        return False
    else:
        return True
Beispiel #7
0
def startnidus(pwd):
    """
     start nidus server
     pwd: the sudo password
    """
    try:
        cmdline.service('nidusd',pwd)
        time.sleep(0.5)
        if not cmdline.nidusrunning(wraith.NIDUSPID): raise RuntimeError
    except RuntimeError:
        return False
    else:
        return True
Beispiel #8
0
def startdyskt(pwd):
    """
     start dyskt sensor
     pwd: the sudo password
    """
    try:
        cmdline.service('dysktd',pwd)
        time.sleep(1.0)
        if not cmdline.dysktrunning(wraith.DYSKTPID): raise RuntimeError
    except RuntimeError:
        return False
    else:
        return True
Beispiel #9
0
def startiyri(pwd):
    """
     start Iyri sensor.
     :param pwd: sudo password
     :returns: whether iyri started or not
    """
    try:
        cmdline.service('iyrid', pwd)
        time.sleep(1.0)
        if not cmdline.runningservice(wraith.IYRIPID): raise RuntimeError
    except RuntimeError:
        return False
    else:
        return True
Beispiel #10
0
def stopiyri(pwd):
    """
     stop Iyri sensor. pwd: Sudo password
     :param pwd: sudo password
     :returns: whether iyri stopped or not
    """
    try:
        cmdline.service('iyrid', pwd, False)
        while cmdline.runningservice(wraith.IYRIPID):
            time.sleep(1.0)
    except RuntimeError as e:
        return False
    else:
        return True
Beispiel #11
0
 def _stopnidus(self):
     """
      stop nidus storage manager.
       NOTE: 1) no state checking done here
             2) assumes sudo password is entered
     """
     try:
         self.logwrite("Shutting down Nidus...", gui.LOG_NOTE)
         cmdline.service('nidusd', self._pwd, False)
         while cmdline.nidusrunning(wraith.NIDUSPID):
             self.logwrite("Nidus still processing data...", gui.LOG_NOTE)
             time.sleep(1.0)
     except RuntimeError as e:
         self.logwrite("Error shutting down Nidus: %s" % e, gui.LOG_ERR)
     else:
         self._setstate(_STATE_NIDUS_, False)
         self.logwrite("Nidus shut down")
Beispiel #12
0
 def _startnidus(self):
     """
      start nidus storage manager
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     # attempt to start nidus
     try:
         self.logwrite("Starting Nidus...",gui.LOG_NOTE)
         cmdline.service('nidusd',self._pwd)
         time.sleep(0.5)
         if not cmdline.nidusrunning(wraith.NIDUSPID): raise RuntimeError('unknown')
     except RuntimeError as e:
         self.logwrite("Error starting Nidus: %s" % e,gui.LOG_ERR)
     else:
         self.logwrite("Nidus Started")
         self._setstate(_STATE_NIDUS_)
Beispiel #13
0
 def _stoppsql(self):
     """
      shut down posgresql.
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     try:
         self.logwrite("Shutting down PostgreSQL", gui.LOG_NOTE)
         cmdline.service('postgresql', self._pwd, False)
         while cmdline.runningprocess('postgres'):
             self.logwrite("PostgreSQL shutting down...", gui.LOG_NOTE)
             time.sleep(0.5)
     except RuntimeError as e:
         self.logwrite("Error shutting down PostgreSQL", gui.LOG_ERR)
     else:
         self._setstate(_STATE_STORE_, False)
         self.logwrite("PostgreSQL shut down")
Beispiel #14
0
 def _stopnidus(self):
     """
      stop nidus storage manager.
       NOTE: 1) no state checking done here
             2) assumes sudo password is entered
     """
     try:
         self.logwrite("Shutting down Nidus...",gui.LOG_NOTE)
         cmdline.service('nidusd',self._pwd,False)
         while cmdline.nidusrunning(wraith.NIDUSPID):
             self.logwrite("Nidus still processing data...",gui.LOG_NOTE)
             time.sleep(1.0)
     except RuntimeError as e:
         self.logwrite("Error shutting down Nidus: %s" % e,gui.LOG_ERR)
     else:
         self._setstate(_STATE_NIDUS_,False)
         self.logwrite("Nidus shut down")
Beispiel #15
0
 def _stoppsql(self):
     """
      shut down posgresql.
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     try:
         self.logwrite("Shutting down PostgreSQL",gui.LOG_NOTE)
         cmdline.service('postgresql',self._pwd,False)
         while cmdline.runningprocess('postgres'):
             self.logwrite("PostgreSQL shutting down...",gui.LOG_NOTE)
             time.sleep(0.5)
     except RuntimeError as e:
         self.logwrite("Error shutting down PostgreSQL",gui.LOG_ERR)
     else:
         self._setstate(_STATE_STORE_,False)
         self.logwrite("PostgreSQL shut down")
Beispiel #16
0
 def _startpsql(self):
     """
      start postgresl server
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     # attempt to start psql
     try:
         self.logwrite("Starting PostgreSQL...",gui.LOG_NOTE)
         cmdline.service('postgresql',self._pwd)
         time.sleep(0.5)
         if not cmdline.runningprocess('postgres'): raise RuntimeError('unknown')
     except RuntimeError as e:
         self.logwrite("Error starting PostgreSQL: %s" % e,gui.LOG_ERR)
         return
     else:
         self.logwrite("PostgreSQL started")
         self._setstate(_STATE_STORE_)
Beispiel #17
0
 def _startnidus(self):
     """
      start nidus storage manager
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     # attempt to start nidus
     try:
         self.logwrite("Starting Nidus...", gui.LOG_NOTE)
         cmdline.service('nidusd', self._pwd)
         time.sleep(0.5)
         if not cmdline.nidusrunning(wraith.NIDUSPID):
             raise RuntimeError('unknown')
     except RuntimeError as e:
         self.logwrite("Error starting Nidus: %s" % e, gui.LOG_ERR)
     else:
         self.logwrite("Nidus Started")
         self._setstate(_STATE_NIDUS_)
Beispiel #18
0
 def _startpsql(self):
     """
      start postgresl server
      NOTE: 1) no state checking done here
            2) assumes sudo password is entered
     """
     # attempt to start psql
     try:
         self.logwrite("Starting PostgreSQL...", gui.LOG_NOTE)
         cmdline.service('postgresql', self._pwd)
         time.sleep(0.5)
         if not cmdline.runningprocess('postgres'):
             raise RuntimeError('unknown')
     except RuntimeError as e:
         self.logwrite("Error starting PostgreSQL: %s" % e, gui.LOG_ERR)
         return
     else:
         self.logwrite("PostgreSQL started")
         self._setstate(_STATE_STORE_)
Beispiel #19
0
    def _stopsensor(self):
        """ stops the DySKT sensor """
        flags = bits.bitmask_list(_STATE_FLAGS_,self._state)
        if flags['dyskt']:
            # do we have a password
            if not self._pwd:
                pwd = self._getpwd()
                if pwd is None:
                    self.logwrite("Password entry canceled. Cannot continue",
                                  gui.LOG_WARN)
                    return
                self._pwd = pwd

            # stop the sensor
            try:
                self.logwrite("Shutting down DySKT...",gui.LOG_NOTE)
                cmdline.service('dysktd',self._pwd,False)
            except RuntimeError as e:
                self.logwrite("Error shutting down DySKT: %s" % e,gui.LOG_ERR)
            else:
                self._setstate(_STATE_DYSKT_,False)
                self.logwrite("DySKT shut down")
Beispiel #20
0
    def _stopsensor(self):
        """ stops the Iyri sensor """
        flags = bits.bitmask_list(_STATE_FLAGS_, self._state)
        if flags['iyri']:
            # do we have a password
            if not self._pwd:
                pwd = self._getpwd()
                if pwd is None:
                    self.logwrite("Password entry canceled. Cannot continue",
                                  gui.LOG_WARN)
                    return
                self._pwd = pwd

            # stop the sensor
            try:
                self.logwrite("Shutting down Iyri...", gui.LOG_NOTE)
                cmdline.service('iyrid', self._pwd, False)
            except RuntimeError as e:
                self.logwrite("Error shutting down Iyri: {0}".format(e),
                              gui.LOG_ERR)
            else:
                self._setstate(_STATE_IYRI_, False)
                self.logwrite("Iyri shut down")
Beispiel #21
0
    def _startsensor(self):
        """ starts the DySKT sensor """
        flags = bits.bitmask_list(_STATE_FLAGS_,self._state)
        if flags['store'] and flags['nidus'] and not flags['dyskt']:
            # do we have a password
            if not self._pwd:
                pwd = self._getpwd()
                if pwd is None:
                    self.logwrite("Password entry canceled. Cannot continue",
                                  gui.LOG_WARN)
                    return
                self._pwd = pwd

            # start the sensor
            try:
                self.logwrite("Starting DySKT...",gui.LOG_NOTE)
                cmdline.service('dysktd',self._pwd)
                time.sleep(0.5)
                if not cmdline.dysktrunning(wraith.DYSKTPID): raise RuntimeError('unknown')
            except RuntimeError as e:
                self.logwrite("Error starting DySKT: %s" % e,gui.LOG_ERR)
            else:
                self.logwrite("DySKT Started")
                self._setstate(_STATE_DYSKT_)