1 |
dpavlin |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
include("bgcolor.inc"); |
4 |
|
|
|
5 |
|
|
$logdir="/etc/iscan/"; |
6 |
|
|
$max_lpt_ver=0; // version of pattern file |
7 |
|
|
|
8 |
|
|
if (!isset($yyyy)) { $yyyy=date("Y"); } |
9 |
|
|
if (!isset($mm)) { $mm=date("m"); } |
10 |
|
|
if (!isset($dd)) { $dd=date("d"); } |
11 |
|
|
|
12 |
|
|
print "<html><head> |
13 |
|
|
<title>viruswall logovi</title> |
14 |
|
|
<head> |
15 |
|
|
<body bgcolor=white>"; |
16 |
|
|
|
17 |
|
|
$virusa=0; |
18 |
|
|
$dana=0; |
19 |
|
|
|
20 |
|
|
print '<table border=0> |
21 |
|
|
<tr><th>datum</th><th><i>po¹iljatelj poruke</i>,<br>primaoc(i) poruke</th><th>datoteka, akcija,<br>opis virusa</th></tr> |
22 |
|
|
<form> |
23 |
|
|
Show only data for |
24 |
|
|
<select name=yyyy><option value="">all</option>'; |
25 |
|
|
|
26 |
|
|
for ($i=2000; $i<=2001; $i++) { |
27 |
|
|
printf("<option value=\"%02d\"",$i); |
28 |
|
|
if ($i==$yyyy) { print " selected"; } |
29 |
|
|
print ">$i</option>"; |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
print '</select> - <select name=mm><option value="">all</option>'; |
33 |
|
|
|
34 |
|
|
for ($i=1; $i<=12; $i++) { |
35 |
|
|
printf("<option value=\"%02d\"",$i); |
36 |
|
|
if ($i==$mm) { print " selected"; } |
37 |
|
|
printf(">%02d</option>",$i); |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
print '</select> - <select name=dd><option value="">all</option>'; |
41 |
|
|
|
42 |
|
|
for ($i=1; $i<=31; $i++) { |
43 |
|
|
printf("<option value=\"%02d\"",$i); |
44 |
|
|
if ($i==$dd) { print " selected"; } |
45 |
|
|
printf(">%02d</option>",$i); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
print '<option value="">all</option></select><input type=submit value="Filter"></form>'; |
49 |
|
|
|
50 |
|
|
$handle=opendir($logdir); |
51 |
|
|
while ($file = readdir($handle)) { |
52 |
|
|
$patt="virus.log"; |
53 |
|
|
if (isset($yyyy) && $yyyy!="") { $patt.=".$yyyy"; } |
54 |
|
|
if (isset($mm) && $mm!="") { $patt.=".$mm"; } |
55 |
|
|
if (isset($dd) && $dd!="") { $patt.=".$dd"; } |
56 |
|
|
$lptpatt="lpt\$vpn."; |
57 |
|
|
if (substr($file,0,strlen($patt)) == $patt) { |
58 |
|
|
$dana++; |
59 |
|
|
$fd=fopen("$logdir/$file","r"); |
60 |
|
|
while ($line = fgets($fd,4096)) { |
61 |
|
|
if (substr($line,0,5) == "-----") { |
62 |
|
|
print "<tr".bgcolor()."><td>$Date</td><td><i>$From</i> -><br>$To</td>"; |
63 |
|
|
if (strstr($Action,"moved")) { |
64 |
|
|
print "<td bgcolor=#ffff88>"; |
65 |
|
|
} elseif (strstr($Action,"cleaned")) { |
66 |
|
|
print "<td bgcolor=#88ff88>"; |
67 |
|
|
} elseif (strstr($Action,"delete")) { |
68 |
|
|
print "<td bgcolor=#ff8888>"; |
69 |
|
|
} else { |
70 |
|
|
print "<td>"; |
71 |
|
|
} |
72 |
|
|
print "<tt>$File</tt><br><small>$Action</small><br><a href=\"http://www.antivirus.com/vinfo/virusencyclo/default5.asp?VName=$Virus&VSect=T\">$Virus</a></td></tr>\n"; |
73 |
|
|
$virusa++; |
74 |
|
|
if (strstr($From,"pliva.hr")) { |
75 |
|
|
$from_in_pliva++; |
76 |
|
|
} else { |
77 |
|
|
$from_out_pliva++; |
78 |
|
|
} |
79 |
|
|
if (strstr($To,"pliva.hr")) { |
80 |
|
|
$to_in_pliva++; |
81 |
|
|
} else { |
82 |
|
|
$to_out_pliva++; |
83 |
|
|
} |
84 |
|
|
} |
85 |
|
|
$arr = split(":",$line,2); |
86 |
|
|
$GLOBALS[trim($arr[0])]=trim($arr[1]); |
87 |
|
|
} |
88 |
|
|
fclose($fd); |
89 |
|
|
} elseif (substr($file,0,strlen($lptpatt)) == $lptpatt) { |
90 |
|
|
$tmp=explode(".",$file); |
91 |
|
|
if ($tmp[1] > $max_lpt_ver) { |
92 |
|
|
$max_lpt_ver=$tmp[1]; |
93 |
|
|
$tmp=stat("$logdir/$file"); |
94 |
|
|
$lpt_date=date("Y-m-d G:i",$tmp[9]); |
95 |
|
|
} |
96 |
|
|
} |
97 |
|
|
} |
98 |
|
|
closedir($handle); |
99 |
|
|
|
100 |
|
|
if ($dana==0) { |
101 |
|
|
$p = 0; |
102 |
|
|
} else { |
103 |
|
|
$p = $virusa/$dana; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
print "</table> |
107 |
|
|
<p>Statistika<br> |
108 |
|
|
Ukupno naðeno virusa: <b>$virusa</b> u $dana dana, prosjeèno ".sprintf("%.2f",$p)." virusa po danu. |
109 |
|
|
<br>$from_in_pliva virusa je poslano iz Plive, a $from_out_pliva sa interneta. |
110 |
|
|
<br>$to_in_pliva virusa je poslano u Plivu, a $to_out_pliva na druge adrese |
111 |
|
|
na internetu. |
112 |
|
|
<p>Virus pattern version: <b>$max_lpt_ver</b> (datum: $lpt_date) |
113 |
|
|
</body> |
114 |
|
|
</html> |
115 |
|
|
"; |
116 |
|
|
|
117 |
|
|
?> |