Kulyutmaz is a project developed for the regional TUBITAK competition's programming field thart aims to create a more advanced phishing e-mail detection algorithm using website content checking and a neural network that we have trained.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
714 B

4 years ago
  1. import sys
  2. log_file = sys.argv[1]
  3. file_prev = ""
  4. tags = tuple(sys.argv[2].split(","))
  5. def str_diff(str1:str,str2:str) -> str:
  6. return str1[len(str2):]
  7. while 1:
  8. try:
  9. new_log = ""
  10. with open("logs/" + log_file,"r") as f:
  11. file_current = f.read()
  12. if file_prev != file_current:
  13. for log in str_diff(file_current,file_prev).split("\n"):
  14. for tag in tags:
  15. if log.startswith("[{}]".format(tag)):
  16. new_log += log + "\n"
  17. print(new_log, end="")
  18. file_prev = file_current
  19. except KeyboardInterrupt:
  20. print("Interrupt detected, quitting!")
  21. exit(0)
  22. break