Subversion Repositories ALCASAR

Rev

Rev 2770 | Rev 2817 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 2810
1
<?php
1
<?php
2
/********************
2
/********************
3
* READ CONF FILES   *
3
* READ CONF FILES   *
4
*********************/
4
*********************/
5
define("CONF_FILE", "/usr/local/etc/alcasar.conf");
5
define("CONF_FILE", "/usr/local/etc/alcasar.conf");
6
define("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info");
6
define("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info");
7
$conf_files=array(CONF_FILE,ETHERS_INFO_FILE);
7
$conf_files=array(CONF_FILE,ETHERS_INFO_FILE);
8
foreach ($conf_files as $file) {
8
foreach ($conf_files as $file) {
9
	if (!file_exists($file)) {
9
	if (!file_exists($file)) {
10
		exit("Requested file ".$file." isn't present");
10
		exit("Requested file ".$file." isn't present");
11
	}
11
	}
12
	if (!is_readable($file)) {
12
	if (!is_readable($file)) {
13
		exit("Can't read the file ".$file);
13
		exit("Can't read the file ".$file);
14
	}
14
	}
15
}
15
}
16
 
16
 
17
$alcasar_conf_file = '/usr/local/etc/alcasar.conf';
17
$alcasar_conf_file = '/usr/local/etc/alcasar.conf';
18
$file_conf = fopen($alcasar_conf_file, 'r');
18
$file_conf = fopen($alcasar_conf_file, 'r');
19
if (!$file_conf) {
19
if (!$file_conf) {
20
	exit('Error opening the file '.$alcasar_conf_file);
20
	exit('Error opening the file '.$alcasar_conf_file);
21
}
21
}
22
while (!feof($file_conf)) {
22
while (!feof($file_conf)) {
23
	$buffer = fgets($file_conf, 4096);
23
	$buffer = fgets($file_conf, 4096);
24
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
24
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
25
		$tmp = explode('=', $buffer, 2);
25
		$tmp = explode('=', $buffer, 2);
26
		$conf[trim($tmp[0])] = trim($tmp[1]);
26
		$conf[trim($tmp[0])] = trim($tmp[1]);
27
	}
27
	}
28
}
28
}
29
fclose($file_conf);
29
fclose($file_conf);
30
 
30
 
31
$tmp = explode("/",$conf["PRIVATE_IP"]);
31
$tmp = explode("/",$conf["PRIVATE_IP"]);
32
$intif = $conf["INTIF"];
32
$intif = $conf["INTIF"];
33
$private_ip=$tmp[0];
33
$private_ip=$tmp[0];
34
require('/etc/freeradius-web/config.php');
34
require('/etc/freeradius-web/config.php');
35
# Choice of language
35
# Choice of language
36
$Language = 'en';
36
$Language = 'en';
37
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
37
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
38
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
38
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
39
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
39
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
40
}
40
}
41
if ($Language === 'fr') {
41
if ($Language === 'fr') {
42
	$l_activity = "Activité sur le réseau de consultation";
42
	$l_activity = "Activité sur le réseau de consultation";
43
	$l_ip_adr = "Adresse IP";
43
	$l_ip_adr = "Adresse IP";
44
	$l_mac_adr = "Adresse MAC";
44
	$l_mac_adr = "Adresse MAC";
45
	$l_user = "Usager";
45
	$l_user = "Usager";
46
	$l_mac_allowed = "@MAC autorisée";
46
	$l_mac_allowed = "@MAC autorisée";
47
	$l_mac_temporarily_allowed = "@MAC autorisée temporairement";
47
	$l_mac_temporarily_allowed = "@MAC autorisée temporairement";
48
	$l_action = "Action";
48
	$l_action = "Action";
49
	$l_dissociate = "Dissocier @IP";
49
	$l_dissociate = "Dissocier @IP";
50
	$l_disconnect = "Déconnecter";
50
	$l_disconnect = "Déconnecter";
51
	$l_stop_capture_disconnect = "Arrêter la capture et se déconnecter";
51
	$l_stop_capture_disconnect = "Arrêter la capture et se déconnecter";
52
	$l_refresh = "Cette page est rafraichie toutes les 30 secondes";
52
	$l_refresh = "Cette page est rafraichie toutes les 30 secondes";
53
	$l_edit_user = "Editer l'utilisateur";
53
	$l_edit_user = "Editer l'utilisateur";
54
	$l_connect = "Autoriser temporairement";
54
	$l_connect = "Autoriser temporairement";
55
	$l_captureon = "Autoriser et capturer";
55
	$l_captureon = "Autoriser et capturer";
56
	$l_captureoff = "Arrêter la capture";
56
	$l_captureoff = "Arrêter la capture";
57
	$l_captureonly_on = "Capturer";
57
	$l_captureonly_on = "Capturer";
58
 
58
 
59
} else {
59
} else {
60
	$l_activity = "Activity on the consultation LAN";
60
	$l_activity = "Activity on the consultation LAN";
61
	$l_ip_adr = "IP Adress";
61
	$l_ip_adr = "IP Adress";
62
	$l_mac_adr = "MAC Adress";
62
	$l_mac_adr = "MAC Adress";
63
	$l_user = "User";
63
	$l_user = "User";
64
	$l_mac_allowed = "@MAC allowed";
64
	$l_mac_allowed = "@MAC allowed";
65
	$l_mac_temporarily_allowed = "@MAC temporarily allowed";
65
	$l_mac_temporarily_allowed = "@MAC temporarily allowed";
66
	$l_action = "Action";
66
	$l_action = "Action";
67
	$l_dissociate = "Dissociate @IP";
67
	$l_dissociate = "Dissociate @IP";
68
	$l_disconnect = "Disconnect";
68
	$l_disconnect = "Disconnect";
69
	$l_stop_capture_disconnect = "Stop capture and disconnect";
69
	$l_stop_capture_disconnect = "Stop capture and disconnect";
70
	$l_refresh = "This frame is refreshed every 30'";
70
	$l_refresh = "This frame is refreshed every 30'";
71
	$l_edit_user = "Edit user";
71
	$l_edit_user = "Edit user";
72
	$l_connect = "Temporarily authorize";
72
	$l_connect = "Temporarily authorize";
73
	$l_captureon = "Authorize and capture";
73
	$l_captureon = "Authorize and capture";
74
	$l_captureoff = "Stop capture";
74
	$l_captureoff = "Stop capture";
75
	$l_captureonly_on = "Capture";
75
	$l_captureonly_on = "Capture";
76
 
-
 
77
}
76
}
78
 
77
 
79
if (isset($_POST['action'])){
78
if (isset($_POST['action'])){
80
	switch ($_POST['action']){
79
	switch ($_POST['action']){
81
		case "$l_disconnect" :
80
		case "$l_disconnect" :
82
			$mac= $_POST['mac_addr'];
81
			$mac= $_POST['mac_addr'];
83
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
82
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
84
			unset($_POST['mac_addr']);
83
			unset($_POST['mac_addr']);
85
		break;
84
		break;
86
		case "$l_stop_capture_disconnect" :
85
		case "$l_stop_capture_disconnect" :
87
			$mac= $_POST['mac_addr'];
86
			$mac= $_POST['mac_addr'];
88
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
87
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
89
			$file = '/tmp/capture_'.$mac.'.pcap';
88
			$file = '/tmp/capture_'.$mac.'.pcap';
90
			if (file_exists($file))
89
			if (file_exists($file))
91
			{
90
			{
92
				header('Content-Description : File Transfer');
91
				header('Content-Description : File Transfer');
93
				header('Content-Type: application/octet-stream');
92
				header('Content-Type: application/octet-stream');
94
				header('Content-disposition: attachement; filename='.basename($file).'');
93
				header('Content-disposition: attachement; filename='.basename($file).'');
95
				header('Expires: 0');
94
				header('Expires: 0');
96
				header('Cache-Control: must-revalidate');
95
				header('Cache-Control: must-revalidate');
97
				header('Pragma: public');
96
				header('Pragma: public');
98
				header('Content-Lenght: '.filesize($file));
97
				header('Content-Lenght: '.filesize($file));
99
				readfile($file);
98
				readfile($file);
100
				exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$macc);
99
				exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$macc);
101
				exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
100
				exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
102
				unset($_POST['mac_addr']);
101
				unset($_POST['mac_addr']);
103
				exit;
102
				exit;
104
			}
103
			}
105
 
104
 
106
		break;
105
		break;
107
		case "$l_dissociate" :
106
		case "$l_dissociate" :
108
			exec("sudo /usr/sbin/chilli_query dhcp-release ".escapeshellarg($_POST['mac_addr']));
107
			exec("sudo /usr/sbin/chilli_query dhcp-release ".escapeshellarg($_POST['mac_addr']));
109
			unset($_POST['mac_addr']);
108
			unset($_POST['mac_addr']);
110
		break;
109
		break;
111
		case "$l_connect" :
110
		case "$l_connect" :
112
			exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
111
			exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
113
			unset($_POST['mac_addr']);
112
			unset($_POST['mac_addr']);
114
		break;
113
		break;
115
		case "$l_captureon" :
114
		case "$l_captureon" :
116
			$mac= $_POST['mac_addr'];
115
			$mac= $_POST['mac_addr'];
117
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
116
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
118
			exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
117
			exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
119
			unset($_POST['mac_addr']);
118
			unset($_POST['mac_addr']);
120
		break;
119
		break;
121
		case "$l_captureonly_on" :
120
		case "$l_captureonly_on" :
122
			$mac= $_POST['mac_addr'];
121
			$mac= $_POST['mac_addr'];
123
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
122
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
124
		break;	
123
		break;	
125
		case "$l_captureoff" :
124
		case "$l_captureoff" :
126
			$mac= $_POST['mac_addr'];
125
			$mac= $_POST['mac_addr'];
127
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
126
			exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
128
			$file = '/tmp/capture_'.$mac.'.pcap';
127
			$file = '/tmp/capture_'.$mac.'.pcap';
129
			if (file_exists($file))
128
			if (file_exists($file))
130
			{
129
			{
131
				header('Content-Description : File Transfer');
130
				header('Content-Description : File Transfer');
132
				header('Content-Type: application/octet-stream');
131
				header('Content-Type: application/octet-stream');
133
				header('Content-disposition: attachement; filename='.basename($file).'');
132
				header('Content-disposition: attachement; filename='.basename($file).'');
134
				header('Expires: 0');
133
				header('Expires: 0');
135
				header('Cache-Control: must-revalidate');
134
				header('Cache-Control: must-revalidate');
136
				header('Pragma: public');
135
				header('Pragma: public');
137
				header('Content-Lenght: '.filesize($file));
136
				header('Content-Lenght: '.filesize($file));
138
				readfile($file);
137
				readfile($file);
139
				exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$mac);
138
				exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$mac);
140
				unset($_POST['mac_addr']);
139
				unset($_POST['mac_addr']);
141
				exit;
140
				exit;
142
			}
141
			}
143
		break;
142
		break;
144
	}
143
	}
145
}
144
}
146
?>
145
?>
147
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
146
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
148
<HTML><!-- written by Rexy -->
147
<html><!-- written by Rexy -->
149
<head>
148
<head>
150
<META HTTP-EQUIV="Refresh" CONTENT="30">
149
<meta HTTP-EQUIV="Refresh" CONTENT="30">
151
<meta http-equiv="Content-Type" content="text/html; charset=<?= $config['general_charset'] ?>">
150
<meta http-equiv="Content-Type" content="text/html; charset=<?= $config['general_charset'] ?>">
152
<title>Activity</title>
151
<title>Activity</title>
153
<link rel="stylesheet" type="text/css" href="/css/style.css">
152
<link rel="stylesheet" type="text/css" href="/css/style.css">
154
</head>
153
</head>
155
<body>
154
<body>
156
<table width="100%" border="0" cellspacing="0" cellpadding="0">
155
<table width="100%" border="0" cellspacing="0" cellpadding="0">
157
<tr><th><?= $l_activity ?></th></tr>
156
<tr><th><?= $l_activity ?></th></tr>
158
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
157
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
159
</table>
158
</table>
160
<table width="100%" border=1 cellspacing=0 cellpadding=1>
159
<table width="100%" border=1 cellspacing=0 cellpadding=1>
161
	<tr><td valign="middle" align="center"><?= $l_refresh ?><br>
160
	<tr><td valign="middle" align="center"><?= $l_refresh ?><br>
162
	<table border=1 width="80%" cellpadding=2 cellspacing=0>
161
	<table border=1 width="80%" cellpadding=2 cellspacing=0>
163
		<tr>
162
		<tr>
164
			<th>#</th>
163
			<th>#</th>
165
			<th><?= $l_ip_adr ?></th>
164
			<th><?= $l_ip_adr ?></th>
166
			<th><?= $l_mac_adr ?></th>
165
			<th><?= $l_mac_adr ?></th>
167
			<th><?= $l_user ?></th>
166
			<th><?= $l_user ?></th>
168
			<th><?= $l_action ?></th>
167
			<th><?= $l_action ?></th>
169
		</tr>
168
		</tr>
170
		<?php
169
		<?php
171
		$IoT_capture = $conf["IOT_CAPTURE"];
170
		$IoT_capture = $conf["IOT_CAPTURE"];
172
		$output = array(); $detail = array(); $nb_ligne = 0;
171
		$output = array(); $detail = array(); $nb_ligne = 0;
173
		exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); // retrieve ALCASAR MAC address
172
		exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); // retrieve ALCASAR MAC address
174
		$detail = explode (" " , $output[1]);
173
		$detail = explode (" " , $output[1]);
175
		$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
174
		$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
176
		unset ($output);unset ($detail);
175
		unset ($output);unset ($detail);
177
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output); 
176
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output); 
178
		while (list(,$ligne) = each($output)){
177
		while (list(,$ligne) = each($output)){
179
			$detail = explode (" ", $ligne);
178
			$detail = explode (" ", $ligne);
180
			$nb_ligne ++;
179
			$nb_ligne ++;
181
			echo "<tr valign=\"middle\">";
180
			echo "<tr valign=\"middle\">";
182
			echo "<td>".$nb_ligne."</td>";
181
			echo "<td>".$nb_ligne."</td>";
183
			echo "<td>".$detail[1]."</td>";
182
			echo "<td>".$detail[1]."</td>";
184
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
183
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
185
			{
184
			{
186
				$oui_id = substr(str_replace("-","",$detail[0]),0,6);
185
				$oui_id = substr(str_replace("-","",$detail[0]),0,6);
187
				exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
186
				exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
188
				if(empty($mac_manufacturer[0]))
187
				if(empty($mac_manufacturer[0]))
189
				{
188
				{
190
					$mac_manufacturer[0] = "Unknown";
189
					$mac_manufacturer[0] = "Unknown";
191
				}
190
				}
192
				echo "<td>$detail[0] <font size=\"1\">($mac_manufacturer[0])</font>";
191
				echo "<td>$detail[0] <font size=\"1\">($mac_manufacturer[0])</font>";
193
				unset($mac_manufacturer);
192
				unset($mac_manufacturer);
194
			}
193
			}
195
			else
194
			else
196
			{
195
			{
197
				echo "<td>$detail[0]";
196
				echo "<td>$detail[0]";
198
			}
197
			}
199
			exec ("grep $detail[0] /usr/local/etc/alcasar-ethers-info |cut -d' ' -f3", $mac_in_ether_file);
198
			exec ("grep $detail[0] /usr/local/etc/alcasar-ethers-info |cut -d' ' -f3", $mac_in_ether_file);
200
			if (!empty($mac_in_ether_file[0]))
199
			if (!empty($mac_in_ether_file[0]))
201
			{
200
			{
202
				echo " - <b>" . ltrim($mac_in_ether_file[0],'#') . "</b>";
201
				echo " - <b>" . ltrim($mac_in_ether_file[0],'#') . "</b>";
203
			}
202
			}
204
			echo "</td><td>";
203
			echo "</td><td>";
205
			if ($detail[4] == "1"){ // authenticated equipment
204
			if ($detail[4] == "1"){ // authenticated equipment
206
				$login = $detail[5];
205
				$login = $detail[5];
207
				unset ($found_users); unset ($cn);
206
				unset ($found_users); unset ($cn);
208
				$search = $login; $search_IN = 'username'; // is user in database ?
207
				$search = $login; $search_IN = 'username'; // is user in database ?
209
				if (is_file("../lib/sql/find.php"))
208
				if (is_file("../lib/sql/find.php"))
210
				include("../lib/sql/find.php");
209
				include("../lib/sql/find.php");
211
				if (isset ($found_users)) // user is in database
210
				if (isset ($found_users)) // user is in database
212
				{
211
				{
213
					if (is_file("../lib/sql/user_info.php")) //retrieve user info (especialy $cn)
212
					if (is_file("../lib/sql/user_info.php")) //retrieve user info (especialy $cn)
214
						include("../lib/sql/user_info.php");
213
						include("../lib/sql/user_info.php");
215
				}
214
				}
216
				if (! isset ($cn)){ $cn='-';}
215
				if (! isset ($cn)){ $cn='-';}
217
				# The user is an allowed MAC address
216
				# The user is an allowed MAC address
218
					if ($detail[5] == $detail[0]){
217
					if ($detail[5] == $detail[0]){
219
						if (isset ($found_users)) { #MAC is in database
218
						if (isset ($found_users)) { #MAC is in database
220
							echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed";if ($cn != '-'){ echo " ($cn)";};echo "</a>";
219
							echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed";if ($cn != '-'){ echo " ($cn)";};echo "</a>";
221
							echo "</td><td>";
220
							echo "</td><td>";
222
						}
221
						}
223
						else { #MAC is temporarily allowed
222
						else { #MAC is temporarily allowed
224
							echo "<b>$l_mac_temporarily_allowed</b>";
223
							echo "<b>$l_mac_temporarily_allowed</b>";
225
							echo "</td><td>";
224
							echo "</td><td>";
226
							echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
225
							echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
227
							echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
226
							echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
228
 
227
 
229
							if($IoT_capture == "on")
228
							if($IoT_capture == "on")
230
							{
229
							{
231
								if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
230
								if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
232
								{
231
								{
233
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_stop_capture_disconnect\">";
232
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_stop_capture_disconnect\">";
234
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
233
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
235
								}
234
								}
236
 								else
235
 								else
237
								{
236
								{
238
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
237
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
239
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
238
									echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
240
								}
239
								}
241
							}
240
							}
242
							else
241
							else
243
								echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
242
								echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
244
 
243
 
245
							echo "</FORM></TD>";
244
							echo "</FORM></TD>";
246
						}
245
						}
247
						# Disable temporarily @MAC access
246
						# Disable temporarily @MAC access
248
					}
247
					}
249
				# The user is a humanoide ;-)
248
				# The user is a humanoide ;-)
250
					else {
249
					else {
251
						if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
250
						if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
252
						else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
251
						else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
253
						echo "<TD>";
252
						echo "<TD>";
254
						echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
253
						echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
255
						echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
254
						echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
256
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
255
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
257
						echo "</FORM></TD>";
256
						echo "</FORM></TD>";
258
						}
257
						}
259
					}
258
					}
260
			# equipment without authenticated user
259
			# equipment without authenticated user
261
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
260
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
262
				echo "ALCASAR system";
261
				echo "ALCASAR system";
263
				echo "<TD>";
262
				echo "<TD>";
264
				echo "&nbsp;";
263
				echo "&nbsp;";
265
				echo "</TD>";
264
				echo "</TD>";
266
				}	
265
				}	
