This repository was archived by the owner on May 14, 2021. It is now read-only.
Description 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!
Reactions are currently unavailable
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.
nexpose-client-python/nexpose/nexpose_asset.py
Line 43 in 6578134
nexpose-client-python/nexpose/nexpose_asset.py
Lines 32 to 103 in 6578134
Thanks!