示例#1
0
    def __init__(self, **opts):
        Configable.__init__(self)

        self.setConfOpts(opts)

        self.operfuncs = {}
        self.cmprctors = {}

        self.setCmprFunc('eq', eq)
        self.setCmprFunc('lt', lt)
        self.setCmprFunc('gt', gt)
        self.setCmprFunc('le', le)
        self.setCmprFunc('ge', ge)

        self.setCmprCtor('or', self._cmprCtorOr)
        self.setCmprCtor('and', self._cmprCtorAnd)
        self.setCmprCtor('tag', self._cmprCtorTag)
        self.setCmprCtor('seen', self._cmprCtorSeen)
        self.setCmprCtor('range', self._cmprCtorRange)

        # interval and interval-interval comparisons
        self.setCmprCtor('ival', self._cmprCtorIval)

        self.setCmprCtor('in', self._cmprCtorIn)
        self.setCmprCtor('re', self._cmprCtorRe)
        self.setCmprCtor('has', self._cmprCtorHas)

        self.setOperFunc('filt', self._stormOperFilt)
        self.setOperFunc('opts', self._stormOperOpts)

        self.setOperFunc('save', self._stormOperSave)
        self.setOperFunc('load', self._stormOperLoad)
        self.setOperFunc('clear', self._stormOperClear)

        self.setOperFunc('guid', self._stormOperGuid)
        self.setOperFunc('join', self._stormOperJoin)
        self.setOperFunc('lift', self._stormOperLift)
        self.setOperFunc('refs', self._stormOperRefs)
        self.setOperFunc('limit', self._stormOperLimit)
        self.setOperFunc('pivot', self._stormOperPivot)
        self.setOperFunc('alltag', self._stormOperAllTag)
        self.setOperFunc('addtag', self._stormOperAddTag)
        self.setOperFunc('deltag', self._stormOperDelTag)
        self.setOperFunc('totags', self._stormOperToTags)

        self.setOperFunc('addnode', self._stormOperAddNode)
        self.setOperFunc('delnode', self._stormOperDelNode)

        self.setOperFunc('nexttag', self._stormOperNextSeq)
        self.setOperFunc('setprop', self._stormOperSetProp)
        self.setOperFunc('addxref', self._stormOperAddXref)
        self.setOperFunc('fromtags', self._stormOperFromTags)
        self.setOperFunc('jointags', self._stormOperJoinTags)

        self.setOperFunc('show:cols', self._stormOperShowCols)

        # Cache compiled regex objects.
        self._rt_regexcache = s_cache.FixedCache(1024, re.compile)
示例#2
0
    def __init__(self, **opts):
        Configable.__init__(self)

        self.addConfDef('storm:limit:lift',
                        asloc='limlift',
                        defval=None,
                        doc='Global lift limit')

        self.setConfOpts(opts)

        self.operfuncs = {}
        self.cmprctors = {}

        self.setCmprFunc('eq', lambda x, y: x == y)
        self.setCmprFunc('lt', lambda x, y: x < y)
        self.setCmprFunc('gt', lambda x, y: x > y)
        self.setCmprFunc('le', lambda x, y: x <= y)
        self.setCmprFunc('ge', lambda x, y: x >= y)

        self.setCmprCtor('or', self._cmprCtorOr)
        self.setCmprCtor('and', self._cmprCtorAnd)
        self.setCmprCtor('tag', self._cmprCtorTag)

        self.setCmprCtor('in', self._cmprCtorIn)
        self.setCmprCtor('re', self._cmprCtorRe)
        self.setCmprCtor('has', self._cmprCtorHas)

        self.setOperFunc('filt', self._stormOperFilt)
        self.setOperFunc('opts', self._stormOperOpts)

        self.setOperFunc('save', self._stormOperSave)
        self.setOperFunc('load', self._stormOperLoad)
        self.setOperFunc('clear', self._stormOperClear)

        self.setOperFunc('join', self._stormOperJoin)
        self.setOperFunc('lift', self._stormOperLift)
        self.setOperFunc('pivot', self._stormOperPivot)