Mercurial > farol > farol
comparison farol/vulnerability.py @ 62:ce49bd1512dd
Make pyflafes a happier
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Wed, 08 Oct 2014 12:55:40 +0200 |
parents | 55b72057b066 |
children | aad7db3f93b6 |
comparison
equal
deleted
inserted
replaced
61:55b72057b066 | 62:ce49bd1512dd |
---|---|
25 from flask import (Blueprint, render_template, abort, redirect, request, | 25 from flask import (Blueprint, render_template, abort, redirect, request, |
26 url_for) | 26 url_for) |
27 | 27 |
28 from farolluz.parsers.cvrf import parseDate | 28 from farolluz.parsers.cvrf import parseDate |
29 from farolluz.cvrf import (CVRFVulnerability, CVRFVulnerabilityID, CVRFNote, | 29 from farolluz.cvrf import (CVRFVulnerability, CVRFVulnerabilityID, CVRFNote, |
30 CVRFReference, CVRFAcknowledgment, CVRFCWE, CVRFInvolvement, CVRFThreat, | 30 CVRFReference, CVRFCWE, CVRFInvolvement, CVRFThreat, CVRFProductStatus, |
31 CVRFProductStatus, CVRFCVSSSet, CVRFRemediation) | 31 CVRFCVSSSet, CVRFRemediation) |
32 from farolluz.renderer import utcnow | 32 from farolluz.renderer import utcnow |
33 | 33 |
34 from .controller import (update_note_from_request, create_note_from_request, | 34 from .controller import (update_note_from_request, create_note_from_request, |
35 update_reference_from_request, create_reference_from_request, | 35 update_reference_from_request, create_reference_from_request, |
36 update_acknowledgment_from_request, create_acknowledgment_from_request) | 36 update_acknowledgment_from_request, create_acknowledgment_from_request) |
250 return render_template('vulnerability/view_threat.j2', ordinal=ordinal, index=index, threat=threat, cvrf=get_current()) | 250 return render_template('vulnerability/view_threat.j2', ordinal=ordinal, index=index, threat=threat, cvrf=get_current()) |
251 | 251 |
252 @vulnerability.route('/<int:ordinal>/threat/add', methods=['GET', 'POST']) | 252 @vulnerability.route('/<int:ordinal>/threat/add', methods=['GET', 'POST']) |
253 @document_required | 253 @document_required |
254 def add_threat(ordinal): | 254 def add_threat(ordinal): |
255 cvrf = get_current() | |
256 if request.method != 'POST': | 255 if request.method != 'POST': |
257 return render_template('vulnerability/edit_threat.j2', | 256 return render_template('vulnerability/edit_threat.j2', |
258 ordinal=ordinal, | 257 ordinal=ordinal, |
259 types=CVRFThreat.TYPES, groups=get_groups(), now=utcnow(), | 258 types=CVRFThreat.TYPES, groups=get_groups(), now=utcnow(), |
260 action='Add') | 259 action='Add') |
274 def edit_threat(ordinal, index): | 273 def edit_threat(ordinal, index): |
275 try: | 274 try: |
276 threat = get_vuln(ordinal)._threats[index] | 275 threat = get_vuln(ordinal)._threats[index] |
277 except IndexError: | 276 except IndexError: |
278 abort(404) | 277 abort(404) |
279 cvrf = get_current() | |
280 if request.method != 'POST': | 278 if request.method != 'POST': |
281 return render_template('vulnerability/edit_threat.j2', | 279 return render_template('vulnerability/edit_threat.j2', |
282 ordinal=ordinal, index=index, | 280 ordinal=ordinal, index=index, |
283 type=threat._type, date=threat._date, description=threat._description, productids=threat._productids, groupids=threat._groupids, | 281 type=threat._type, date=threat._date, description=threat._description, productids=threat._productids, groupids=threat._groupids, |
284 types=threat.TYPES, groups=get_groups(), now=utcnow()) | 282 types=threat.TYPES, groups=get_groups(), now=utcnow()) |