-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perl script to generate Table 4 (cves-detected-by-sca-tools-in-tpovs.…
…tex) from output.csv (which is produced by run-summary.sh)
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/perl | ||
|
||
print <<'THE_END'; | ||
\begin{table}[H] | ||
\footnotesize | ||
\begin{tabular}{|lllllll|} | ||
\hline | ||
cve & grype & owasp & snyk & steady & any & all \\ \hline | ||
THE_END | ||
|
||
my @sums = (0, 0, 0, 0, 0, 0); | ||
while (<>) { | ||
next if $. == 1; | ||
chomp; | ||
my ($cve, $lib, @tools) = split /\t/; # We don't actually use $lib | ||
my ($steady, $snyk, $owasp, $grype) = @tools; | ||
@tools = ($grype, $owasp, $snyk, $steady); # Reorder @tools | ||
my $any = grep { $_ } @tools ? 1 : 0; | ||
my $all = !(grep { $_ == 0 } @tools) ? 1 : 0; | ||
push @tools, $any, $all; | ||
#print "\t\t", join(" & ", map { $_ == 1 ? '$\checkmark $' : '$\times $' } $cve, $grype, $owasp, $snyk, $steady, $any, $all), " \\\\\n"; | ||
print "\t\t", join(" & ", $cve, map { $_ == 1 ? '$\checkmark $' : '$\times $' } @tools), " \\\\\n"; | ||
for (my $i = 0; $i < @tools; ++$i) { | ||
$sums[$i] += $tools[$i]; | ||
} | ||
} | ||
|
||
print "\t\t\\hline\n"; | ||
print "\t\t", join(" & ", "sum", @sums), " \\\\ \\hline\n"; | ||
|
||
print <<'THE_END'; | ||
\end{tabular} | ||
\caption{CVEs detected by various SCA tools in the original artifact associated with the CVE (as of \scatimestamp)} | ||
\label{tab:sca:originals} | ||
\end{table} | ||
THE_END |