1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/env python
import os, re, sys
releases = ['2.6.15-dapper-security', '2.6.22-gutsy-security', '2.6.24-hardy-security', '2.6.27-intrepid-security']
table = dict()
cves = [elem for elem in os.listdir('.') if re.match('^CVE-\d+-\d+$',elem)]
for cve in cves:
table.setdefault(cve, dict())
text = file(cve).read()
for rel in releases:
table[cve].setdefault(rel,"-unlisted-")
status = re.search('^%s:[ \t]*([^ \n]*)' % rel, text, re.MULTILINE)
if status:
state = status.group(1)
if state == '':
state = 'needs triage'
if state == 'ignore':
state = 'ignored'
table[cve][rel] = state
format = '%15s'
print ' ',
for rel in releases:
print format % rel.split('-')[1],
print
for cve in sorted(cves):
needed = 0
released = 0
action_required = 0
for rel in releases:
if not table[cve][rel] in ('N/A', 'ignored', '-unlisted-', 'needs triage', 'needed', 'deferred', 'pending', 'released'):
print 'Unknown state: %s' % (table[cve][rel])
sys.exit(1)
if table[cve][rel] in ('needed','deferred'):
needed = 1
if table[cve][rel] in ('released'):
released = 1
if table[cve][rel] in ('needed','pending','deferred','needs triage'):
action_required = 1
if action_required:
print '%s: ' % cve,
for rel in releases:
print format % table[cve][rel],
if needed and released:
print ' [out of sync]',
print
|