<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cisco PSIRT Python openVulnQuery script errors in Services Discussions</title>
    <link>https://community.cisco.com/t5/services-discussions/cisco-psirt-python-openvulnquery-script-errors/m-p/3774432#M394</link>
    <description>&lt;P&gt;Hi, I am working on a python script to iterate over a list of models and versions and query Cisco PSIRT using openVulnQuery to return the recommended version of IOS and relevant vulnerabilities. I have registered for API access and have a username/password but my code is not working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;#!/usr/bin/env python&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;from openVulnQuery import query_client&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;query_client = query_client.OpenVulnQueryClient(client_id='my_id',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;client_secret='my_secret')&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;#test = query_client.get_by_severity(adv_format="cvrf")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;#filter1 = query_client.FirstPublished('2018-12-01', '2018-12-18')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;#advisories = client.get_by_all(adv_format='cvrf', all_adv='all', a_filter=filter1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_year(year=2010, adv_format='cvrf')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_ios_xe('ios', '3.16.1S')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;print(advisories)&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I during development I received some errors:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;$ ./getVuln.py&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "./getVuln.py", line 7, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;test = query_client.get_by_severity(adv_format="cvrf")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;TypeError: get_by_severity() takes at least 3 arguments (2 given)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Unable to find any documentation about what arguments it is looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I would get a KeyError:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;$ ./getVuln.py&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "./getVuln.py", line 10, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_year(year=2010, adv_format='cvrf')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/query_client.py", line 122, in get_by_year&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;return self.advisory_list(advisories['advisories'], adv_format)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/query_client.py", line 223, in advisory_list&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;for adv in advisories]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/advisory.py", line 130, in advisory_factory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;adv_map[k] = adv_data[v]&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" size="2"&gt;KeyError: 'iosRelease'&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I tried with python 2 and 3 with similar results. I am not sure how to proceed so if anyone has working code that I can stare and compare with I would appreciate your help. It seems like the KeyError issue is referring to issues within the openVulnQuery libraries themselves but I am not sure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just learning Python so I apologize if this is simple...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 20:51:29 GMT</pubDate>
    <dc:creator>MikeS_Net</dc:creator>
    <dc:date>2019-01-07T20:51:29Z</dc:date>
    <item>
      <title>Cisco PSIRT Python openVulnQuery script errors</title>
      <link>https://community.cisco.com/t5/services-discussions/cisco-psirt-python-openvulnquery-script-errors/m-p/3774432#M394</link>
      <description>&lt;P&gt;Hi, I am working on a python script to iterate over a list of models and versions and query Cisco PSIRT using openVulnQuery to return the recommended version of IOS and relevant vulnerabilities. I have registered for API access and have a username/password but my code is not working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;#!/usr/bin/env python&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;from openVulnQuery import query_client&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;query_client = query_client.OpenVulnQueryClient(client_id='my_id',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;client_secret='my_secret')&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;#test = query_client.get_by_severity(adv_format="cvrf")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;#filter1 = query_client.FirstPublished('2018-12-01', '2018-12-18')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;#advisories = client.get_by_all(adv_format='cvrf', all_adv='all', a_filter=filter1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_year(year=2010, adv_format='cvrf')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_ios_xe('ios', '3.16.1S')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;print(advisories)&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I during development I received some errors:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;$ ./getVuln.py&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "./getVuln.py", line 7, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;test = query_client.get_by_severity(adv_format="cvrf")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;TypeError: get_by_severity() takes at least 3 arguments (2 given)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Unable to find any documentation about what arguments it is looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I would get a KeyError:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier" size="2"&gt;$ ./getVuln.py&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "./getVuln.py", line 10, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;advisories = query_client.get_by_year(year=2010, adv_format='cvrf')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/query_client.py", line 122, in get_by_year&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;return self.advisory_list(advisories['advisories'], adv_format)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/query_client.py", line 223, in advisory_list&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;for adv in advisories]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;File "/home/ms/.local/lib/python2.7/site-packages/openVulnQuery/_library/advisory.py", line 130, in advisory_factory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;adv_map[k] = adv_data[v]&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" size="2"&gt;KeyError: 'iosRelease'&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I tried with python 2 and 3 with similar results. I am not sure how to proceed so if anyone has working code that I can stare and compare with I would appreciate your help. It seems like the KeyError issue is referring to issues within the openVulnQuery libraries themselves but I am not sure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just learning Python so I apologize if this is simple...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:51:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/services-discussions/cisco-psirt-python-openvulnquery-script-errors/m-p/3774432#M394</guid>
      <dc:creator>MikeS_Net</dc:creator>
      <dc:date>2019-01-07T20:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco PSIRT Python openVulnQuery script errors</title>
      <link>https://community.cisco.com/t5/services-discussions/cisco-psirt-python-openvulnquery-script-errors/m-p/3783885#M395</link>
      <description>&lt;P&gt;Try a couple of things:&lt;/P&gt;
&lt;P&gt;1. Change:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;adv_format='cvrf' &lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;adv_format='default' &lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;...we tool the cvrf and oval statement requirements a while back&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Make sure that you are running the latest version of the openVulnQuery client (v1.30)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;└──╼ #pip show openVulnQuery
Name: OpenVulnQuery
Version: 1.30
Summary: A python-based module(s) to query the Cisco PSIRT openVuln API.
Home-page: https://github.com/CiscoPSIRT/openVulnAPI/tree/master/openVulnQuery
Author: Omar Santos
Author-email: os@cisco.com
License: The MIT License (MIT)
Location: /opt/conda/lib/python3.7/site-packages
Requires: requests, argparse&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 04:05:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/services-discussions/cisco-psirt-python-openvulnquery-script-errors/m-p/3783885#M395</guid>
      <dc:creator>Omar Santos</dc:creator>
      <dc:date>2019-01-21T04:05:00Z</dc:date>
    </item>
  </channel>
</rss>

