-
Notifications
You must be signed in to change notification settings - Fork 9
/
c-vuln-reports.pl
48 lines (41 loc) · 1.08 KB
/
c-vuln-reports.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
#!/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)=split('\|');
if(!$cissue) {
print "$cve!\n";
exit;
}
# there can be several on the same date
$numissues{$date}++;
$numcissues{$date}++ if($cissue ne "-");
$overtime{$date}++;
}
for my $d (keys %rolling) {
$seconds{$d} = `date +%s -d "$d"`;
}
print "1998-03-20;0;0;0\n";
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};
my $nonc = $all - $cmistakes;
my $showc;
my $shownc;
$showc = $cmistakes if($cmistakes != $oc);
$shownc = $nonc if($nonc != $onc);
printf "$1-$2-$3;%u;%s;%s;%.2f\n", $all, $showc, $shownc,
$cmistakes * 100/ $all;
$oc = $cmistakes;
$onc = $nonc;
}
}