def __init__( self, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null', openLog = True ): Daemon.__init__( self, Config.getInstance().pidfile, stdin, stdout, stderr ) # Set the threshold for the first generation to 3 gc.set_threshold( 3 ) self.config = Config.getInstance() self.netstat = NetworkParser() self.triggers = [] self.lock = threading.Lock() # Initialize logging if openLog is True: logging.basicConfig( level = logging.INFO, format = '[%(asctime)s] [%(levelname)s] %(message)s', filename = self.config.logfile, filemode = 'a' )
def __init__(self): self.config = Config.getInstance() self.connections = [] self.listeners = {} self.load = {} self.rules = self.config.rules.keys() self.whitelist = [] self.dnscache = {} # pre compute whitelist for addresses and hostnames regexp for item in self.config.whitelist: # item is an ip address, convert it to a little endian unsigned long if NetworkParser.IP_CLASSIFIER.match(item): self.whitelist.append( NetworkParser.address2long(item) ) # ip address is a regular expression for an hostname else: self.whitelist.append( re.compile(item) )
def __init__(self): self.config = Config.getInstance() self.connections = [] self.listeners = {} self.load = {} self.rules = self.config.rules.keys() self.whitelist = [] self.dnscache = {} # pre compute whitelist for addresses and hostnames regexp for item in self.config.whitelist: # item is an ip address, convert it to a little endian unsigned long if NetworkParser.IP_CLASSIFIER.match(item): self.whitelist.append(NetworkParser.address2long(item)) # ip address is a regular expression for an hostname else: self.whitelist.append(re.compile(item))