diff options
author | 2017-01-16 04:03:40 +0100 | |
---|---|---|
committer | 2017-01-16 04:03:40 +0100 | |
commit | e46475c945146cd2fe260e6efed68e11df744853 (patch) | |
tree | 12363124f51a8e8e19ab15c64320d9937b9185c8 | |
parent | cvetool: Detect missing CVE and catch exception when requesting CVE info (diff) | |
download | security-e46475c945146cd2fe260e6efed68e11df744853.tar.gz security-e46475c945146cd2fe260e6efed68e11df744853.tar.bz2 security-e46475c945146cd2fe260e6efed68e11df744853.zip |
cvetool: Catch invalid 'info' command usage
-rwxr-xr-x | bin/cvetool | 11 |
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>...]') |