[- use DBI; -]
[- use POSIX; -]
[- use Socket -]
[- $req = shift; -]
[# Lets look for UNIX Metacharacters in the query string from the browser #]
[$ if $ENV{'QUERY_STRING'} =~ /([;\*\/'\$!#\(\)\[\]\{\}:'"])/ $]
[- Execute ('error.html') -]
[- exit -]
[$ endif $]
[- $LanChoice = $fdat{LanChoice}; -]
[- chomp $LanChoice; -]
[- $HostChoice = $fdat{HostChoice} -]
[- chomp $HostChoice; -]
[- $Event = $fdat{Event} -]
[- chomp $Event; -]
[$ if $Event eq "Inbnd" $]
[- $TableName = "InBnd" -]
[$ elsif $Event eq "Outbnd" $]
[- $TableName = "OutBnd" -]
[$ endif $]
[- ($dsn) = "DBI:mysql:FireWatch"; -]
[- $dsn .= ";mysql_read_default_file=./roll-sql.cnf"; -]
[- $dbh = DBI->connect($dsn); -]
Top [+ $Event +] 10 Ports for [+ $HostChoice +] on [+ $LanChoice +] Lan
[- $temp_table = $hours.$min.$sec.$$.Temp -]
[- $sth = $dbh -> prepare ("create temporary table $temp_table select count(DST_Port) as Event_Count,
Ports.Service_Name,DST_Port,`${HostChoice}_${TableName}_Week$req->{weeknum}`.Protocol
from `${HostChoice}_${TableName}_Week$req->{weeknum}`,Ports
where `${HostChoice}_${TableName}_Week$req->{weeknum}`.DST_Port = Ports.Port_Num and
`${HostChoice}_${TableName}_Week$req->{weeknum}`.Protocol = Ports.Protocol
and Lan = '$LanChoice'
group by `${HostChoice}_${TableName}_Week$req->{weeknum}`.DST_Port"); -]
[- $sth -> execute; -]
[- $sth = $dbh -> prepare (" select * from $temp_table order by Event_Count desc limit 10"); -]
[- $sth -> execute; -]
Event Count |
Service Name |
DST. Port |
Protocol |
[$ while @row = $sth -> fetchrow_array $]
[+ @row[0] +] |
[+ @row[1] +] |
[+ @row[2] +] |
[+ @row[3] +] |
[$ endwhile $]
[- $dbh->disconnect -]