aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2017-01-16 04:03:40 +0100
committerThomas Deutschmann <whissi@gentoo.org>2017-01-16 04:03:40 +0100
commite46475c945146cd2fe260e6efed68e11df744853 (patch)
tree12363124f51a8e8e19ab15c64320d9937b9185c8
parentcvetool: Detect missing CVE and catch exception when requesting CVE info (diff)
downloadsecurity-e46475c945146cd2fe260e6efed68e11df744853.tar.gz
security-e46475c945146cd2fe260e6efed68e11df744853.tar.bz2
security-e46475c945146cd2fe260e6efed68e11df744853.zip
cvetool: Catch invalid 'info' command usage
-rwxr-xr-xbin/cvetool11
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/cvetool b/bin/cvetool
index b8aa5ca..57884ca 100755
--- a/bin/cvetool
+++ b/bin/cvetool
@@ -22,7 +22,16 @@ class CVETool:
self.auth = auth
if command == 'info':
- self.info(self.cleanup_cve(sys.argv[2]))
+ if len(args) != 1:
+ print('Usage: info <CVE>')
+ print('Retrieves information about a CVE from database')
+ sys.exit(1)
+
+ try:
+ self.info(self.cleanup_cve(sys.argv[2]))
+ except ValueError:
+ print('"{}" is not a valid CVE identifier!'.format(sys.argv[2]))
+ sys.exit(1)
elif command == 'assign':
if len(args) < 2:
print('Usage: assign <bug> <CVE> [<CVE>...]')