chg: [Tracker} Tracker_Typo_Squatting

This commit is contained in:
David Cruciani 2022-06-15 15:28:34 +02:00
parent 6e1c92e9f0
commit ae83f4b0d4
3 changed files with 9 additions and 10 deletions

View file

@ -234,7 +234,7 @@ function launching_scripts {
################################## ##################################
# TRACKERS MODULES # # TRACKERS MODULES #
################################## ##################################
screen -S "Script_AIL" -X screen -t "Tracker_Typo" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Typo.py; read x" screen -S "Script_AIL" -X screen -t "Tracker_Typo_Squatting" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Typo_Squatting.py; read x"
sleep 0.1 sleep 0.1
screen -S "Script_AIL" -X screen -t "Tracker_Term" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Term.py; read x" screen -S "Script_AIL" -X screen -t "Tracker_Term" bash -c "cd ${AIL_BIN}/trackers; ${ENV_PY} ./Tracker_Term.py; read x"
sleep 0.1 sleep 0.1

View file

@ -37,7 +37,7 @@ subscribe = Redis_D4_client
subscribe = Redis subscribe = Redis
publish = Redis_Tags publish = Redis_Tags
[Tracker_Typo] [Tracker_Typo_Squatting]
subscribe = Redis_Host subscribe = Redis_Host
publish = Redis_Tags publish = Redis_Tags

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*-coding:UTF-8 -* # -*-coding:UTF-8 -*
""" """
The Tracker_Typo Module The Tracker_Typo_Squatting Module
=================== ===================
""" """
@ -37,25 +37,24 @@ def timeout_handler(signum, frame):
signal.signal(signal.SIGALRM, timeout_handler) signal.signal(signal.SIGALRM, timeout_handler)
class Tracker_Typo(AbstractModule): class Tracker_Typo_Squatting(AbstractModule):
mail_body_template = "AIL Framework,\nNew occurrence for tracked Typo: {}\nitem id: {}\nurl: {}{}" mail_body_template = "AIL Framework,\nNew occurrence for tracked Typo: {}\nitem id: {}\nurl: {}{}"
""" """
Tracker_Typo module for AIL framework Tracker_Typo_Squatting module for AIL framework
""" """
def __init__(self): def __init__(self):
super(Tracker_Typo, self).__init__() super(Tracker_Typo_Squatting, self).__init__()
self.pending_seconds = 5 self.pending_seconds = 5
#self.max_execution_time = self.process.config.getint('Tracker_Typo', "max_execution_time") #self.max_execution_time = self.process.config.getint('Tracker_Typo_Squatting', "max_execution_time")
self.full_item_url = self.process.config.get("Notifications", "ail_domain") + "/object/item?id=" self.full_item_url = self.process.config.get("Notifications", "ail_domain") + "/object/item?id="
# loads tracked words # loads tracked words
self.typosquat_tracked_words_list = Tracker.get_typosquatting_tracked_words_list() self.typosquat_tracked_words_list = Tracker.get_typosquatting_tracked_words_list()
print(len(self.typosquat_tracked_words_list["google.com"]))
self.last_refresh_typosquat = time.time() self.last_refresh_typosquat = time.time()
self.redis_logger.info(f"Module: {self.module_name} Launched") self.redis_logger.info(f"Module: {self.module_name} Launched")
@ -98,7 +97,7 @@ class Tracker_Typo(AbstractModule):
mail_to_notify = Term.get_term_mails(term_uuid) mail_to_notify = Term.get_term_mails(term_uuid)
if mail_to_notify: if mail_to_notify:
mail_subject = Tracker.get_email_subject(term_uuid) mail_subject = Tracker.get_email_subject(term_uuid)
mail_body = Tracker_Typo.mail_body_template.format(term, item_id, self.full_item_url, item_id) mail_body = Tracker_Typo_Squatting.mail_body_template.format(term, item_id, self.full_item_url, item_id)
for mail in mail_to_notify: for mail in mail_to_notify:
self.redis_logger.debug(f'Send Mail {mail_subject}') self.redis_logger.debug(f'Send Mail {mail_subject}')
print(f'S print(item_content)end Mail {mail_subject}') print(f'S print(item_content)end Mail {mail_subject}')
@ -127,5 +126,5 @@ class Tracker_Typo(AbstractModule):
if __name__ == '__main__': if __name__ == '__main__':
module = Tracker_Typo() module = Tracker_Typo_Squatting()
module.run() module.run()