diff --git a/bin/lib/objects/Cves.py b/bin/lib/objects/Cves.py index e0315d58..07c3b8fb 100755 --- a/bin/lib/objects/Cves.py +++ b/bin/lib/objects/Cves.py @@ -76,17 +76,21 @@ class Cve(AbstractDaterangeObject): self._add(date, item_id) def get_cve_search(self): - response = requests.get(f'https://cvepremium.circl.lu/api/cve/{self.id}', timeout=10) - if response.status_code == 200: - json_response = response.json() - # 'summary' - # 'references' - # 'last-modified' - # 'Published' - # 'Modified' - return json_response - else: - return {'error': f'{response.status_code}'} + try: + response = requests.get(f'https://cvepremium.circl.lu/api/cve/{self.id}', timeout=10) + if response.status_code == 200: + json_response = response.json() + # 'summary' + # 'references' + # 'last-modified' + # 'Published' + # 'Modified' + return json_response + else: + return {'error': f'{response.status_code}'} + except requests.exceptions.ConnectionError: + return {'error': f'Connection Error'} + # TODO ADD SEARCH FUNCTION diff --git a/var/www/templates/correlation/metadata_card_cve.html b/var/www/templates/correlation/metadata_card_cve.html index 1e64008c..d1cfab9f 100644 --- a/var/www/templates/correlation/metadata_card_cve.html +++ b/var/www/templates/correlation/metadata_card_cve.html @@ -47,57 +47,60 @@ {% if dict_object["metadata_card"]["cve_search"] %} -
  • - - - - - - - - - - - - - - - - - - - -
    Summary{{ dict_object["metadata_card"]["cve_search"].get("summary") }}
    Published{{ dict_object["metadata_card"]["cve_search"].get("Published") }}
    Modified{{ dict_object["metadata_card"]["cve_search"].get("Modified") }}
    last-modified{{ dict_object["metadata_card"]["cve_search"].get("last-modified") }}
    -
  • + {% if 'error' in dict_object["metadata_card"]["cve_search"] %} + CVE Search Error: {{ dict_object["metadata_card"]["cve_search"]["error"] }} + {% else %} +
  • + + + + + + + + + + + + + + + + + + + +
    Summary{{ dict_object["metadata_card"]["cve_search"].get("summary") }}
    Published{{ dict_object["metadata_card"]["cve_search"].get("Published") }}
    Modified{{ dict_object["metadata_card"]["cve_search"].get("Modified") }}
    last-modified{{ dict_object["metadata_card"]["cve_search"].get("last-modified") }}
    +
  • - {% if dict_object["metadata_card"]["cve_search"].get("references") %} -
    -
    -
    -
    - -
    -
    -
    -
    -
      - {% for ref in dict_object["metadata_card"]["cve_search"].get("references") %} -
    • {{ ref }}
    • - {% endfor %} -
    + {% if dict_object["metadata_card"]["cve_search"].get("references") %} +
    +
    +
    +
    + +
    +
    +
    +
    +
      + {% for ref in dict_object["metadata_card"]["cve_search"].get("references") %} +
    • {{ ref }}
    • + {% endfor %} +
    +
    -
    + {% endif %} {% endif %} - {% endif %}