From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from <gentoo-commits+bounces-395541-garchives=archives.gentoo.org@lists.gentoo.org>) id 1RIjzH-0000Q1-6S for garchives@archives.gentoo.org; Tue, 25 Oct 2011 16:36:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 51FCAE07F2; Tue, 25 Oct 2011 16:36:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1ADA0E07F2 for <gentoo-commits@lists.gentoo.org>; Tue, 25 Oct 2011 16:36:17 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9270A1B4023 for <gentoo-commits@lists.gentoo.org>; Tue, 25 Oct 2011 16:36:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0750480042 for <gentoo-commits@lists.gentoo.org>; Tue, 25 Oct 2011 16:36:16 +0000 (UTC) From: "Paweł Hajdan" <phajdan.jr@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" <phajdan.jr@gentoo.org> Message-ID: <149fe3801a3bb99caf635cfe26b31522171349d1.phajdan.jr@gentoo> Subject: [gentoo-commits] proj/chromium-tools:master commit in: / X-VCS-Repository: proj/chromium-tools X-VCS-Files: extract-cves.py X-VCS-Directories: / X-VCS-Committer: phajdan.jr X-VCS-Committer-Name: Paweł Hajdan X-VCS-Revision: 149fe3801a3bb99caf635cfe26b31522171349d1 Date: Tue, 25 Oct 2011 16:36:16 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 3013e45e24e69d1a1e7c760b7fd93bfe commit: 149fe3801a3bb99caf635cfe26b31522171349d1 Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org> AuthorDate: Tue Oct 25 16:35:21 2011 +0000 Commit: Pawe=C5=82 Hajdan <phajdan.jr <AT> gentoo <DOT> org> CommitDate: Tue Oct 25 16:35:55 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/chromium-tool= s.git;a=3Dcommit;h=3D149fe380 Add tool to extract CVE numbers from a webpage. Useful for filing the security bug based on release notes. --- extract-cves.py | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/extract-cves.py b/extract-cves.py new file mode 100755 index 0000000..8769511 --- /dev/null +++ b/extract-cves.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import re +import sys +import urllib2 + + +CVE_PATTERN =3D re.compile('CVE-(\d{4})-(\d+)') + + +def main(argv): + response =3D urllib2.urlopen(argv[0]) + cves =3D CVE_PATTERN.findall(response.read()) + years =3D {} + for year, no in cves: + if year not in years: + years[year] =3D [] + years[year].append(no) + result =3D [] + for year in sorted(years.keys()): + nos =3D years[year] + if len(nos) =3D=3D 1: + result.append('CVE-%s-%s' % (year, nos[0])) + else: + result.append('CVE-%s-{%s}' % (year, ','.join(sorted(nos)))) + print ' '.join(result) + return 0 + + +if __name__ =3D=3D '__main__': + sys.exit(main(sys.argv[1:]))