From 88eb85df46fe80495a91b63b4bf14422772c8514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 3 Jun 2021 19:07:02 -0700 Subject: [PATCH] fix: Avoid exception if rendered page is missing on broken tree --- lookyloo/modules.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lookyloo/modules.py b/lookyloo/modules.py index 6fc20275..b7db6ea1 100644 --- a/lookyloo/modules.py +++ b/lookyloo/modules.py @@ -21,7 +21,7 @@ from pysanejs import SaneJS from pyeupi import PyEUPI from pymisp import PyMISP, MISPEvent, MISPAttribute -from har2tree import CrawledTree, HostNode, URLNode +from har2tree import CrawledTree, HostNode, URLNode, Har2TreeError class MISP(): @@ -189,10 +189,14 @@ class UniversalWhois(): if auto_trigger and not self.allow_auto_trigger: return None - hostnode = crawled_tree.root_hartree.get_host_node_by_uuid(crawled_tree.root_hartree.rendered_node.hostnode_uuid) - self.query_whois_hostnode(hostnode) - for n in hostnode.get_ancestors(): - self.query_whois_hostnode(n) + try: + hostnode = crawled_tree.root_hartree.get_host_node_by_uuid(crawled_tree.root_hartree.rendered_node.hostnode_uuid) + except Har2TreeError as e: + self.logger.warning(e) + else: + self.query_whois_hostnode(hostnode) + for n in hostnode.get_ancestors(): + self.query_whois_hostnode(n) def whois(self, query: str) -> str: if not self.available: