cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
260
Views
0
Helpful
1
Replies
Beginner

openVulnQueryClient Python API

Hi,

I created a python script as below using openVulnQuery library:

 

from openVulnQuery import query_client
query_client = query_client.OpenVulnQueryClient(client_id="xxxx", client_secret="yyyy")
version = "16.9.4"
advisories = query_client.get_by_ios_xe('ios', version)
print("Release {0} has {1} advisories".format(version,len(advisories)))
adv = query_client.get_by_ios_xe('ios',version)
print(adv)

I would like to print adv as a list of advisories. However, the display is: 

[<openVulnQuery._library.advisory.AdvisoryIOS object at 0x7fc5515f7390>, <openVulnQuery._library.advisory.AdvisoryIOS object at 0x7fc5515f7c88>, <openVulnQuery._library.advisory.AdvisoryIOS object at 0x7fc5515f72e8>, <openVulnQuery._library.advisory.AdvisoryIOS object at 0x7fc5515f77b8>]

How can I get a list of advisories?


Thanks,

1 REPLY 1
Highlighted
Beginner

Re: openVulnQueryClient Python API

Hello,

 

get_by_ios_xe returns a list of dictionaries: "return self.advisory_list(advisories['advisories'], None)". See https://github.com/CiscoPSIRT/openVulnAPI/blob/master/openVulnQuery/openVulnQuery/_library/advisory.py.

If you look at query_client.py, line 222, you'll find that  "advisory_list(self, advisories, adv_format)" returns [advisory.advisory_factory(adv, adv_format, self.logger).

 

You might want to print out the list elements you are interested in while you're iterating over the returned list. Like using "print(adv[i].advisory_title)"

 

Regards,

Holger

 

CreatePlease to create content
This widget could not be displayed.