openVulnQueryClient Python API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2019 08:50 AM
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2019 06:28 AM
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
