From 09d3a35ed1c78d04b10f015d30f03243860a59e7 Mon Sep 17 00:00:00 2001 From: garanews Date: Fri, 26 Oct 2018 12:10:25 +0200 Subject: [PATCH] fix in case GSB value is missing I noticed that GSB value is not retrieved in json causing "index out of range" error. This fix checks if fields is available, otherwise go ahead. If this field is not available anymore we can skip it and remove also from template long. I don't find documentation about this. --- analyzers/URLhaus/URLhaus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analyzers/URLhaus/URLhaus.py b/analyzers/URLhaus/URLhaus.py index cd8d7771e..5630a1586 100644 --- a/analyzers/URLhaus/URLhaus.py +++ b/analyzers/URLhaus/URLhaus.py @@ -58,7 +58,7 @@ def parse(self, doc): "link": cols[1].find("a").attrs.get("href"), "status": cols[2].text, "tags": cols[3].text.split(), - "gsb": cols[4].text, - "reporter": cols[5].text + "gsb": cols[4].text if len(cols) > 5 else None, + "reporter": cols[5].text if len(cols) > 5 else cols[4].text }) return results