267
			else {  
266
			else {  
268
				echo "&nbsp;";
267
				echo "&nbsp;";
269
				echo "<TD>";		
268
				echo "<TD>";		
270
				echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
269
				echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
271
				# Dissociate user (... or other) who is not connected yet
270
				# Dissociate user (... or other) who is not connected yet
272
				echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
271
				echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
273
				exec ("grep $detail[0] /usr/local/etc/alcasar-ethers-info", $mac_in_ether_file);
272
				exec ("grep $detail[0] /usr/local/etc/alcasar-ethers-info", $mac_in_ether_file);
274
				if (empty($mac_in_ether_file[1]))
273
				if (empty($mac_in_ether_file[1]))
275
				{
274
				{
276
					echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_dissociate\">"; // Dissociate only MAC not in ether file (dhcp)
275
					echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_dissociate\">"; // Dissociate only MAC not in ether file (dhcp)
277
				}
276
				}
278
				echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_connect\">"; // Enable temporarily @MAC access
277
				echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_connect\">"; // Enable temporarily @MAC access
279
				
278
				
280
				if($IoT_capture == "on")
279
				if($IoT_capture == "on")
281
				{
280
				{
282
					if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
281
					if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
283
					{
282
					{
284
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
283
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
285
					}
284
					}
286
					else
285
					else
287
					{
286
					{
288
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureon\">";
287
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureon\">";
289
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
288
						echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
290
					}
289
					}
291
				}
290
				}
292
				echo "</FORM></TD>";
291
				echo "</FORM></TD>";
293
			}
292
			}
294
			unset ($mac_in_ether_file);
293
			unset ($mac_in_ether_file);
295
			echo "</tr>";
294
			echo "</tr>";
296
		}
295
		}
297
		?>
296
		?>
298
	</table>
297
	</table>
299
	</td></tr>
298
	</td></tr>
300
</table>
299
</table>
301
</html>
300
</html>
302
 
301
 
303
 
302