summaryrefslogtreecommitdiffstats
path: root/bin/compare-nvd-cve
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@debian.org>2011-02-02 20:50:57 +0000
committerPetter Reinholdtsen <pere@debian.org>2011-02-02 20:50:57 +0000
commit4c22e3906096bc1029dfdc7875abdfb0c259dc22 (patch)
treec3df35b5f8578bc8bfef4b027a847378b35505cf /bin/compare-nvd-cve
parent245919f9ef3fc2363660baf5040dc7ba78bc9be9 (diff)
Implement support for comments in CPE files. Sort CVE list in reverse order.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@16040 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/compare-nvd-cve')
-rwxr-xr-xbin/compare-nvd-cve12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/compare-nvd-cve b/bin/compare-nvd-cve
index 5a27ccccdb..cfbc3b5048 100755
--- a/bin/compare-nvd-cve
+++ b/bin/compare-nvd-cve
@@ -18,6 +18,7 @@ open (my $fh, "<", "data/CPE/aliases") || die;
my $lastcpe = "";
while (<$fh>) {
chomp;
+ s/#.*$//; # Remove comments
unless ($_) {
$lastcpe = "";
next;
@@ -43,6 +44,7 @@ sub cpe_expand_alias {
open($fh, "<", "data/CPE/list") || die;
while (<$fh>) {
chomp;
+ s/#.*$//; # Remove comments
my ($binpkg, $cpe) = split(/;/);
$cpe = cpe_expand_alias($cpe);
# $cpe = "unknown-$binpkg" unless $cpe;
@@ -59,7 +61,9 @@ while (<$fh>) {
chomp;
$cve = $1 if (m/^(CVE-\S+)\s*/);
s/^(\s+)\[\S+\] /$1/; # Trim away distribution name
- if (m/^\s+- (\S+)\S*/ && ! m/<not-affected>/) {
+ if ( m/^\s+- (\S+)\S*/
+ && ! m/<not-affected>/
+ ) {
my $srcpkg = $1;
if (exists $cvemap{$cve}) {
push(@{$cvemap{$cve}}, $srcpkg);
@@ -79,10 +83,14 @@ for my $cvelist
# "nvdcve-2.0-2010.xml",
# "nvdcve-2.0-2009.xml",
# "nvdcve-2.0-2008.xml",
+# "nvdcve-2.0-2007.xml",
+# "nvdcve-2.0-2006.xml",
+# "nvdcve-2.0-2005.xml",
+# "nvdcve-2.0-2004.xml",
) {
print "Loading $cvelist\n" if $debug;
my $ref = XMLin("../../" . $cvelist);
- for my $cve (sort keys %{$ref->{entry}}) {
+ for my $cve (sort {$b cmp $a} keys %{$ref->{entry}}) {
print "Checking $cve\n" if $debug;
my $entry = $ref->{entry}->{$cve};

© 2014-2024 Faster IT GmbH | imprint | privacy policy