diff --git a/analyzers/Bluecoat/Bluecoat_Categorization.json b/analyzers/Bluecoat/Bluecoat_Categorization.json new file mode 100644 index 000000000..b4642db14 --- /dev/null +++ b/analyzers/Bluecoat/Bluecoat_Categorization.json @@ -0,0 +1,20 @@ +{ + "name": "Bluecoat_Categorization", + "version": "1.0", + "author": "CERT La Poste", + "url": "https://github.com/CERT-BDF/Cortex-Analyzers", + "description": "Retrieve Bluecoat categorization of a domain / url / FQDN", + "dataTypeList": [ + "domain", + "url", + "fqdn" + ], + "license": "AGPL-V3", + "command": "Bluecoat/categorization.py", + "config": { + "check_tlp": false, + "max_tlp": 3, + "service": "" + } +} + diff --git a/analyzers/Bluecoat/categorization.py b/analyzers/Bluecoat/categorization.py new file mode 100755 index 000000000..9db5e8770 --- /dev/null +++ b/analyzers/Bluecoat/categorization.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +import json +import re +import requests + +from cortexutils.analyzer import Analyzer + + +class BluecoatAnalyzer(Analyzer): + + def __init__(self): + Analyzer.__init__(self) + self.BC_url = 'https://sitereview.bluecoat.com/' + self.BC_parameter_name = 'url' + self.BC_sitereview = 'sitereview.jsp' + self.BC_rest_page = 'rest/categorization' + + def parse_answer(self, categorization, ratedate): + """ + Extract desired fields using RegEx + """ + regex_category_id = r'catdesc\.jsp\?catnum=(\d+)' + regex_category = r'>([\w\s\/]+)<\/a>' + regex_date = r'Last Time Rated\/Reviewed:(.*) +