Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
This repository was archived by the owner on May 14, 2021. It is now read-only.

Asset Risk Factor only available in AssetSummary #30

@santsys

Description

@santsys

When querying an asset, the risk_factor value is available via an AssetSummary, but not via AssetDetails.

The code in AssetSummary (risk_factor) should probably be in AssetDetails as well.

asset.risk_factor = float('0' + get_attribute(xml_data, 'riskfactor', asset.risk_factor)) # riskfactor can be an emtpy string

class AssetSummary(AssetBase):
@staticmethod
def Create():
return AssetSummary()
@staticmethod
def CreateFromXML(xml_data, site_id=None):
asset = AssetSummary.Create()
asset.InitializeFromXML(xml_data)
asset.site_id = int(site_id if site_id is not None else get_attribute(xml_data, 'site-id', asset.site_id))
asset.host = get_attribute(xml_data, 'address', asset.host)
asset.risk_factor = float('0' + get_attribute(xml_data, 'riskfactor', asset.risk_factor)) # riskfactor can be an emtpy string
return asset
def __init__(self):
AssetBase.__init__(self)
self.site_id = 0
self.host = ''
self.risk_factor = 1.0
class AssetDetails(AssetBase):
@staticmethod
def CreateFromJSON(json_dict):
host_names = json_dict["host_names"]
host_type = json_dict["host_type"]
details = AssetDetails()
details.InitializeFromJSON(json_dict)
details.ip_address = json_dict["ip"]
details.mac_address = json_dict["mac"]
details.addresses = json_dict["addresses"]
if host_names is not None:
details.host_names = host_names
if host_type is not None:
details.host_type = host_type
details.os_name = json_dict["os_name"]
details.os_cpe = json_dict["os_cpe"]
details.last_scan_id = json_dict['assessment']['json']['last_scan_id']
details.last_scan_date = json_dict['assessment']['json']['last_scan_date']
# TODO:
# ----begin
details.files = []
details.vulnerability_instances = []
details.unique_identifiers = []
details.group_accounts = []
details.user_accounts = []
details.vulnerabilities = []
details.software = []
details.services = []
# TODO:
# ----end
return details
def __init__(self):
AssetBase.__init__(self)
self.ip_address = ''
self.mac_address = ''
self.addresses = []
self.host_names = []
self.host_type = AssetHostTypes.Empty
self.os_name = ''
self.os_cpe = ''
self.last_scan_id = 0
self.last_scan_date = ''
self.files = []
self.vulnerability_instances = []
self.unique_identifiers = []
self.group_accounts = []
self.user_accounts = []
self.vulnerabilities = []
self.software = []
self.services = []

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions