From 72d774f37b46798307f4a6ca9267429477c816e7 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 4 Apr 2023 15:18:15 +0200 Subject: [PATCH] fix: [queues] fix Mixer queue --- bin/crawlers/Crawler.py | 2 +- bin/modules/submit_paste.py | 6 ++++-- bin/packages/modules.cfg | 9 ++++----- var/www/blueprints/objects_item.py | 6 +++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/crawlers/Crawler.py b/bin/crawlers/Crawler.py index 9c117e0b..8a4237f8 100755 --- a/bin/crawlers/Crawler.py +++ b/bin/crawlers/Crawler.py @@ -228,7 +228,7 @@ class Crawler(AbstractModule): gzip64encoded = crawlers.get_gzipped_b64_item(item_id, entries['html']) # send item to Global relay_message = f'crawler {item_id} {gzip64encoded}' - self.send_message_to_queue(relay_message, 'Mixer') + self.send_message_to_queue(relay_message, 'Import') # Tag msg = f'infoleak:submission="crawler";{item_id}' diff --git a/bin/modules/submit_paste.py b/bin/modules/submit_paste.py index f6123b95..1cd56162 100755 --- a/bin/modules/submit_paste.py +++ b/bin/modules/submit_paste.py @@ -110,6 +110,8 @@ class SubmitPaste(AbstractModule): if nb_submit > 0: try: uuid = self.r_serv_db.srandmember('submitted:uuid') + if isinstance(uuid, list): + return uuid[0] # Module processing with the message from the queue self.redis_logger.debug(uuid) self.compute(uuid) @@ -294,8 +296,8 @@ class SubmitPaste(AbstractModule): if self.r_serv_log_submit.get(f'{uuid}:nb_end') == self.r_serv_log_submit.get(f'{uuid}:nb_total'): self.r_serv_log_submit.set(f'{uuid}:end', 1) - self.redis_logger.debug(f' {rel_item_path} send to Global') - print(f' {rel_item_path} send to Global') + self.redis_logger.debug(f' {rel_item_path} send to Mixer') + print(f' {rel_item_path} send to Mixer') self.r_serv_log_submit.sadd(f'{uuid}:paste_submit_link', rel_item_path) curr_date = datetime.date.today() diff --git a/bin/packages/modules.cfg b/bin/packages/modules.cfg index ca9b9560..8e408f1c 100644 --- a/bin/packages/modules.cfg +++ b/bin/packages/modules.cfg @@ -12,10 +12,10 @@ subscribe = Redis_Import publish = Redis_Mixer [Sync_importer] -publish = Redis_Mixer,Redis_Tags +publish = Redis_Import,Redis_Tags [Importer_Json] -publish = Redis_Mixer,Redis_Tags +publish = Redis_Import,Redis_Tags [Global] subscribe = Redis_Mixer @@ -154,11 +154,10 @@ subscribe = Redis_Global publish = Redis_Tags [submit_paste] -subscribe = Redis -publish = Redis_Mixer +publish = Redis_Import [Crawler] -publish = Redis_Mixer,Redis_Tags +publish = Redis_Import,Redis_Tags [IP] subscribe = Redis_Global diff --git a/var/www/blueprints/objects_item.py b/var/www/blueprints/objects_item.py index 67b05648..d83b1866 100644 --- a/var/www/blueprints/objects_item.py +++ b/var/www/blueprints/objects_item.py @@ -24,7 +24,6 @@ from lib import item_basic from lib.objects.Items import Item from lib.objects.Screenshots import Screenshot from lib import Tag -from export import Export from lib import module_extractor @@ -73,14 +72,15 @@ def showItem(): # # TODO: support post meta['father'] = item_basic.get_item_parent(item_id) ## EXPORT SECTION # # TODO: ADD in Export SECTION - meta['hive_case'] = Export.get_item_hive_cases(item_id) + # meta['hive_case'] = Export.get_item_hive_cases(item_id) + meta['hive_case'] = None extracted = module_extractor.extract(item.id, content=meta['content']) extracted_matches = module_extractor.get_extracted_by_match(extracted) return render_template("show_item.html", bootstrap_label=bootstrap_label, modal_add_tags=Tag.get_modal_add_tags(meta['id'], object_type='item'), - is_hive_connected=Export.get_item_hive_cases(item_id), + is_hive_connected=False, meta=meta, extracted=extracted, extracted_matches=extracted_matches)