-
Notifications
You must be signed in to change notification settings - Fork 10
/
c-vuln-over-time.pl
73 lines (67 loc) · 1.88 KB
/
c-vuln-over-time.pl
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/perl
my $webroot = $ARGV[0] || "../curl-www";
require "$webroot/docs/vuln.pm";
require "./stats/tag2date.pm";
my $num = $#vuln + 1;
my $ciss;
my $count;
for(reverse @vuln) {
my ($id, $start, $stop, $desc, $cve, $date, $project, $cwe, $award, $area, $cissue,
$part, $sev, $issue)=split('\|');
if(!$cissue) {
print "$cve!\n";
exit;
}
my $d = $start;
$d =~ s/\./_/g;
$date = tag2date("curl-$d");
if(!$date) {
print STDERR "Tag $d has no date!\n";
$date = "2000-01-01";
}
# there can be several on the same date
$numissues{$date}++;
$numcissues{$date}++ if($cissue ne "-");
$highcissues{$date}++ if(($cissue ne "-") &&
(($sev eq "high") || ($sev eq "critical")));
$highncissues{$date}++ if(($cissue eq "-") &&
(($sev eq "high") || ($sev eq "critical")));
$overtime{$date}++;
}
for my $d (keys %rolling) {
$seconds{$d} = `date +%s -d "$d"`;
}
my $all;
my $cmistakes;
my $oc;
my $onc;
for my $d (sort keys %overtime) {
if($d =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) {
$all += $numissues{$d};
$cmistakes += $numcissues{$d};
$hmistakes += $highcissues{$d};
$hncmistakes += $highncissues{$d};
my $nonc = $all - $cmistakes;
my $showc = $cmistakes;
my $shownc = $nonc;
my $showhc = $hmistakes;
my $showhnc = $hncmistakes;
if($cmistakes == $oc) {
$showc = "";
}
if($nonc == $onc) {
$shownc = "";
}
if($hmistakes == $ohc) {
$showhc = "";
}
if($hncmistakes == $onhc) {
$showhnc = "";
}
printf "$1-$2-$3;%u;%s;%s;%s;%s\n", $all, $showc, $shownc, $showhc, $showhnc;
$oc = $cmistakes;
$onc = $nonc;
$ohc = $hmistakes;
$onhc = $hncmistakes;
}
}