1 |
a7fcf251
|
Scott Ullrich
|
<?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 |
13d193c2
|
Scott Ullrich
|
/*
|
31 |
|
|
pfSense_BUILDER_BINARIES: /bin/ps /usr/bin/grep
|
32 |
|
|
pfSense_MODULE: filter
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
a7fcf251
|
Scott Ullrich
|
##|+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 |
c54c2d23
|
Scott Ullrich
|
if($_POST['Download']) {
|
45 |
9dbb93ba
|
Chris Buechler
|
mwexec_bg("/etc/rc.update_bogons.sh now");
|
46 |
08b596d9
|
Scott Ullrich
|
$maxtimetowait = 0;
|
47 |
|
|
$loading = true;
|
48 |
|
|
while($loading == true) {
|
49 |
13d193c2
|
Scott Ullrich
|
$isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`;
|
50 |
08b596d9
|
Scott Ullrich
|
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 |
e97076a5
|
Scott Ullrich
|
}
|
60 |
a7fcf251
|
Scott Ullrich
|
|
61 |
13d193c2
|
Scott Ullrich
|
$bogons = file_get_contents(trim("/etc/bogons"));
|
62 |
a7fcf251
|
Scott Ullrich
|
$pgtitle = "Diagnostics: Show Bogons";
|
63 |
|
|
|
64 |
|
|
include("head.inc");
|
65 |
11b77414
|
Scott Ullrich
|
?>
|
66 |
|
|
<body link="#000000" vlink="#000000" alink="#000000">
|
67 |
|
|
|
68 |
|
|
<?php
|
69 |
|
|
|
70 |
e97076a5
|
Scott Ullrich
|
include("fbegin.inc");
|
71 |
a7fcf251
|
Scott Ullrich
|
|
72 |
|
|
?>
|
73 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
74 |
|
|
<style type="text/css">
|
75 |
|
|
pre { font-size: 1.15em; }
|
76 |
|
|
</style>
|
77 |
0c348a2b
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
78 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
79 |
e97076a5
|
Scott Ullrich
|
<form method="post" action="diag_showbogons.php">
|
80 |
a7fcf251
|
Scott Ullrich
|
<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 |
ee216fee
|
sullrich
|
<font size="+1">
|
90 |
|
|
<b>Currently loaded bogons table:</b><p/>
|
91 |
|
|
<pre>
|
92 |
a7fcf251
|
Scott Ullrich
|
<?php echo $bogons; ?>
|
93 |
ee216fee
|
sullrich
|
</pre>
|
94 |
|
|
</font>
|
95 |
a7fcf251
|
Scott Ullrich
|
</td>
|
96 |
|
|
</tr>
|
97 |
|
|
</table>
|
98 |
|
|
</td>
|
99 |
|
|
</tr>
|
100 |
|
|
</table>
|
101 |
|
|
</div>
|
102 |
|
|
</td>
|
103 |
|
|
</tr>
|
104 |
|
|
</table>
|
105 |
c54c2d23
|
Scott Ullrich
|
<p/>
|
106 |
|
|
<input type="submit" name="Download" value="Download"> latest bogon data.
|
107 |
a7fcf251
|
Scott Ullrich
|
</form>
|
108 |
|
|
<?php include("fend.inc"); ?>
|
109 |
|
|
</body>
|
110 |
|
|
</html>
|