def start_background_workers(self): """ Starts background threads responsible for data processing and logging. """ privileges.drop(self.work_dir, self.options['uid'], self.options['gid']) self.workers_enabled = True dork_worker = gevent.spawn(self.dork_generator.regular_generate_dork, 30) post_processor_worker = gevent.spawn(self.post_processer) logger.info('Glastopf started and privileges dropped.') return [dork_worker, post_processor_worker]
def __init__(self, test=False, config="glastopf.cfg"): self.create_empty_dirs() self.test = test logger.info('Starting Glastopf') conf_parser = ConfigParser() conf_parser.read(config) 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(config=config) logger.info("HPFeeds started") self.profiler_available = False (self.maindb, self.dorkdb) = self.setup_main_database(conf_parser) self.dork_generator = self.setup_dork_generator(conf_parser) if not self.test: self.loggers = logging_handler.get_aux_loggers() if len(self.dork_generator.get_current_pages()) == 0: logger.info("Generating initial dork pages - this can take a while.") self.dork_generator.regular_generate_dork(0) if not test: regular_gen_dork = threading.Thread( target=self.dork_generator.regular_generate_dork, args=(30,)) regular_gen_dork.daemon = True regular_gen_dork.start() if self.profiler_available: self.profiler = profiler.Profiler(self.maindb) 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']) logger.info('Glastopf instantiated and privileges dropped')
def start_background_workers(self): """ Starts background threads responsible for data processing and logging. """ privileges.drop(self.work_dir, self.options["uid"], self.options["gid"]) self.workers_enabled = True self.loggers = logging_handler.get_aux_loggers() dork_thread = threading.Thread(target=self.dork_generator.regular_generate_dork, args=(30,)) dork_thread.daemon = True dork_thread.start() self.post_processing = threading.Thread(target=self.post_processer) self.post_processing.daemon = True self.post_processing.start() logger.info("Glastopf started and privileges dropped.")
def start_background_workers(self): """ Starts background threads responsible for data processing and logging. """ privileges.drop(self.work_dir, self.options['uid'], self.options['gid']) self.workers_enabled = True self.loggers = logging_handler.get_aux_loggers(self.data_dir) dork_thread = threading.Thread( target=self.dork_generator.regular_generate_dork, args=(30,)) dork_thread.daemon = True dork_thread.start() self.post_processing = threading.Thread(target=self.post_processer) self.post_processing.daemon = True self.post_processing.start() logger.info('Glastopf started and privileges dropped.')
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')