From b9c9187e3e6fc29ef1b1b40b891bb513c7bf778d Mon Sep 17 00:00:00 2001 From: Terrtia Date: Wed, 25 Sep 2019 23:48:30 +0200 Subject: [PATCH] fix: [Tools] fix loop --- bin/Tools.py | 12 ++++++------ bin/packages/modules.cfg | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/Tools.py b/bin/Tools.py index 66d26ad7..235c8b08 100755 --- a/bin/Tools.py +++ b/bin/Tools.py @@ -40,7 +40,7 @@ def search_tools(item_id, item_content): regex_match = False for regex_nb in list(range(tool_dict['nb_regex'])): - regex_index = tool_dict['nb_regex'] + 1 + regex_index = regex_nb + 1 regex = tool_dict['regex{}'.format(regex_index)] signal.alarm(tool_dict['max_execution_time']) @@ -61,13 +61,12 @@ def search_tools(item_id, item_content): else: regex_match = True if 'tag{}'.format(regex_index) in tool_dict: + print('{} found: {}'.format(item_id, tool_dict['tag{}'.format(regex_index)])) msg = '{};{}'.format(tool_dict['tag{}'.format(regex_index)], item_id) - else: - msg = '{};{}'.format(tool_dict['tag'], item_id) + p.populate_set_out(msg, 'Tags') - p.populate_set_out(msg, 'Tags') - - if tools_found: + if regex_match: + print('{} found: {}'.format(item_id, tool_dict['name'])) # Tag Item msg = '{};{}'.format(tool_dict['tag'], item_id) p.populate_set_out(msg, 'Tags') @@ -205,6 +204,7 @@ if __name__ == "__main__": while True: # Get one message from the input queue item_id = p.get_from_set() + item_id = 'submitted/2019/09/25/4c299ce1-0147-4727-8030-d77f903a9774.gz' if item_id is None: publisher.debug("{} queue is empty, waiting".format(config_section)) time.sleep(1) diff --git a/bin/packages/modules.cfg b/bin/packages/modules.cfg index 7c8e3138..8e551697 100644 --- a/bin/packages/modules.cfg +++ b/bin/packages/modules.cfg @@ -30,6 +30,10 @@ publish = Redis_Tags subscribe = Redis_Global publish = Redis_Tags +[Tools] +subscribe = Redis_Global +publish = Redis_Tags + [Categ] subscribe = Redis_Global publish = Redis_CreditCards,Redis_Mail,Redis_Onion,Redis_Web,Redis_Credential,Redis_SourceCode,Redis_Cve,Redis_ApiKey