@@ -39,6 +39,10 @@ def run(self, params={}):
3939 last_id = resp ["id" ]
4040
4141 while True :
42+
43+ if site_id and site_id in response [0 ]['siteId' ]:
44+ continue
45+
4246 while True :
4347 endpoint = Asset .assets (self .connection .console_url , last_id + 1 )
4448
@@ -65,18 +69,20 @@ def run(self, params={}):
6569 # Next, run GET Asset Vulnerabilities to retrieve vulnerability IDs
6670 endpoint = VulnerabilityResult .vulnerabilities_for_asset (self .connection .console_url , last_id + 1 )
6771 try :
68- asset_vuln_response = resource_helper .resource_request (endpoint = endpoint , method = "get" )
72+ asset_vuln_response = resource_helper .paged_resource_request (endpoint = endpoint , method = "get" )
6973 except Exception :
7074 break
7175
72- # Add all the IDs into a list
76+ # Add all the vulnerability IDs related to the asset into a list
7377 vulnerability_ids = []
74- for i in asset_vuln_response :
75- vulnerability_ids .append (i .get ('id' ))
78+ for vulns in asset_vuln_response :
79+ for i in vulns :
80+ for j in i :
81+ vulnerability_ids .append (j .get ('id' ))
7682
7783 # Next, Get Asset Vulnerability Solution by vulnerability ID
7884 for vulnerability_id in vulnerability_ids :
79- endpoint = Asset .asset_vulnerability_solution (self .connection .console_url , last_id + 1 , vuln_id )
85+ endpoint = Asset .asset_vulnerability_solution (self .connection .console_url , last_id + 1 , vulnerability_id )
8086 try :
8187 solution_response = resource_helper .resource_request (endpoint = endpoint , method = "get" )
8288 except Exception :
0 commit comments