mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 03:33:25 +02:00
ids.cgi: Rework code which shows if oinkmaster is working
Move the code for displaying a notice that snort currently is working into an own subfunction which will be called if oinkmaster currently is started. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
@@ -67,6 +67,14 @@ my %snortrules;
|
|||||||
my $errormessage;
|
my $errormessage;
|
||||||
my $url;
|
my $url;
|
||||||
|
|
||||||
|
# Try to determine if oinkmaster is running.
|
||||||
|
my $oinkmaster_pid = `pidof oinkmaster.pl -x`;
|
||||||
|
|
||||||
|
# If oinkmaster is running display output.
|
||||||
|
if ($oinkmaster_pid) {
|
||||||
|
&working("$Lang::tr{'snort working'}");
|
||||||
|
}
|
||||||
|
|
||||||
## Grab all available snort rules and store them in the snortrules hash.
|
## Grab all available snort rules and store them in the snortrules hash.
|
||||||
#
|
#
|
||||||
# Open snort rules directory and do a directory listing.
|
# Open snort rules directory and do a directory listing.
|
||||||
@@ -386,37 +394,6 @@ if ($errormessage) {
|
|||||||
&Header::closebox();
|
&Header::closebox();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $return = `pidof oinkmaster.pl -x`;
|
|
||||||
chomp($return);
|
|
||||||
if ($return) {
|
|
||||||
&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" );
|
|
||||||
print <<END;
|
|
||||||
<table>
|
|
||||||
<tr><td>
|
|
||||||
<img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' />
|
|
||||||
<td>
|
|
||||||
$Lang::tr{'snort working'}
|
|
||||||
<tr><td colspan='2' align='center'>
|
|
||||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
|
||||||
<input type='image' alt='$Lang::tr{'reload'}' title='$Lang::tr{'reload'}' src='/images/view-refresh.png' />
|
|
||||||
</form>
|
|
||||||
<tr><td colspan='2' align='left'><pre>
|
|
||||||
END
|
|
||||||
my @output = `tail -20 /var/tmp/log`;
|
|
||||||
foreach (@output) {
|
|
||||||
print "$_";
|
|
||||||
}
|
|
||||||
print <<END;
|
|
||||||
</pre>
|
|
||||||
</table>
|
|
||||||
END
|
|
||||||
&Header::closebox();
|
|
||||||
&Header::closebigbox();
|
|
||||||
&Header::closepage();
|
|
||||||
exit;
|
|
||||||
refreshpage();
|
|
||||||
}
|
|
||||||
|
|
||||||
&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system'});
|
&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system'});
|
||||||
print <<END
|
print <<END
|
||||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'><table width='100%'>
|
<form method='post' action='$ENV{'SCRIPT_NAME'}'><table width='100%'>
|
||||||
@@ -590,14 +567,33 @@ print <<END
|
|||||||
END
|
END
|
||||||
;
|
;
|
||||||
&Header::closebox();
|
&Header::closebox();
|
||||||
|
|
||||||
&Header::closebigbox();
|
&Header::closebigbox();
|
||||||
&Header::closepage();
|
&Header::closepage();
|
||||||
|
|
||||||
sub refreshpage {
|
sub working ($) {
|
||||||
&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );
|
my $message = $_[0];
|
||||||
print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";
|
|
||||||
&Header::closebox();
|
&Header::openpage($Lang::tr{'intrusion detection system'}, 1, '');
|
||||||
|
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||||
|
&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1'>" );
|
||||||
|
print <<END;
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' /></td>
|
||||||
|
<td>$message</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan='2' align='center'>
|
||||||
|
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||||
|
<input type='image' alt='$Lang::tr{'reload'}' title='$Lang::tr{'reload'}' src='/images/view-refresh.png' />
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
END
|
||||||
|
&Header::closebox();
|
||||||
|
&Header::closebigbox();
|
||||||
|
&Header::closepage();
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub downloadrulesfile {
|
sub downloadrulesfile {
|
||||||
|
|||||||
Reference in New Issue
Block a user