def add_comment(ip_address, comment): loggers = logging_handler.get_loggers(create_tables=False) supported_loggers = [] for logger in loggers: if logger.__class__.__name__ in ('LogPostgreSQL',): supported_loggers.append(logger) for logger in supported_loggers: logger.add_comment(ip_address, comment)
def get_comments(ip_address): loggers = logging_handler.get_loggers(create_tables=False) supported_loggers = [] for logger in loggers: if logger.__class__.__name__ in ('LogPostgreSQL',): supported_loggers.append(logger) if len(supported_loggers) > 0: return supported_loggers[0].get_comments(ip_address) else: return ''
def __init__(self): self.scans_table = ScansTable() self.events_deque = collections.deque() self.deque_read_interval = 15 self.scan_threshold = 300 #self.scan_threshold = 60 self.cymru_min_timeout = 2 self.cymru_timeout = 3 #self.profile_update_time = datetime.now() + timedelta(hours=24) self.profile_update_time = datetime.now() + timedelta(minutes=30) self.loggers = logging_handler.get_loggers() thread.start_new_thread(self.run, ())
def __init__(self, test=False): self.create_empty_dirs() self.test = test if not self.test: self.loggers = logging_handler.get_loggers() self.log = file_logger.FileLogger(name="honeypot").log() self.log.info('Starting Glastopf') conf_parser = ConfigParser() conf_parser.read("glastopf.cfg") self.options = { "hpfeeds": conf_parser.get("hpfeed", "enabled").encode('latin1'), "uid": conf_parser.get("webserver", "uid").encode('latin1'), "gid": conf_parser.get("webserver", "gid").encode('latin1'), "proxy_enabled": conf_parser.get("webserver", "proxy_enabled").encode('latin1') } if self.options["hpfeeds"] == "True": self.hpfeeds_logger = hpfeeds.HPFeedClient() self.log.info('HPFeeds started') if not self.test: if len(os.listdir('modules/handlers/emulators/dork_list/pages/')) == 0: gen_dork_list.regular_generate_dork(0) self.regular_gen_dork = threading.Thread( target=gen_dork_list.regular_generate_dork, args=(30,)) self.regular_gen_dork.daemon = True self.regular_gen_dork.start() self.profiler = profiler.Profiler() self.HTTP_parser = util.HTTPParser() self.MethodHandlers = method_handler.HTTPMethods() self.post_queue = Queue.Queue() self.post_processing = threading.Thread(target=self.post_processer) self.post_processing.daemon = True self.post_processing.start() privileges.drop(self.options['uid'], self.options['gid']) self.log.info('Glastopf instantiated and privileges dropped')