Project

General

Profile

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