Exemple #1
0
    def __init__(self):
        Dshield.__init__(self)
        """Instant a CacheServer
		"""
        self.Cache = CacheServer().create_or_connect_cache()
        self.Dcol = self.Cache["DSTAT"]
        CacheServer().create_index(self.Dcol, "exptime",
                                   self.avr['expire_after_seconds'])
Exemple #2
0
    def __init__(self):
        Dshield.__init__(self)

        if not self.avr['admin_email'].find('@'):
            self.sender = self.avr['smtp_server'].replace(
                self.avr['smtp_server'].split('.')[0] + '.',
                self.avr['admin_email'] + '@')
        else:
            self.sender = self.avr['admin_email']
Exemple #3
0
    def __init__(self):
        Dshield.__init__(self)

        if not self.avr['username'].find('@'):
            self.sender = self.avr['smtpserver'].replace(
                self.avr['smtpserver'].split('.')[0] + '.',
                self.avr['username'] + '@')
        else:
            self.sender = self.avr['username']
Exemple #4
0
def save_log(type, data):
	logdir = LOGS_DIR + time.strftime('%Y_%m', time.localtime()) + '/'
	
	if not os.path.exists(logdir):
		os.system('mkdir -p ' + logdir)
		os.chmod(logdir, 777)
	
	log_file = logdir + time.strftime('%Y_%m_%d', time.localtime()) + '_' + Dshield().avr['logFile']
	f = open(log_file, 'a')
	f.write('['+type+'] ' + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + ' ' + str(data) + '\n')
	f.close()
Exemple #5
0
 def __init__(self):
     Dshield.__init__(self)
     cidr = self.cidr()
     self.kwargs = {
         'interface':
         self.avr['motr_interface'],
         'filters':
         '{0} and {1} and {2}'.format(cidr['lip'], cidr['port'],
                                      cidr['wip']),
         'max_bytes':
         self.avr['max_bytes'],
         'promiscuous':
         self.avr['promiscuous'],
         'buffer_timeout':
         self.avr['buffer_timeout'],
         'expire_after_seconds':
         self.avr['expire_after_seconds'],
         'filepath':
         self.avr['file_path'],
         'filetype':
         self.avr['file_type']
     }
Exemple #6
0
 def __init__(self):
     Dshield.__init__(self)