commit:     dda658f89dd2514a89dade9fa9d52d14b4d2c7cb
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  4 04:05:24 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Mar  4 04:05:24 2020 +0000
URL:        https://gitweb.gentoo.org/proj/security.git/commit/?id=dda658f8

cvetool: add 'getcveidlist' action

'getcveidlist' action will allow you to get list of internal CVE ids
required for API request.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 bin/cvetool | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/bin/cvetool b/bin/cvetool
index 28b8901..05d0b6e 100755
--- a/bin/cvetool
+++ b/bin/cvetool
@@ -47,6 +47,13 @@ class CVETool:
                 sys.exit(1)
 
             self.assign(args[0], [self.cleanup_cve(cve) for cve in args[1:]])
+        elif command =='getcveidlist':
+            if len(args) < 1:
+                print('Usage: getcveidlist <CVE> [<CVE>...]')
+                print('Returns a list of the real CVE IDs')
+                sys.exit(1)
+
+            self.getcveidlist([self.cleanup_cve(cve) for cve in args[0:]])
         elif command == 'new':
             if len(args) != 1:
                 print('Usage: new <CVE>')
@@ -90,6 +97,11 @@ class CVETool:
         print('     State: ' + data['state'])
         print('      Bugs: ' + ' , '.join(['https://bugs.gentoo.org/' + 
str(bug) for bug in data['bugs']]))
 
+    def getcveidlist(self, cves):
+        cve_ids = [self.get_internal_cve_id(cve) for cve in cves]
+        print('CVE IDs: cves=' + ','.join([str(c) for c in cve_ids]))
+
+
     def assign(self, bug, cves):
         cve_ids = [self.get_internal_cve_id(cve) for cve in cves]
         response = self.request('/cve/assign/?bug=' + str(bug) + '&cves=' + 
','.join([str(c) for c in cve_ids]))

Reply via email to