/[viruswall]/log.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /log.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Thu Jun 20 15:20:16 2002 UTC (17 years, 1 month ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +16 -0 lines
scan engine version number

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<=date("Y"); $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 $fp = fopen("/etc/iscan/libvsapi.so", "rb");
107 if ($fp) {
108 $bin = fread($fp, filesize("/etc/iscan/libvsapi.so"));
109 fclose($fp);
110 }
111
112 $pos = strpos($bin,"VSAPI");
113
114 if ($pos === false) {
115 $engine="unknown";
116 } else {
117 $engine=substr($bin,$pos+6,20);
118 $engine=substr($engine,0,strpos($engine,chr(0)));
119 }
120
121 print "</table>
122 <p>Statistika<br>
123 Ukupno naðeno virusa: <b>$virusa</b> u $dana dana, prosjeèno ".sprintf("%.2f",$p)." virusa po danu.
124 <br>$from_in_pliva virusa je poslano iz Plive, a $from_out_pliva sa interneta.
125 <br>$to_in_pliva virusa je poslano u Plivu, a $to_out_pliva na druge adrese
126 na internetu.
127 <p>Virus pattern version: <b>$max_lpt_ver</b> (datum: $lpt_date)
128 <br>Scan engine version: $engine
129 </body>
130 </html>
131 ";
132
133 ?>

  ViewVC Help
Powered by ViewVC 1.1.26