# HG changeset patch # User BenoƮt Allard # Date 1411660183 -7200 # Node ID 2ce3676c9b2e5618f8c7cb194a3309c0d6eaa755 # Parent 8f41bb7f46810eac39b98a950354a04b4c52ce71 Ease the import of new documents diff -r 8f41bb7f4681 -r 2ce3676c9b2e CHANGES --- a/CHANGES Thu Sep 25 17:03:35 2014 +0200 +++ b/CHANGES Thu Sep 25 17:49:43 2014 +0200 @@ -1,3 +1,12 @@ +Farol 0.1.1 (2014-??-??) +======================== + +Main changes since 0.1: +----------------------- +* Ease the import of documents +* Add a Welcome page + + Farol 0.1 (2014-09-24) ====================== diff -r 8f41bb7f4681 -r 2ce3676c9b2e farol/main.py --- a/farol/main.py Thu Sep 25 17:03:35 2014 +0200 +++ b/farol/main.py Thu Sep 25 17:49:43 2014 +0200 @@ -87,13 +87,28 @@ def welcome(): return render_template('welcome.j2') +def parse_url(url): + set_current(parse(urlopen(url).read())) + @app.route('/new', methods=['GET', 'POST']) def new(): if request.method != 'POST': return render_template('new.j2', has_document=has_current(), now=utcnow()) - - if 'url' in request.form: - set_current(parse(urlopen(request.form['url']).read())) + url = None + if 'rhsa' in request.form: + year, index = request.form['id'].split(':') + parse_url("https://www.redhat.com/security/data/cvrf/%(year)s/cvrf-rhsa-%(year)s-%(index)s.xml" % {'year': year, 'index': index}) + elif 'oracle' in request.form: + parse_url("http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/%s.xml" % request.form['id']) + elif 'cisco' in request.form: + kind, date, name = request.form['id'].split('-', 3) + kind = {'sa': 'Advisory', 'sr': 'Response'}[kind] + parse_url("http://tools.cisco.com/security/center/contentxml/CiscoSecurity%(kind)s/cisco-%(id)s/cvrf/cisco-%(id)s_cvrf.xml" % {'kind': kind, 'id': request.form['id']}) + elif 'nasl' in request.form: + flash("I'm not able to parse NASL scripts yet", 'danger') + return redirect(url_for('new')) + elif 'url' in request.form: + parse_url(request.form['url']) elif 'local' in request.files: upload = request.files['local'] if not upload.filename.endswith('.xml'): diff -r 8f41bb7f4681 -r 2ce3676c9b2e farol/templates/about.j2 --- a/farol/templates/about.j2 Thu Sep 25 17:03:35 2014 +0200 +++ b/farol/templates/about.j2 Thu Sep 25 17:49:43 2014 +0200 @@ -45,6 +45,6 @@

If you want to remove this message and the DEBUG Footer alert, but still want to keep the Debug mode on, just set DEBUG_SURE=True in your configuration file.

{% endif %}
-

Farol is published under GPLv2+, and is Copyright © Greenbone Networks GmbH.

+

Farol is published under GPLv2+, and is Copyright © Greenbone Networks GmbH.

{% endblock %} diff -r 8f41bb7f4681 -r 2ce3676c9b2e farol/templates/base.j2 --- a/farol/templates/base.j2 Thu Sep 25 17:03:35 2014 +0200 +++ b/farol/templates/base.j2 Thu Sep 25 17:49:43 2014 +0200 @@ -98,7 +98,7 @@ @@ -128,7 +128,7 @@
Copyright © 2014 Greenbone Networks GmbH | - About ... + About Farol
Greenbone Networks GmbH diff -r 8f41bb7f4681 -r 2ce3676c9b2e farol/templates/new.j2 --- a/farol/templates/new.j2 Thu Sep 25 17:03:35 2014 +0200 +++ b/farol/templates/new.j2 Thu Sep 25 17:49:43 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import textinput, textarea %} +{% from "macros.j2" import textinput, textarea, panel %} {% set active='new' %} @@ -42,12 +42,33 @@

- Download document from URL + Download a document from an URL

+
+ {% for (type, placeholder) in [ + ('RHSA', 'YYYY:nnnn'), + ('Oracle', 'nnnnnnn'), + ('Cisco', 'sa-YYYYMMDD-xxx'), + ('NASL', '')] %} +
+
+ +
+ {{ type }}: + + + + +
+
+
+ {% endfor %} +
+
{{ textinput("url", "URL", "https://...", required=True, type="url") }} @@ -135,4 +156,10 @@
+{% call panel(heading="Load a document from the cache", title=4, collapsible=False) %} + +{% endcall %} + {% endblock %} diff -r 8f41bb7f4681 -r 2ce3676c9b2e farol/templates/vulnerability/view_remediation.j2 --- a/farol/templates/vulnerability/view_remediation.j2 Thu Sep 25 17:03:35 2014 +0200 +++ b/farol/templates/vulnerability/view_remediation.j2 Thu Sep 25 17:49:43 2014 +0200 @@ -39,7 +39,7 @@ {{ label_value('URL', remediation._url | urlize) }}
{% if remediation._productids or remediation._groupids %} - {% call panel(heading="Products", title=2) %} + {% call panel(heading="Products (%d)" % remediation._productids | length, title=2) %}