09-14-2017 10:07 AM
Being relatively new to scripting, I was wondering if it possible to change the column order when downloading in CSV formation using the API?
Solved! Go to Solution.
10-03-2017 09:23 PM
Hi William,
You bring an excellent point. The column order does not come from the API, but the openVulnQuery client. You will need to change that "post export".
You are correct. In my example below I do the same query twice and export the output to two CSV files (example_1.csv and example_2.csv). In the second example, I change the order of the "filter" (fields).
bash-3.2$ openVulnQuery --cvrf --latest 2 -f advisory_id sir cves --csv example_1.csv bash-3.2$ bash-3.2$ cat example_1.csv advisory_id,sir,cves cisco-sa-20170419-cimc,High,CVE-2017-6619 cisco-sa-20170419-cimc3,Critical,CVE-2017-6616 bash-3.2$ bash-3.2$ bash-3.2$ bash-3.2$ openVulnQuery --cvrf --latest 2 -f advisory_id cves sir --csv example_2.csv bash-3.2$ cat example_2.csv advisory_id,sir,cves cisco-sa-20170419-cimc,High,CVE-2017-6619 cisco-sa-20170419-cimc3,Critical,CVE-2017-6616
As you can see, the columns stayed the same.
The openVulnQuery client is a community supported client. I have added an enhancement request at GitHub:
https://github.com/CiscoPSIRT/openVulnAPI/issues/39
Thanks again!
Omar
10-03-2017 09:23 PM
Hi William,
You bring an excellent point. The column order does not come from the API, but the openVulnQuery client. You will need to change that "post export".
You are correct. In my example below I do the same query twice and export the output to two CSV files (example_1.csv and example_2.csv). In the second example, I change the order of the "filter" (fields).
bash-3.2$ openVulnQuery --cvrf --latest 2 -f advisory_id sir cves --csv example_1.csv bash-3.2$ bash-3.2$ cat example_1.csv advisory_id,sir,cves cisco-sa-20170419-cimc,High,CVE-2017-6619 cisco-sa-20170419-cimc3,Critical,CVE-2017-6616 bash-3.2$ bash-3.2$ bash-3.2$ bash-3.2$ openVulnQuery --cvrf --latest 2 -f advisory_id cves sir --csv example_2.csv bash-3.2$ cat example_2.csv advisory_id,sir,cves cisco-sa-20170419-cimc,High,CVE-2017-6619 cisco-sa-20170419-cimc3,Critical,CVE-2017-6616
As you can see, the columns stayed the same.
The openVulnQuery client is a community supported client. I have added an enhancement request at GitHub:
https://github.com/CiscoPSIRT/openVulnAPI/issues/39
Thanks again!
Omar
10-10-2017 02:05 PM
Omar,
Huge thanks on the reply!!!
That would be a nice have since I use the API for one of our customers which we have weekly meetings on the vulnerabilities and we order the columns a certain way which currently I need to manually move them around.
I just want to add that the API has saved me a ton of time over the way I used to have to put together the doc for the customer.
Best,
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide