-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstatus.php
291 lines (276 loc) · 12.6 KB
/
status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?php
/*
* status.php
*
* Copyright (C) 2013-2014 by Erland Hedman <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
include 'cgi-bin/common.php';
$TMO=240;
if (count($_GET) == 0) {
do_hostopts();
@system("leases " .g_lan()." ".g_domain().">/tmp/reslist &");
@system("alleases ".g_domain().">/tmp/dmlist &");
@system("topspammers > /tmp/spamlist &");
}
$ppgw=$pubip=NULL;
if ($vpnifs=trim(@exec("/sbin/ifconfig | grep ppp | wc -l")) >0)
$ppgw=trim(@exec("ip addr show ppp0 | grep -v secondary | awk '/inet /{ print $2 }'"));
if (g_srvstat("ddclient"))
$pubip=trim(@exec("cat /var/cache/ddclient/ddclient.cache | awk -Fip= '{print \$2}' | awk -F, '{print \$1}'"));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/css/bridge.css">
<title><?php p_title(); ?></title>
<script>
function onbody() // Executed only once.
{
window.onresize=resize;
resize();
}
// Percent of width: Define the size of "1.0em"
function resize() // Set font relative to window width.
{
var f_Factor=1;
var W = window.innerWidth || document.body.clientWidth;
//return;
if (W <= 800) return;
// P = Math.floor (W/38); // ca. 3 percent constant
P = Math.floor (f_Factor*(8+W/160)); // Linear function
if (P<12)P=12; // Smallest size.
document.body.style.fontSize=P + 'px';
}
var refresh = 10;
var counter;
var secs;
var timeout;
function re_scan()
{
secs=secs-1;
document.getElementById("timer").innerHTML="Logout "+ secs + " s";
if (++timeout > <?php echo $TMO ?>) {
clearInterval(counter);
self.location.href="/logout.php";
} else if (--refresh < 0) {
clearInterval(counter);
var str="<?php echo $_SERVER['SCRIPT_NAME']; ?>?secs="+secs+"&timeout="+timeout;
self.location.href=str;
}
}
function initPage()
{
secs = document.getElementById("secs").value;
timeout = document.getElementById("timeout").value;
counter = setInterval(re_scan, 1000);
}
</script>
</head>
<body onload="initPage();"><script>onbody();</script>
<input type="hidden" id="secs" name="secs" value="<?php if (isset($_GET['secs'])) {echo intval($_GET['secs']) >0? $_GET['secs']:$TMO;} else echo $TMO; ?>">
<input type="hidden" id="timeout" name="timeout" value="0<?php if (isset($_GET['timeout'])) {echo intval($_GET['timeout']) >0? $_GET['timeout']:'0';} ?>">
<table id="topContainer">
<tr>
<td class="laCN">Project Page : <a href="<?php p_productHome(); ?>" target=_blank><?php p_serverName(); ?></a></td>
<td class="raCN">Version : <?php p_firmware("-ro");?> </td>
</tr>
</table>
<table id="topTable">
<tr>
<td id="topBarLeft"><a id="logo" href="<?php p_productHome(); ?>"></a></td>
<td id="topBarRight"></td>
</tr>
</table>
<table id="topMenuTable">
<tr>
<td class="ledPanel">
<img class="led" alt="fwstat" title="Firewall" src="/img/<?php echo g_srvstat("shorewall")? "on":"off" ?>.png">
<img class="led" alt="dnsstat" title="DNS" src="/img/<?php echo g_srvstat("named")? "on":"off" ?>.png">
<img class="led" alt="dhcpstat" title="DHCP" src="/img/<?php echo g_srvstat("dhcpd")? "on":"off" ?>.png">
</td>
<td class="topMenuLink"><a href="/network.php">Setup</a></td>
<td class="topMenuLink"><a href="/advanced.php">Advanced</a></td>
<td class="topMenuLink"><a href="/admin.php">MAINTENANCE</a></td>
<td class="topMenuThis"><a href="/status.php">Status</a></td>
<td class="topMenuLink"><a href="/logout.php"><span id="timer"></span></a></td>
</tr>
</table>
<table id="mainContentTable">
<tr style="vertical-align: top;">
<td class="leftMenyContatiner">
<div class="leftNavLink">
<ul style="width: 100%">
<li><div id="left" class="navThis">Status</div></li>
</ul>
</div>
</td>
<td id="contentHeading">
<div id="contentBox">
<h1>Device Information</h1>
Connection details for your <?php p_mode(); ?> are displayed on this page.
</div><div class="vbr"></div>
<div class="actionBox">
<h2 class="actionHeader">System Information</h2>
<table>
<tr>
<td class="raCB" style="width:40%"><b>Firmware Version :</b></td>
<td class="laCB"><b> <?php p_firmware("-ro"); ?></b></td>
</tr>
<tr>
<td class="raCB"><b>Uptime :</b></td>
<td class="laCB"><b> <?php p_uptime(); ?></b></td>
</tr>
<tr>
<td class="raCB"><b>System :</b></td>
<td class="laCB"><b> <?php p_osrel(); echo "@"; p_serverName(); ?></b></td>
</tr>
<tr>
<td class="raCB"><b>Firewall :</b></td>
<td class="laCB"><b> <?php echo g_srvstat("shorewall")==true? "Enabled":"Disabled"; ?></b></td>
</tr>
</table>
</div><div class="vbr"></div>
<div class="actionBox">
<h2 class="actionHeader"><?php echo g_iftype(g_lan())==1? "Ethernet":"Wireless"; ?> LAN Connection (<?php echo g_lan(); ?>)</h2>
<table>
<tr>
<td class="raCB" style="width:40%">Connection Type :</td>
<td class="laCB">
<?php p_connectionType(g_lan()); ?> IP </td>
</tr>
<tr>
<td class="raCB">MAC Address :</td>
<td class="laCB"> <?php p_mac(g_lan()) ?></td>
</tr>
<tr>
<td class="raCB">IP Address :</td>
<td class="laCB"> <?php p_ip(g_lan()); ?></td>
</tr>
<tr>
<td class="raCB">Subnet Mask :</td>
<td class="laCB"> <?php p_mask(g_lan()); ?></td>
</tr>
<tr>
<td class="raCB">Connected Clients :</td>
<td class="laCB"> <?php echo g_nclients(g_lan()); ?></td>
</tr>
</table>
</div><div class="vbr"></div>
<?php if ($vpnifs > 0) { ?>
<div class="actionBox">
<h2 class="actionHeader"> VPN Connections</h2>
<table>
<tr>
<td class="raCB">LAN Gateway IP :</td>
<td class="laCB"> <?php echo $ppgw; ?></td>
</tr>
<?php if ($pubip !=NULL) { ?>
<tr>
<td class="raCB">Public DDNS IP :</td>
<td class="laCB"> <?php echo $pubip; ?></td>
</tr>
<?php }?>
<tr>
<td class="raCB" style="width:40%">Connected Clients :</td>
<td class="laCB"> <?php echo $vpnifs; ?></td>
</tr>
</table>
</div><div class="vbr"></div>
<?php }?>
<div class="actionBox" style="display:<?php echo g_ifip(g_lan1())? "block":"none"; ?>">
<h2 class="actionHeader">Blacklist Filter and Redirector</h2>
<table>
<tr>
<td class="raCB" style="width:40%">To Host IP Address :</td>
<td class="laCB"> <?php p_spfredir(); if(g_spfhere()) {echo " on this "; p_mode();} ?></td>
</tr>
<?php if(g_spfhere()) { ?><tr>
<td class="raCB">URLs rejected :</td>
<td class="laCB"> <?php p_denycount(); ?></td>
</tr><?php }?>
</table>
</div><div class="vbr"></div>
<div class="actionBox">
<h2 class="actionHeader"><?php echo g_mode()==2? "Wireless WAN Connection":"Ethernet WAN Connection"; ?> (<?php echo g_wan(); ?>)</h2>
<table>
<tr>
<td class="raCB" style="width:40%">Connection Type :</td>
<td class="laCB">
<?php p_connectionType(g_wan()); ?> IP </td>
</tr>
<tr>
<td class="raCB">MAC Address :</td>
<td class="laCB"> <?php p_mac(g_wan()) ?></td>
</tr>
<tr>
<td class="raCB">IP Address :</td>
<td class="laCB"> <?php p_ip(g_wan()); ?></td>
</tr>
<tr>
<td class="raCB">Subnet Mask :</td>
<td class="laCB"> <?php p_mask(g_wan()); ?></td>
</tr>
<tr>
<td class="raCB">Default Gateway :</td>
<td class="laCB"> <?php p_gateway(); ?></td>
</tr>
<tr>
<td class="raCB">Traffic :</td>
<td class="laCB"> <?php p_lanStat(g_wan()); ?></td>
</tr>
</table>
</div>
<?php $allwifi=g_allwifidev(); foreach ($allwifi as $wifidev) { ?><div class="vbr"></div>
<div class="actionBox">
<h2 class="actionHeader">Wireless Connection for <?php echo $wifidev."@".g_wifiband($wifidev); ?></h2>
<table>
<tr>
<td class="raCB" style="width:40%">Wireless Radio :</td>
<td class="laCB"> <?php echo g_wstatus($wifidev)? 'Enabled':'Disabled'; ?></td>
</tr>
<tr>
<td class="raCB" style="width:40%">Wireless Mode :</td>
<td class="laCB"> <?php echo g_wmode($wifidev) ?></td>
</tr>
<tr>
<td class="raCB">Network Name(SSID) :</td>
<td class="laCB"> <?php p_wssid($wifidev); ?></td>
</tr>
<tr><?php if (g_mode()==1) {?>
<td class="raCB">Bit Rate :</td>
<td class="laCB"> <?php p_wbitrate($wifidev); ?></td>
</tr><?php }?>
<?php if (g_mode()==2) {?><tr>
<td class="raCB">Status :</td>
<td class="laCB"> <?php p_wstatus($wifidev); ?></td>
</tr>
<tr>
<td class="raCB">Link Quality :</td>
<td class="laCB"> <?php p_wquality($wifidev); ?></td>
</tr><?php }?>
<tr>
<td class="raCB">Security Type :</td>
<td class="laCB"> <?php p_keyType($wifidev); ?></td>
</tr>
</table>
</div><?php }?>
</td>
<td id="quickHelpContent"><strong>Help...</strong><br>
<br>
General status and network information is displayed here.
</td>
</tr>
<tr>
<td colspan="3" id="footer">
Copyright © <?php p_copyRight(); ?>
</td>
</tr>
</table>
</body>
</html>