changeset 36:cb8e8416a765

Add HTML export format.
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 16 Dec 2014 16:20:50 +0100
parents a94fd33db44a
children ba0eb65d4134
files farolluz/renderer.py farolluz/templates/html.j2
diffstat 2 files changed, 88 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/farolluz/renderer.py	Wed Nov 05 08:54:53 2014 +0100
+++ b/farolluz/renderer.py	Tue Dec 16 16:20:50 2014 +0100
@@ -51,7 +51,7 @@
     'Red Hat Enterprise Linux AS (Advanced Server) version 2.1' : 'RHENT_2.1',
 }
 
-def calculateRiskFactor(cvss_score, debug=0):
+def calculateRiskFactor(cvss_score):
     """
     Calculates and Return Risk Factor given CVSS Base Score
     """
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/farolluz/templates/html.j2	Tue Dec 16 16:20:50 2014 +0100
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html>
+
+ <head>
+  <meta charset="utf-8">
+  <title>{{ cvrf._title }}</title>
+ </head>
+
+ <body>
+  <article>
+   <header>
+    <h1>{{ cvrf._title }}</h1>
+    <h2>{{ cvrf._type }}</h2>
+   </header>
+   {%- for note in cvrf._notes %}
+   <section>
+    <h3>{{ note._title if note._title else note._type }}</h3>
+    <p>{{ note._description }}</p>
+   </section>
+   {%- endfor %}
+   {%- for vuln in cvrf._vulnerabilities %}{% for note in vuln._notes %}
+   <section>
+    <h3>{{ note._title if note._title else note._type }}</h3>
+    <p>{{ note._note }}</p>
+   </section>
+   {%- endfor %}{% endfor %}
+   <section>
+    <h3>Affected</h3>
+    <ul>
+    {%- for vuln in cvrf._vulnerabilities %}
+     {%- for status in vuln._productstatuses %}
+     <li>{{status._type}}: {% set comma = joiner(', ') %}
+      {%- for prodid in status._productids %}
+       {%- with product = cvrf.getProductForID(prodid) %}
+         {{- comma() }}{{ product._name }}
+       {%- endwith %}
+      {%- endfor -%}
+     </li>
+     {%- endfor %}
+    {%- endfor %}
+    </ul>
+   </section>
+   {%- with cvss = cvrf.getHighestCVSS() %}{% if cvss %}
+   <section>
+    <h3>Severity</h3>
+    <p><tt>{{ cvss._vector }}</tt> ({{ cvss._basescore }} - {{ cvss._basescore | risk_factor }})<p>
+   </section>
+   {%- endif %}{% endwith %}
+   <section>
+    <h3>Resolution</h3>
+    {%- for vuln in cvrf._vulnerabilities %}
+     {%- for rem in vuln._remediations %}
+    <section>
+     <h4>{{ rem._type }}</h4>
+     <p>{{ rem._description }}</p>
+    </section>
+     {%- endfor %}
+    {%- endfor %}
+   </section>
+   <section>
+    <h3>References</h3>
+    <ul>
+     {%- for ref in cvrf._references if not ref._type == 'Self' %}
+     <li>{{ ref }}</li>
+     {%- endfor %}
+     {%- for vuln in cvrf._vulnerabilities %}
+      {%- for ref in vuln._references if not ref._type == 'Self' %}
+     <li>{{ ref }}</li>
+      {%- endfor %}
+      {%- if vuln._cve %}
+     <li>{{ vuln._cve }}</li>
+      {%- endif %}
+     {%- endfor %}
+    </ul>
+   </section>
+   <section>
+    <h3>History</h3>
+    <ul>
+     {%- for revision in cvrf._tracking._history %}
+     <li>{{ revision._date.strftime('%Y-%m-%d')}}: {{ revision._description }}</li>
+     {%- endfor %}
+    </ul>
+   </section>
+  </article>
+ </body>
+
+</html>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)