Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion nexpose/nexpose_vulnerabilityexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from builtins import object
from .xml_utils import get_attribute, get_content_of
from .xml_utils import get_attribute, get_content_of, create_element
from future import standard_library
standard_library.install_aliases()

Expand Down Expand Up @@ -69,6 +69,35 @@ def CreateFromXML(xml_data):
details.asset_port = int(fix_null(get_attribute(xml_data, 'port-no', details.asset_port)))
return details

def AsXML(self):
attributes = {
'exception-id': self.id,
'vuln-id': self.vulnerability_id,
'vuln-key': self.vulnerability_key,
'submitter': self.submitter,
'reviewer': self.reviewer,
'status': self.status,
'reason': self.reason,
'scope': self.scope,
}
if self.expiration_date:
attributes['expiration-date'] = self.expiration_date
if self.asset_id:
attributes['asset-id'] = self.asset_id
if self.asset_port:
attributes['port-no'] = self.asset_port
xml_data = create_element('VulnerabilityException', attributes)
if self.submitter_comment:
submitter_comment = create_element('submitter-comment')
submitter_comment.text = self.submitter_comment
xml_data.append(submitter_comment)
if self.reviewer_comment:
reviewer_comment = create_element('reviewer-comment')
reviewer_comment.text = self.reviewer_comment
xml_data.append(reviewer_comment)
return xml_data


def __init__(self):
self.id = 0
self.vulnerability_id = ''
Expand Down