示例#1
0
def _init_profile_dir(profile):
    filename = require.get_data_filename("context.dat", profile=profile)

    try:
        os.makedirs(os.path.dirname(filename), mode=0o700)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise
示例#2
0
def _init_profile_dir(profile):
    filename = require.get_data_filename("context.dat", profile=profile)

    try:
        os.makedirs(os.path.dirname(filename), mode=0700)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise
    def __init__(self, env):
        Plugin.__init__(self, env)

        reload = self.getConfigValue("reload", self.RELOAD, type=int)
        filename = self.getConfigValue("filename", require.get_data_filename("spamhaus_drop.dat", module=__name__, profile=env.profile))
        uri = self.getConfigValue("uri", self.URI)
        timeout = self.getConfigValue("timeout", self.TIMEOUT, type=float)

        self.__data = SpamhausDownload(filename, uri, timeout, reload)
    def __init__(self, env):
        Plugin.__init__(self, env)

        uri = self.getConfigValue("uri", self.DSHIELD_URI)
        timeout = self.getConfigValue("timeout", self.DSHIELD_TIMEOUT, type=float)
        reload = self.getConfigValue("reload", self.DSHIELD_RELOAD, type=int)
        filename = self.getConfigValue("filename", require.get_data_filename("dshield.dat", module=__name__, profile=env.profile))

        self.__data = DShieldDownloader(filename, uri, timeout, reload)
    def __init__(self, env):
        Plugin.__init__(self, env)

        uri = self.getConfigValue("uri", self.CIARMY_URI)
        timeout = self.getConfigValue("timeout", self.CIARMY_TIMEOUT, type=float)
        reload = self.getConfigValue("reload", self.CIARMY_RELOAD, type=int)
        filename = self.getConfigValue("filename", require.get_data_filename("ciarmy.dat", module=__name__, profile=env.profile))

        self.__data = CIArmyDownloader(filename, uri, timeout, reload)
    def __init__(self, env):
        Plugin.__init__(self, env)

        uri = self.getConfigValue("uri", self.DSHIELD_URI)
        timeout = self.getConfigValue("timeout", self.DSHIELD_TIMEOUT, type=float)
        reload = self.getConfigValue("reload", self.DSHIELD_RELOAD, type=int)
        filename = self.getConfigValue("filename",
                                       require.get_data_filename("dshield.dat", module=__name__, profile=env.profile))

        self.__data = DShieldDownloader(filename, uri, timeout, reload)
    def __init__(self, env):
        Plugin.__init__(self, env)

        reload = self.getConfigValue("reload", self.RELOAD, type=int)
        filename = self.getConfigValue(
            "filename",
            require.get_data_filename("spamhaus_drop.dat",
                                      module=__name__,
                                      profile=env.profile))
        uri = self.getConfigValue("uri", self.URI)
        timeout = self.getConfigValue("timeout", self.TIMEOUT, type=float)

        self.__data = SpamhausDownload(filename, uri, timeout, reload)
示例#8
0
    def __init__(self, env):
        Plugin.__init__(self, env)

        uri = self.getConfigValue("uri", self.CIARMY_URI)
        timeout = self.getConfigValue("timeout",
                                      self.CIARMY_TIMEOUT,
                                      type=float)
        reload = self.getConfigValue("reload", self.CIARMY_RELOAD, type=int)
        filename = self.getConfigValue(
            "filename",
            require.get_data_filename("ciarmy.dat",
                                      module=__name__,
                                      profile=env.profile))

        self.__data = CIArmyDownloader(filename, uri, timeout, reload)
示例#9
0
def load(profile):
    ctxt_filename = require.get_data_filename("context.dat", profile=profile)
    if os.path.exists(ctxt_filename):
        global _TIMER_LIST
        global _CONTEXT_TABLE

        fd = open(ctxt_filename, "rb")

        try:
            _CONTEXT_TABLE.update(ContextUnpickler(fd).load())
        except EOFError:
            return

        logger.debug("[load]: %d context loaded", len(_CONTEXT_TABLE))

        for ctxlist in _CONTEXT_TABLE.values():
            for ctx in ctxlist[:]:
                # Destroy the context in case of incompatibility or import failure.
                # Check the alert_on_expire option because it can contain
                # some external reference that will be called from the core.
                if not ctx.isVersionCompatible() or ctx.getOptions()["alert_on_expire"] is _Dummy:
                    ctx.destroy()
示例#10
0
def load(profile):
    ctxt_filename = require.get_data_filename("context.dat", profile=profile)
    if os.path.exists(ctxt_filename):
        global _TIMER_LIST
        global _CONTEXT_TABLE

        fd = open(ctxt_filename, "rb")

        try:
            _CONTEXT_TABLE.update(ContextUnpickler(fd).load())
        except EOFError:
            return

        logger.debug("[load]: %d context loaded", len(_CONTEXT_TABLE))

        for ctxlist in _CONTEXT_TABLE.values():
            for ctx in ctxlist:
                # Destroy the context in case of incompatibility or import failure.
                # Check the alert_on_expire option because it can contain
                # some external reference that will be called from the core.
                if not ctx.isVersionCompatible() or ctx.getOptions()["alert_on_expire"] is _Dummy:
                    ctx.destroy()
示例#11
0
def save(profile):
    ctxt_filename = require.get_data_filename("context.dat", profile=profile)

    fd = open(ctxt_filename, "wb")
    pickle.dump(_CONTEXT_TABLE, fd, -1)
    fd.close()
示例#12
0
def save(profile):
    ctxt_filename = require.get_data_filename("context.dat", profile=profile)

    fd = open(ctxt_filename, "wb")
    pickle.dump(_CONTEXT_TABLE, fd, -1)
    fd.close()
示例#13
0
        cnt += 1

    return name


def search(name, idmef=None, update=False):
    name = getName(name)
    for ctx in _CONTEXT_TABLE.get(name, ()):
        ctime = ctx.checkTimeWindow(idmef, update)
        if ctime:
            return ctx

    return None


_ctxt_filename = require.get_data_filename("context.dat")


def save():
    fd = open(_ctxt_filename, "wb")
    pickle.dump(_CONTEXT_TABLE, fd)
    fd.close()


def load(_env):
    if os.path.exists(_ctxt_filename):
        global _TIMER_LIST
        global _CONTEXT_TABLE

        fd = open(_ctxt_filename, "rb")