def __init__(self, reaction, patterns, options={}): debuglib.info("New rule created:") debuglib.info(" Reaction: %s" % reaction) debuglib.info(" Pattern: %s" % patterns) if isinstance(reaction, str): self.reaction = Reaction(reaction, options) else: self.reaction = reaction self.patterns = [Pattern(p, options) for p in patterns] self.options = Rule.default_options # XXX: dict.update() merges dicts. self.options.update(options) self.hits = 0
def __init__(self, reaction, patterns, options={}): debuglib.info("New rule created:") debuglib.info(" Reaction: %s" % reaction) debuglib.info(" Pattern: %s" % patterns) if isinstance(reaction, str): self.reaction = Reaction(reaction, options) else: self.reaction = reaction self.patterns = [ Pattern(p, options) for p in patterns ] self.options = Rule.default_options # XXX: dict.update() merges dicts. self.options.update(options) self.hits = 0
def saveRegex(self, regexString): debuglib.info("Saving regex; %s" % regexString) self.regexString = regexString self.regex = re.compile(regexString)