コード例 #1
0
ファイル: ParserSDEE.py プロジェクト: jasimmonsv/OSSIM
    def process(self):
        logger.info("Started SDEE Collector")
        self.host = self._plugin.get("config", "source_ip")
        self.username = self._plugin.get("config", "user")
        self.password = self._plugin.get("config", "password")
        self.sleepField = self._plugin.get("config", "sleep")
        self.plugin_id = self._plugin.get("DEFAULT", "plugin_id")

        sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
        try:
            sdee.open()
            logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
            f = open(self.sIdFile, 'w')
            f.write("%s\n" % sdee._subscriptionid)
            f.close()

        except:
            logger.error("Error opening SDEE connection with device %s" % self.host)
            logger.info("SDEE: Trying to close last session")
            f = open(self.sIdFile, 'r')
            subs = f.readline()

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee._subscriptionid = subs
                sdee.close()

            except:
                logger.error("SDEE: losing last session Failed")
                return

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee.open()
                logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
                f = open(self.sIdFile, 'w')
                f.write("%s\n" % sdee._subscriptionid)
                f.close()

            except:
                logger.error("SDEE Failed")
                return

        while 1:
            sdee.get()
            logger.info("Requesting SDEE Data...")
            data = sdee.data()
            logger.debug(data)
            self.parse(data)
            time.sleep(int(self.sleepField))
コード例 #2
0
ファイル: closeSDEEsession.py プロジェクト: jhbsz/ossimTest
from pySDEE import SDEE
import sys

subs = sys.argv[1]
sdee = SDEE(user="", password="", host="", method="https", force="yes")
sdee._subscriptionid = subs
sdee.close()
コード例 #3
0
from pySDEE import SDEE
import sys

subs = sys.argv[1]
sdee = SDEE(user='', password='', host='', method='https', force='yes')
sdee._subscriptionid = subs
sdee.close()
コード例 #4
0
ファイル: ParserSDEE.py プロジェクト: zoe-mora-imdc/Ossim
    def process(self):
        self.loginfo("Started SDEE Collector")
        if self.__hostname:
            self.host = self.__hostname
        else:
            self.host = self._plugin.get("config", "source_ip")
        if self.__username:
            self.username = self.__username
        else:
            self.username = self._plugin.get("config", "user")
        if self.__password:
            self.password = self.__password
        else:
            self.password = self._plugin.get("config", "password")
        self.sleepField = self._plugin.get("config", "sleep")
        self.plugin_id = self._plugin.get("DEFAULT", "plugin_id")

        sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
        try:
            sdee.open()
            self.loginfo(Lazyformat("SDEE subscriberId: {}", sdee._subscriptionid))
            f = open(self.sIdFile, 'w')
            f.write("%s\n" % sdee._subscriptionid)
            f.close()

        except:
            self.logerror(Lazyformat("Failed to open SDEE connection to device {}", self.host))
            self.loginfo("SDEE: Trying to close last session")
            try:
                f = open(self.sIdFile, 'r')
            except IOError:
                self.logerror("SDEE: Cannot read subscriber ID")
                return
            subs = f.readline()

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee._subscriptionid = subs
                sdee.close()

            except:
                self.logerror("SDEE: losing last session Failed")
                return

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee.open()
                self.loginfo(Lazyformat("SDEE subscriberId: {}", sdee._subscriptionid))
                f = open(self.sIdFile, 'w')
                f.write("%s\n" % sdee._subscriptionid)
                f.close()

            except:
                self.logerror("SDEE Failed")
                return

        while 1:
            sdee.get()
            self.loginfo("Requesting SDEE Data...")
            data = sdee.data()
            self.logdebug(data)
            self.parse(data)
            time.sleep(int(self.sleepField))