summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Tropf <asym@gentoo.org>2009-11-14 13:19:00 +0100
committerBjoern Tropf <asym@gentoo.org>2009-11-14 13:19:00 +0100
commit9c20371276a8668ad07c4dfadc49b3f5c525d9fb (patch)
tree713bd39befcdc3693b09b53ae799f0a8960d07d4
parentFix small bug (diff)
downloadkernel-check-9c20371276a8668ad07c4dfadc49b3f5c525d9fb.tar.gz
kernel-check-9c20371276a8668ad07c4dfadc49b3f5c525d9fb.tar.bz2
kernel-check-9c20371276a8668ad07c4dfadc49b3f5c525d9fb.zip
Fix various bugs
-rwxr-xr-xkernel-check.py31
-rwxr-xr-xtools/cron.py8
2 files changed, 20 insertions, 19 deletions
diff --git a/kernel-check.py b/kernel-check.py
index 5241ca3..1587b98 100755
--- a/kernel-check.py
+++ b/kernel-check.py
@@ -160,28 +160,25 @@ def print_summary(vullist):
'Prints the vulnerability summary'
for item in vullist:
- print ''
whiteboard = str()
for interval in item.affected:
whiteboard += '[' + str(interval) + '] '
- if len(item.cves) is 0:
- #TODO Explicit cve score instead of 0.0
- print '\nBugid %s %-32s %s %s\n"%s..."' % (item.bugid,
- color('GOOD', 'Low' + ' (' + str(0.0) + ')'),
- lib.NOCVE, whiteboard, lib.NOCVEDESC[:term[1]-6])
-
- for cve in item.cves:
- severity = 'BAD'
- if cve.severity == 'Low':
- severity = 'GOOD'
- elif cve.severity == 'Medium':
- severity = 'WARN'
-
- print '\nBugid %s %-32s %s %s\n"%s..."' % (item.bugid,
- color(severity, cve.severity + ' (' + cve.score + ')'),
- cve.cve, whiteboard, cve.desc[:term[1]-6])
+ if item.cves:
+ print ''
+
+ for cve in item.cves:
+ severity = 'BAD'
+ if cve.severity == 'Low':
+ severity = 'GOOD'
+ elif cve.severity == 'Medium':
+ severity = 'WARN'
+
+ print '\nBugid %s %-32s %s %s\n"%s..."' % (item.bugid,
+ color(severity, cve.severity + ' (' + cve.score + ')'),
+ cve.cve, whiteboard, cve.desc[:term[1]-6])
+
print '\n'
diff --git a/tools/cron.py b/tools/cron.py
index ddf1792..f5d7f91 100755
--- a/tools/cron.py
+++ b/tools/cron.py
@@ -58,8 +58,8 @@ REGEX = {
'bugzilla' : re.compile(r'(?<=bug.cgi\?id=)\d*'),
'grp_all' : re.compile(r'(?<=\()[ (]*CVE-(\d{4})' \
r'([-,(){}|, \d]+)(?=\))'),
- 'm_nomatch' : re.compile(r'.*GENERIC-MAP-NOMATCH.*'),
'grp_split' : re.compile(r'(?<=\D)(\d{4})(?=\D|$)'),
+ 'm_nomatch' : re.compile(r'.*GENERIC-MAP-NOMATCH.*'),
'wb_match' : re.compile(r'\s*\[\s*([^ +<=>]+)\s*([' \
r'<=>]{1,2})\s*([^ <=>\]]+' \
r')\s*(?:([<=>]{1,2})\s*([' \
@@ -164,6 +164,7 @@ def receive_file(directory, url, xml_file):
except IOError:
logging.error('File %s - Download failed!' % filename)
+ return
logging.debug('File %s - %sKB received' %
(filename, os.path.getsize(filename)/1024))
@@ -232,7 +233,7 @@ def parse_bz_dict(directory, bugid):
try:
string = root.find('short_desc').text
except AttributeError:
- CronError('No Cve')
+ raise CronError('No Cve')
try:
cvelist = list()
@@ -245,6 +246,9 @@ def parse_bz_dict(directory, bugid):
for cve in REGEX['grp_split'].findall(split_cves):
cvelist.append('CVE-%s-%s' % (year, cve))
+ if not cvelist:
+ raise CronError('No Cve')
+
vul = {
'bugid' : bugid,
'cvelist' : cvelist,