1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_showbogons.php
|
5
|
Copyright (C) 2009 Scott Ullrich
|
6
|
All rights reserved.
|
7
|
|
8
|
Redistribution and use in source and binary forms, with or without
|
9
|
modification, are permitted provided that the following conditions are met:
|
10
|
|
11
|
1. Redistributions of source code must retain the above copyright notice,
|
12
|
this list of conditions and the following disclaimer.
|
13
|
|
14
|
2. Redistributions in binary form must reproduce the above copyright
|
15
|
notice, this list of conditions and the following disclaimer in the
|
16
|
documentation and/or other materials provided with the distribution.
|
17
|
|
18
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
POSSIBILITY OF SUCH DAMAGE.
|
28
|
*/
|
29
|
|
30
|
/*
|
31
|
pfSense_BUILDER_BINARIES: /bin/ps /usr/bin/grep
|
32
|
pfSense_MODULE: filter
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-diag-showbogons
|
37
|
##|*NAME=Diagnostics: System Activity
|
38
|
##|*DESCR=Allows access to the 'Diagnostics: Show Bogons' page
|
39
|
##|*MATCH=diag_showbogons.php
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
|
44
|
if($_POST['Download']) {
|
45
|
mwexec_bg("/etc/rc.update_bogons.sh now");
|
46
|
$maxtimetowait = 0;
|
47
|
$loading = true;
|
48
|
while($loading == true) {
|
49
|
$isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`;
|
50
|
if($isrunning == "")
|
51
|
$loading = false;
|
52
|
$maxtimetowait++;
|
53
|
if($maxtimetowait > 89)
|
54
|
$loading = false;
|
55
|
sleep(1);
|
56
|
}
|
57
|
if($maxtimetowait < 90)
|
58
|
$savemsg = "The bogons database has been updated.";
|
59
|
}
|
60
|
|
61
|
$bogons = file_get_contents(trim("/etc/bogons"));
|
62
|
$pgtitle = "Diagnostics: Show Bogons";
|
63
|
|
64
|
include("head.inc");
|
65
|
?>
|
66
|
<body link="#000000" vlink="#000000" alink="#000000">
|
67
|
|
68
|
<?php
|
69
|
|
70
|
include("fbegin.inc");
|
71
|
|
72
|
?>
|
73
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
74
|
<style type="text/css">
|
75
|
pre { font-size: 1.15em; }
|
76
|
</style>
|
77
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
78
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
79
|
<form method="post" action="diag_showbogons.php">
|
80
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
81
|
<tr>
|
82
|
<td>
|
83
|
<table id="backuptable" class="tabcont" align="left" width="100%" border="0" cellpadding="6" cellspacing="0">
|
84
|
<tr>
|
85
|
<td>
|
86
|
<table>
|
87
|
<tr>
|
88
|
<td>
|
89
|
<b>Currently loaded bogons table:</b><p/>
|
90
|
<pre>
|
91
|
|
92
|
<?php echo $bogons; ?>
|
93
|
</pre>
|
94
|
</td>
|
95
|
</tr>
|
96
|
</table>
|
97
|
</td>
|
98
|
</tr>
|
99
|
</table>
|
100
|
</div>
|
101
|
</td>
|
102
|
</tr>
|
103
|
</table>
|
104
|
<p/>
|
105
|
<input type="submit" name="Download" value="Download"> latest bogon data.
|
106
|
</form>
|
107
|
<?php include("fend.inc"); ?>
|
108
|
</body>
|
109
|
</html>
|