diff options
author | 2016-09-15 12:10:49 -0400 | |
---|---|---|
committer | 2016-09-15 12:10:49 -0400 | |
commit | f1b0fc1adfd405ff9ebb5738959ce4966371f936 (patch) | |
tree | 45d36bfceb6949445cb14d699599dfd60c8eb6aa | |
parent | Add my script for bumping google-chrome (diff) | |
download | chromium-tools-f1b0fc1adfd405ff9ebb5738959ce4966371f936.tar.gz chromium-tools-f1b0fc1adfd405ff9ebb5738959ce4966371f936.tar.bz2 chromium-tools-f1b0fc1adfd405ff9ebb5738959ce4966371f936.zip |
extract-cves: simplify output
This allows for easy copy/paste into the bugzilla alias field.
-rwxr-xr-x | extract-cves.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/extract-cves.py b/extract-cves.py index 4ccfbf7..a1dc5ee 100755 --- a/extract-cves.py +++ b/extract-cves.py @@ -9,25 +9,13 @@ try: except ImportError: from urllib2 import urlopen -CVE_PATTERN = re.compile('CVE-(\d{4})-(\d+)') +CVE_PATTERN = re.compile('CVE-\d{4}-\d+') def main(argv): response = urlopen(argv[0]) - cves = CVE_PATTERN.findall(str(response.read())) - years = {} - for year, no in cves: - if year not in years: - years[year] = [] - years[year].append(no) - result = [] - for year in sorted(years.keys()): - nos = years[year] - if len(nos) == 1: - result.append('CVE-%s-%s' % (year, nos[0])) - else: - result.append('CVE-%s-{%s}' % (year, ','.join(sorted(nos)))) - print(' '.join(result)) + cves = set(CVE_PATTERN.findall(str(response.read()))) + print(','.join(cves)) return 0 |