I use a script that generates stats for clamav. It generates both txt and html output. The problem is that the line length in the txt and html output differ. For instance in the txt output it shows this: (the numbers differ because the files were generated at different times)
Email.ScamS.Gen005.Sa 6 9.09%
While in the html file its shows this:
Email.ScamS.Gen005.Sanesecurity.06041100 7 9.46%
I 'think' this is where this comes from, but knowing very, very little about
perl I may be wrong.
### VIRUS COUNTS
$TXT .= keys ( %{$stats{virus}} ) . " Virus Types Detected\n" if $text;
$TXT .= "------------------------------------------\n" if $text;
if ($html) {
print "<table border=0><tr><Th COLSPAN=4 bgcolor=\#666699><font
color=\#FFFFFF size=4>" . keys ( %{$stats{virus}} ) . " Virus Types
Detected</font></th><TH align=center>";
}
foreach my $rec ( sort {$stats{virus}{$b}<=>$stats{virus}{$a}} keys
%{$stats{virus}} ) {
my $percent = sprintf ("%.2f", (($stats{virus}->{$rec} /
$stats{count}) *
100));
1 while $stats{virus}->{$rec} =~ s/(.*\d)(\d\d\d)/$1,$2/;
$TXT .= swrite("@<<<<<<<<<<<<<<<<<<<< @>>>>>>>>> @>>>>>",$rec,
$stats{virus}->{$rec}, $percent)."%\n" if $text;
if ($html) {
print "<tr><td align=left bgcolor=\#9999FF>";
print "$rec</td>";
print "<td align=right bgcolor=\#DCDCEE>";
print $stats{virus}->{$rec} . "</td><td></td><td
ALIGN=RIGHT
bgcolor=\#CCCCFF>$percent". "%";
print "</td></tr>\n";
}
}
print "</TABLE></td>" if $html;
If the whole script is needed let me know and I'll upload it somewhere.
Thanks for any advice
--
Chris
Registered Linux User 283774 http://counter.li.org
19:51:46 up 25 days, 7:52, 1 user, load average: 0.18, 0.50, 0.45
Mandriva Linux 10.1 Official, kernel 2.6.8.1-12mdk
pgpxOzIqQgzs5.pgp
Description: PGP signature
