From a3178f08b0dd1884f10d1b9166584d5e34ca01b6 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Wed, 7 Jun 2023 16:53:47 +0200 Subject: Remove bin/updatelist This script is superseeded by bin/update-xrefs and bin/process-cve-records. Fixes #24 --- bin/update | 22 -------- bin/updatelist | 164 --------------------------------------------------------- 2 files changed, 186 deletions(-) delete mode 100755 bin/update delete mode 100755 bin/updatelist (limited to 'bin') diff --git a/bin/update b/bin/update deleted file mode 100755 index b47da851ac..0000000000 --- a/bin/update +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -SCRIPT=$(readlink -f "$0") -BASEDIR=$(dirname "$SCRIPT") - -if [ ! -d CVE ]; then - echo "run in data subdirectory" >&2 - exit 1 -fi - -cd CVE -rm -f allitems.html -# wget disabled since fetching allitems.html.gz via wget fails since 2015-04-09 from -# cve.mitre.org, add workaround with curl until solved -# wget --quiet https://cve.mitre.org/data/downloads/allitems.html.gz -# Note: ~/.curlrc on soriano contains: -# capath=/etc/ssl/ca-global -curl -s -o allitems.html.gz https://cve.mitre.org/data/downloads/allitems.html.gz -gunzip allitems.html.gz -$BASEDIR/updatelist allitems.html ../DSA/list ../DTSA/list ../DLA/list list > list.new -mv -f list.new list diff --git a/bin/updatelist b/bin/updatelist deleted file mode 100755 index 305d547829..0000000000 --- a/bin/updatelist +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/perl -my $html=shift; -my $dsa_list=shift; -my $dtsa_list=shift; -my $dla_list=shift; -my $our_list=shift; - -my %cves; - -sub read_dsa { - my $list=shift; - - open (DSA, "<$list") || die "$list: $!\n"; - my $dsa; - while () { - if (/^\[/) { - ($dsa)=m/(DT?SA-.*?|DLA-.*?) /; - } - if (/\{\s*(CVE)/) { - my ($cvelist)=m/\{(.*)\}/; - foreach my $cve (split ' ', $cvelist) { - next unless $cve=~/^CVE-\d+/; - $cves{$cve}{cve}=$cve; - push @{$cves{$cve}{xref}}, $dsa; - } - } - } - close DSA; -} -read_dsa($dsa_list); -read_dsa($dtsa_list); -read_dsa($dla_list); - -my %listedcves; - -open (HTML, "<$html") || die "$html: $!\n"; -my $cve; -while () { - if (m!Name:\s+(CVE-\d+-\d+)!) { - $cve=$1; - $cves{$cve}{cve}=$cve; - $listedcves{$cve}=1; - } - if (m!\*\*\s+RESERVED\s+\*\*!) { - $cves{$cve}{reserved}=1; - - } - if (m!\*\*\s+REJECT\s+\*\*!) { - $cves{$cve}{rejected}=1; - } - if (m!Description:\s*

\s*(.*)

! && - ! m!\*\*\s+RESERVED\s+\*\*! && ! m!\*\*\s+REJECT\s+\*\*!) { - my $desc; - $desc=$1; - if (! length $desc) { - $desc=; - chomp $desc; - } - # truncate length of description text added to lists - $desc = substr( $desc, 0, 70 ); - $cves{$cve}{description}="($desc ...)"; - } -} -close HTML; - -my $stopped=0; -my @out; - -sub docve { - my $cve=shift; - - push @out, "$cve".(length $cves{$cve}{description} ? " ".$cves{$cve}{description} : "")."\n"; - if ($cves{$cve}{reserved}) { - push @out, "\tRESERVED\n"; - } - if ($cves{$cve}{rejected}) { - push @out, "\tREJECTED\n"; - } - if (scalar @{$cves{$cve}{xref}} > 0) { - push @out, "\t{".join(" ", @{$cves{$cve}{xref}})."}\n"; - } - if ($cves{$cve}{notes}) { - foreach (@{$cves{$cve}{notes}}) { - if (length(@{$cves{$cve}{notes}}) == 1 && - $cves{$cve}{rejected} && m/(?:TODO: check$|to be rejected)/) { - next; - } - push @out, "\t$_\n"; - } - } - if (! $cves{$cve}{reserved} && ! $cves{$cve}{rejected} && - ! $cves{$cve}{notes} && - ! $stopped) { - if ($cve =~ /^CVE-199|^CVE-200[012]/) { - push @out, "\tNOT-FOR-US: Data pre-dating the Security Tracker\n"; - } - else { - push @out, "\tTODO: check\n"; - } - } - - delete $cves{$cve}; -} - -open (IN, "<$our_list") || die "$our_list: $!\n"; -my $cve; -while () { - chomp; - if (/^(CVE-(?:[0-9]+|[A-Z]+)-(?:[0-9]+|[A-Z]+))\s*(.*)/) { - my $desc=$2; - docve($cve) if $cve; - $cve=$1; - if (length $desc && $desc !~ /^\(.*\)$/ && - (! exists $cves{$cve}{description} || - ! length $cves{$cve}{description})) { - $cves{$cve}{description}=$desc; - } - } - elsif (/^\s+(RESERVED|REJECTED)\s*$/) { - # skip it - } - elsif (/^\s+NOTE: covered by DT?SA.*/) { - # skip it (old form) - } - elsif (/^\s+{\s*(.+?)\s*}/) { - my @xrefs=split('\s+', $1); - push @{$cves{$cve}{xref}}, grep(!/^(?:DT?SA|DLA)/, @xrefs); - } - elsif (/^\s+(.*)/ && $cve) { - push @{$cves{$cve}{notes}}, $1; - } - elsif (/^STOP/) { - docve($cve) if $cve; - push @out, "$_\n"; - $stopped=1; - $cve=''; - } - else { - docve($cve) if $cve; - push @out, "$_\n" if length $_; - $cve=''; - } -} -close IN; -docve($cve) if $cve; - -foreach my $cve (reverse sort { $cves{$a}{cve} cmp $cves{$b}{cve} } keys %cves) { - next unless $listedcves{$cve}; - print $cve.(length $cves{$cve}{description} ? " ".$cves{$cve}{description} : "")."\n"; - if ($cves{$cve}{reserved}) { - print "\tRESERVED\n"; - } - if ($cves{$cve}{rejected}) { - print "\tREJECTED\n"; - } - if (scalar @{$cves{$cve}{xref}} > 0) { - print "\t{".join(" ", @{$cves{$cve}{xref}})."}\n"; - } - if (!$cves{$cve}{reserved} || $cves{$cve}{rejected} ) { - print "\tTODO: check\n"; - } -} - -print @out; -- cgit v1.2.3