1 |
c38fee60
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
status_upnp.php
|
5 |
|
|
part of pfSense (http://www.pfsense.com/)
|
6 |
|
|
|
7 |
6216690b
|
smos
|
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
8 |
c38fee60
|
Scott Ullrich
|
All rights reserved.
|
9 |
|
|
|
10 |
|
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
|
|
|
13 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
|
|
|
16 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
|
|
|
20 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
1d333258
|
Scott Ullrich
|
/*
|
32 |
|
|
pfSense_BUILDER_BINARIES: /sbin/pfctl
|
33 |
|
|
pfSense_MODULE: upnp
|
34 |
|
|
*/
|
35 |
c38fee60
|
Scott Ullrich
|
|
36 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-status-upnpstatus
|
38 |
|
|
##|*NAME=Status: UPnP Status page
|
39 |
|
|
##|*DESCR=Allow access to the 'Status: UPnP Status' page.
|
40 |
|
|
##|*MATCH=status_upnp.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
c38fee60
|
Scott Ullrich
|
require("guiconfig.inc");
|
44 |
|
|
|
45 |
|
|
if ($_POST) {
|
46 |
|
|
if ($_POST['clear'] == "Clear") {
|
47 |
431484c8
|
Ryan Wagoner
|
upnp_action('restart');
|
48 |
92943d57
|
Rafael Lucas
|
$savemsg = gettext("Rules have been cleared and the daemon restarted");
|
49 |
c38fee60
|
Scott Ullrich
|
}
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
$rdr_entries = array();
|
53 |
|
|
exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
|
54 |
|
|
|
55 |
|
|
$now = time();
|
56 |
|
|
$year = date("Y");
|
57 |
|
|
|
58 |
92943d57
|
Rafael Lucas
|
$pgtitle = array(gettext("Status"),gettext("UPnP & NAT-PMP Status"));
|
59 |
d5bd9ee7
|
jim-p
|
$shortcut_section = "upnp";
|
60 |
c38fee60
|
Scott Ullrich
|
include("head.inc");
|
61 |
|
|
?>
|
62 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
63 |
|
|
<?php include("fbegin.inc"); ?>
|
64 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
65 |
|
|
<?php
|
66 |
80d5bd41
|
Phil Lavin
|
if(!$config['installedpackages'] || !$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] ||
|
67 |
89cb095e
|
Ryan Wagoner
|
!$config['installedpackages']['miniupnpd']['config'][0]['enable']) {
|
68 |
|
|
echo gettext("UPnP is currently disabled.");
|
69 |
|
|
include("fend.inc");
|
70 |
|
|
exit;
|
71 |
|
|
}
|
72 |
c38fee60
|
Scott Ullrich
|
?>
|
73 |
cc86161c
|
Ryan Wagoner
|
<div id="mainlevel">
|
74 |
c38fee60
|
Scott Ullrich
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
75 |
|
|
<tr>
|
76 |
|
|
<td class="tabcont" >
|
77 |
|
|
<form action="status_upnp.php" method="post">
|
78 |
eb9c5b2e
|
Carlos Eduardo Ramos
|
<input type="submit" name="clear" id="clear" value="<?=gettext("Clear");?>" /> <?=gettext("all currently connected sessions");?>.
|
79 |
c38fee60
|
Scott Ullrich
|
</form>
|
80 |
|
|
</td>
|
81 |
|
|
</tr>
|
82 |
|
|
<tr>
|
83 |
|
|
<td class="tabcont" >
|
84 |
d2619820
|
Scott Ullrich
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont">
|
85 |
|
|
<tr>
|
86 |
eb9c5b2e
|
Carlos Eduardo Ramos
|
<td width="10%" class="listhdrr"><?=gettext("Port");?></td>
|
87 |
|
|
<td width="10%" class="listhdrr"><?=gettext("Protocol");?></td>
|
88 |
|
|
<td width="20%" class="listhdrr"><?=gettext("Internal IP");?></td>
|
89 |
|
|
<td width="60%" class="listhdr"><?=gettext("Description");?></td>
|
90 |
c38fee60
|
Scott Ullrich
|
</tr>
|
91 |
|
|
<?php $i = 0; foreach ($rdr_entries as $rdr_entry) {
|
92 |
b5e64c50
|
Seth Mos
|
if (preg_match("/on (.*) inet proto (.*) from any to any port = (.*) label \"(.*)\" rtable [0-9] -> (.*) port (.*)/", $rdr_entry, $matches))
|
93 |
c38fee60
|
Scott Ullrich
|
$rdr_proto = $matches[2];
|
94 |
|
|
$rdr_port = $matches[3];
|
95 |
|
|
$rdr_ip = $matches[5];
|
96 |
|
|
$rdr_label =$matches[4];
|
97 |
|
|
?>
|
98 |
|
|
<tr>
|
99 |
|
|
<td class="listlr">
|
100 |
|
|
<?php print $rdr_port;?>
|
101 |
|
|
</td>
|
102 |
|
|
<td class="listlr">
|
103 |
|
|
<?php print $rdr_proto;?>
|
104 |
|
|
</td>
|
105 |
|
|
<td class="listlr">
|
106 |
|
|
<?php print $rdr_ip;?>
|
107 |
|
|
</td>
|
108 |
|
|
<td class="listlr">
|
109 |
|
|
<?php print $rdr_label;?>
|
110 |
|
|
</td>
|
111 |
|
|
</tr>
|
112 |
|
|
<?php $i++; }?>
|
113 |
|
|
</table>
|
114 |
|
|
</td>
|
115 |
|
|
</tr>
|
116 |
|
|
</table>
|
117 |
|
|
</div>
|
118 |
|
|
<?php include("fend.inc"); ?>
|
119 |
|
|
</body>
|
120 |
|
|
</html>
|