From 0bdc4f6aed83e73bbe47f9d42ab97c64f1084834 Mon Sep 17 00:00:00 2001 From: ecapuano Date: Sat, 20 May 2017 22:38:18 -0500 Subject: [PATCH] corrected for change to fortiguard portal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scraping is unreliable at times, especially when the vendor changes the URL parameters... ¯\_(ツ)_/¯ Was only able to test this locally due to my dev environment being affected by https://github.com/CERT-BDF/Cortex/issues/27 , but it appears to be functional once again. Let me know if there are any other issues with it, I promise to take less than 27 days to fix it :) --- analyzers/Fortiguard/urlcategory.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/analyzers/Fortiguard/urlcategory.py b/analyzers/Fortiguard/urlcategory.py index f0ea36f99..8870bdd03 100755 --- a/analyzers/Fortiguard/urlcategory.py +++ b/analyzers/Fortiguard/urlcategory.py @@ -18,9 +18,8 @@ def run(self): if self.data_type == 'domain' or self.data_type == 'url': try: pattern = re.compile("(?:Category: )([\w\s]+)") - baseurl = 'http://www.fortiguard.com/iprep?data=' - tailurl = '&lookup=Lookup' - url = baseurl + self.getData() + tailurl + baseurl = 'http://www.fortiguard.com/webfilter?q=' + url = baseurl + self.getData() req = requests.get(url) category_match = re.search(pattern, req.content, flags=0) self.report({