Subversion Repositories ALCASAR

Rev

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

Rev 2065 Rev 2078
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<head>
3
<head>
4
<META HTTP-EQUIV="Refresh" CONTENT="30">
4
<META HTTP-EQUIV="Refresh" CONTENT="30">
5
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
5
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
6
<title>&Eacute;tat du r&eacute;seau</title>
6
<title>&Eacute;tat du r&eacute;seau</title>
7
<link rel="stylesheet" href="/css/style.css">
7
<link rel="stylesheet" href="/css/style.css">
8
</head>
8
</head>
9
<body>
9
<body>
10
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
10
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
11
<?
11
<?
12
#retrieve IP_address of ALCASAR
12
#retrieve IP_address of ALCASAR
13
$alcasar_conf_file="/usr/local/etc/alcasar.conf";
13
$alcasar_conf_file="/usr/local/etc/alcasar.conf";
14
$ouvre=fopen("$alcasar_conf_file","r");
14
$ouvre=fopen("$alcasar_conf_file","r");
15
if ($ouvre){
15
if ($ouvre){
16
	while (!feof ($ouvre))
16
	while (!feof ($ouvre))
17
	{
17
	{
18
		$tampon = fgets($ouvre, 4096);
18
		$tampon = fgets($ouvre, 4096);
19
		if (strpos($tampon,"=")!==false){
19
		if (strpos($tampon,"=")!==false){
20
			$tmp = explode("=",$tampon);
20
			$tmp = explode("=",$tampon);
21
			$conf[$tmp[0]] = $tmp[1];
21
			$conf[$tmp[0]] = $tmp[1];
22
		}
22
		}
23
	}
23
	}
24
}else{
24
}else{
25
	exit("Erreur d'ouverture du fichier $alcasar_conf_file");
25
	exit("Erreur d'ouverture du fichier $alcasar_conf_file");
26
}
26
}
27
fclose($ouvre);
27
fclose($ouvre);
28
$tmp = explode("/",$conf["PRIVATE_IP"]);
28
$tmp = explode("/",$conf["PRIVATE_IP"]);
29
$intif = $conf["INTIF"];
29
$intif = $conf["INTIF"];
30
$private_ip=$tmp[0];
30
$private_ip=$tmp[0];
31
require('/etc/freeradius-web/config.php');
31
require('/etc/freeradius-web/config.php');
32
# Choice of language
32
# Choice of language
33
$Language = 'en';
33
$Language = 'en';
34
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
34
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
35
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
35
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
36
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
36
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
37
if($Language == 'fr'){
37
if($Language == 'fr'){
38
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
38
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
39
  $l_ip_adr = "Adresse IP";
39
  $l_ip_adr = "Adresse IP";
40
  $l_mac_adr = "Adresse MAC";
40
  $l_mac_adr = "Adresse MAC";
41
  $l_user = "Usager";
41
  $l_user = "Usager";
42
  $l_mac_allowed = "@MAC autoris&eacute;e";
42
  $l_mac_allowed = "@MAC autoris&eacute;e";
43
  $l_action = "Action";
43
  $l_action = "Action";
44
  $l_dissociate = "Dissocier";
44
  $l_dissociate = "Dissocier";
45
  $l_disconnect = "D&eacute;connecter";
45
  $l_disconnect = "D&eacute;connecter";
46
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
46
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
47
  $l_edit_user = "Editer l'utilisateur"; 
47
  $l_edit_user = "Editer l'utilisateur"; 
48
  $l_mac_action = "Action temporaire";
48
  $l_mac_action = "Action temporaire";
49
  $l_connect = "Autoriser";
49
  $l_connect = "Autoriser";
50
}
50
}
51
else {
51
else {
52
  $l_activity = "Activity on the consultation LAN";
52
  $l_activity = "Activity on the consultation LAN";
53
  $l_ip_adr = "IP Adress";
53
  $l_ip_adr = "IP Adress";
54
  $l_mac_adr = "MAC Adress";
54
  $l_mac_adr = "MAC Adress";
55
  $l_user = "User";
55
  $l_user = "User";
56
  $l_mac_allowed = "@MAC allowed";
56
  $l_mac_allowed = "@MAC allowed";
57
  $l_action = "Action";
57
  $l_action = "Action";
58
  $l_dissociate = "Dissociate";
58
  $l_dissociate = "Dissociate";
59
  $l_disconnect = "Disconnect";
59
  $l_disconnect = "Disconnect";
60
  $l_refresh = "This frame is refreshed every 30'";
60
  $l_refresh = "This frame is refreshed every 30'";
61
  $l_edit_user = "Edit user"; 
61
  $l_edit_user = "Edit user"; 
62
  $l_mac_action = "Temporarily Action";
62
  $l_mac_action = "Temporarily Action";
63
  $l_connect = "Authorize";
63
  $l_connect = "Authorize";
64
}
64
}
65
echo "
65
echo "
66
<tr><th>$l_activity</th></tr>
66
<tr><th>$l_activity</th></tr>
67
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
67
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
68
height=\"2\"></td></tr>
68
height=\"2\"></td></tr>
69
</TABLE>";
69
</TABLE>";
70
if (isset($_POST['action'])){
70
if (isset($_POST['action'])){
71
	switch ($_POST['action']){
71
	switch ($_POST['action']){
72
		case "$l_disconnect" :
72
		case "$l_disconnect" :
73
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
73
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
74
			unset ($_POST['mac_addr']);
74
			unset ($_POST['mac_addr']);
75
		break;
75
		break;
76
		case "$l_dissociate" :
76
		case "$l_dissociate" :
77
			exec ("sudo /usr/sbin/chilli_query dhcp-release $_POST[mac_addr]");
77
			exec ("sudo /usr/sbin/chilli_query dhcp-release $_POST[mac_addr]");
78
			unset ($_POST['mac_addr']);
78
			unset ($_POST['mac_addr']);
79
		break;
79
		break;
80
		case "$l_connect" :
80
		case "$l_connect" :
81
			exec ("sudo /usr/sbin/chilli_query authorize mac $_POST[mac_addr]");
81
			exec ("sudo /usr/sbin/chilli_query authorize mac $_POST[mac_addr]");
82
			unset ($_POST['mac_addr']);
82
			unset ($_POST['mac_addr']);
83
		break;
83
		break;
84
	}
84
	}
85
}
85
}
86
?>
86
?>
87
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
87
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
88
	<tr><td valign="middle" align="left">
88
	<tr><td valign="middle" align="left">
89
	<center>
89
	<center>
90
<? echo "$l_refresh";?>
90
<? echo "$l_refresh";?>
91
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
91
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
92
		<tr bgcolor="#d0ddb0">
92
		<tr bgcolor="#d0ddb0">
93
<? echo "
93
<? echo "
94
		<th>#</th>
94
		<th>#</th>
95
		<th>$l_ip_adr</th>
95
		<th>$l_ip_adr</th>
96
		<th>$l_mac_adr</th>
96
		<th>$l_mac_adr</th>
97
		<th>$l_user</th>
97
		<th>$l_user</th>
98
		<th>$l_action</th>
98
		<th>$l_action</th>
99
		</tr>";
99
		</tr>";
100
		$output = array(); $detail = array(); $nb_ligne = 0;
100
		$output = array(); $detail = array(); $nb_ligne = 0;
101
		exec ("sudo /sbin/ip link show $intif", $output);
101
		exec ("sudo /sbin/ip link show $intif", $output);
102
		$detail = explode (" " , $output[1]);
102
		$detail = explode (" " , $output[1]);
103
		$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
103
		$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
104
		unset ($output);unset ($detail);
104
		unset ($output);unset ($detail);
105
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
105
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
106
		while (list(,$ligne) = each($output)){
106
		while (list(,$ligne) = each($output)){
107
			$detail = explode (" ", $ligne);
107
			$detail = explode (" ", $ligne);
108
			$nb_ligne ++;
108
			$nb_ligne ++;
109
			echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
109
			echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
110
			echo "<TR>";
110
			echo "<TR>";
111
			echo "<TD>".$nb_ligne."</TD>";
111
			echo "<TD>".$nb_ligne."</TD>";
112
			echo "<TD>".$detail[1]."</TD>";
112
			echo "<TD>".$detail[1]."</TD>";
113
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt'))
113
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt'))
114
			{
114
			{
115
				$oui_id = substr(str_replace("-","",$detail[0]),0,6);
115
				$oui_id = substr(str_replace("-","",$detail[0]),0,6);
116
				exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
116
				exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
117
				echo "<TD>$detail[0] ($mac_manufacturer[0])</TD>";
117
				echo "<TD>$detail[0] ($mac_manufacturer[0])</TD>";
-
 
118
				unset($mac_manufacturer);
118
			}
119
			}
119
			else
120
			else
120
			{
121
			{
121
				echo "<TD>$detail[0]</TD>";
122
				echo "<TD>$detail[0]</TD>";
122
			}
123
			}
123
			echo "<TD>";
124
			echo "<TD>";
124
			# authenticated equipment 
125
			# authenticated equipment 
125
			if ($detail[4] == "1"){
126
			if ($detail[4] == "1"){
126
			# retrieve user info
127
			# retrieve user info
127
			$login = $detail[5];
128
			$login = $detail[5];
128
			//if (is_file("lib/sql/defaults.php")) //retrieve user groups
129
			//if (is_file("lib/sql/defaults.php")) //retrieve user groups
129
				include("../lib/sql/defaults.php");
130
				include("../lib/sql/defaults.php");
130
			if (is_file("../lib/sql/user_info.php")) //retrieve user info
131
			if (is_file("../lib/sql/user_info.php")) //retrieve user info
131
				include("../lib/sql/user_info.php");
132
				include("../lib/sql/user_info.php");
132
			# The user is an allowed MAC address
133
			# The user is an allowed MAC address
133
				if ($detail[5] == $detail[0]){
134
				if ($detail[5] == $detail[0]){
134
					if ($cn != '-') {echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed ($cn)</a>";}
135
					if ($cn != '-') {echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed ($cn)</a>";}
135
					else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed</a>";}
136
					else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed</a>";}
136
					echo "</TD>";
137
					echo "</TD>";
137
					echo "<TD>";
138
					echo "<TD>";
138
					
139
					
139
					# Disable temporarily @MAC access
140
					# Disable temporarily @MAC access
140
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
141
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
141
					echo "<INPUT type=submit name='action' value='$l_disconnect'>";
142
					echo "<INPUT type=submit name='action' value='$l_disconnect'>";
142
				}
143
				}
143
			# The user is a humanoide ;-)
144
			# The user is a humanoide ;-)
144
				else {
145
				else {
145
					if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
146
					if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
146
					else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
147
					else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
147
					echo "</TD>";
148
					echo "</TD>";
148
					echo "<TD>";
149
					echo "<TD>";
149
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
150
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
150
					echo "<INPUT type=submit name='action' value='$l_disconnect'>";
151
					echo "<INPUT type=submit name='action' value='$l_disconnect'>";
151
					}
152
					}
152
				}
153
				}
153
			# equipment without authenticated user
154
			# equipment without authenticated user
154
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
155
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
155
				echo "ALCASAR system";
156
				echo "ALCASAR system";
156
				echo "</TD>";
157
				echo "</TD>";
157
				echo "<TD>";
158
				echo "<TD>";
158
				echo "&nbsp;";
159
				echo "&nbsp;";
159
			}
160
			}
160
			else { 
161
			else { 
161
				echo "&nbsp;";
162
				echo "&nbsp;";
162
				echo "</TD>";
163
				echo "</TD>";
163
				echo "<TD>";
164
				echo "<TD>";
164
 
165
 
165
				# Dissociate user (... or other) who is not connected yet
166
				# Dissociate user (... or other) who is not connected yet
166
				echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
167
				echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
167
				echo "<INPUT type='submit' name='action' value='$l_dissociate'>";
168
				echo "<INPUT type='submit' name='action' value='$l_dissociate'>";
168
 
169
 
169
				# Enable temporarily @MAC access
170
				# Enable temporarily @MAC access
170
				echo "<INPUT type=submit name='action' value='$l_connect'>";
171
				echo "<INPUT type=submit name='action' value='$l_connect'>";
171
 
172
 
172
			}
173
			}
173
 
174
 
174
			echo "</TR></FORM>";
175
			echo "</TR></FORM>";
175
		}
176
		}
176
		?>
177
		?>
177
		</td></tr>
178
		</td></tr>
178
	</table>
179
	</table>
179
	</td></tr>
180
	</td></tr>
180
</table>
181
</table>
181
</html>
182
</html>
182
 
183
 
183
 
184