Subversion Repositories ALCASAR

Rev

Rev 2129 | Rev 2265 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2129 Rev 2134
Line 1... Line 1...
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>Activity</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){
Line 60... Line 60...
60
  $l_disconnect = "Disconnect";
60
  $l_disconnect = "Disconnect";
61
  $l_refresh = "This frame is refreshed every 30'";
61
  $l_refresh = "This frame is refreshed every 30'";
62
  $l_edit_user = "Edit user"; 
62
  $l_edit_user = "Edit user"; 
63
  $l_connect = "Temporarily authorize";
63
  $l_connect = "Temporarily authorize";
64
}
64
}
65
echo "
-
 
66
<tr><th>$l_activity</th></tr>
65
echo "<tr><th>$l_activity</th></tr>
67
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
66
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td></tr>
68
height=\"2\"></td></tr>
-
 
69
</TABLE>";
67
</table>";
70
if (isset($_POST['action'])){
68
if (isset($_POST['action'])){
71
	switch ($_POST['action']){
69
	switch ($_POST['action']){
72
		case "$l_disconnect" :
70
		case "$l_disconnect" :
73
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
71
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
74
			unset ($_POST['mac_addr']);
72
			unset ($_POST['mac_addr']);
Line 82... Line 80...
82
			unset ($_POST['mac_addr']);
80
			unset ($_POST['mac_addr']);
83
		break;
81
		break;
84
	}
82
	}
85
}
83
}
86
?>
84
?>
87
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
85
<table width="100%" border=1 cellspacing=0 cellpadding=1>
88
	<tr><td valign="middle" align="left">
86
	<tr><td valign="middle" align="center"><? echo "$l_refresh";?><br>
89
	<center>
-
 
90
<? echo "$l_refresh";?>
-
 
91
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
87
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
92
		<tr bgcolor="#d0ddb0">
88
		<tr bgcolor="#d0ddb0">
93
<? echo "
-
 
94
		<th>#</th>
89
<? echo "		<th>#</th>
95
		<th>$l_ip_adr</th>
90
		<th>$l_ip_adr</th>
96
		<th>$l_mac_adr</th>
91
		<th>$l_mac_adr</th>
97
		<th>$l_user</th>
92
		<th>$l_user</th>
98
		<th>$l_action</th>
93
		<th>$l_action</th>
99
		</tr>";
94
		</tr>";
Line 104... Line 99...
104
		unset ($output);unset ($detail);
99
		unset ($output);unset ($detail);
105
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output); 
100
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output); 
106
		while (list(,$ligne) = each($output)){
101
		while (list(,$ligne) = each($output)){
107
			$detail = explode (" ", $ligne);
102
			$detail = explode (" ", $ligne);
108
			$nb_ligne ++;
103
			$nb_ligne ++;
109
			echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
-
 
110
			echo "<TR>";
104
			echo "<tr valign=\"middle\">";
111
			echo "<TD>".$nb_ligne."</TD>";
105
			echo "<td>".$nb_ligne."</td>";
112
			echo "<TD>".$detail[1]."</TD>";
106
			echo "<td>".$detail[1]."</td>";
113
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
107
			if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
114
			{
108
			{
115
				$oui_id = substr(str_replace("-","",$detail[0]),0,6);
109
				$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);
110
				exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
117
				if(empty($mac_manufacturer[0]))
111
				if(empty($mac_manufacturer[0]))
118
                {
112
                {
119
                	$mac_manufacturer[0] = "Unknown";
113
                	$mac_manufacturer[0] = "Unknown";
120
                }
114
                }
121
 
115
 
122
				echo "<TD>$detail[0] ($mac_manufacturer[0])</TD>";
116
				echo "<td>$detail[0] ($mac_manufacturer[0])</td>";
123
				unset($mac_manufacturer);
117
				unset($mac_manufacturer);
124
			}
118
			}
125
			else
119
			else
126
			{
120
			{
127
				echo "<TD>$detail[0]</TD>";
121
				echo "<td>$detail[0]</td>";
128
			}
122
			}
129
			echo "<TD>";
123
			echo "<td>";
130
			if ($detail[4] == "1"){ // authenticated equipment
124
			if ($detail[4] == "1"){ // authenticated equipment
131
				$login = $detail[5];
125
				$login = $detail[5];
132
				unset ($found_users); unset ($cn);
126
				unset ($found_users); unset ($cn);
133
				$search = $login; $search_IN = 'username'; // is user in database ?
127
				$search = $login; $search_IN = 'username'; // is user in database ?
134
				if (is_file("../lib/sql/find.php"))
128
				if (is_file("../lib/sql/find.php"))
Line 146... Line 140...
146
							echo "</td><td>";
140
							echo "</td><td>";
147
						}
141
						}
148
						else { #MAC is temporarily allowed
142
						else { #MAC is temporarily allowed
149
							echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_temporarily_allowed</a>";
143
							echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_temporarily_allowed</a>";
150
							echo "</td><td>";
144
							echo "</td><td>";
-
 
145
							echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
151
							echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
146
							echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
152
							echo "<INPUT type=submit name='action' value='$l_disconnect'>";
147
							echo "<INPUT type=submit name='action' value='$l_disconnect'>";
-
 
148
							echo "</FORM></TD>";
153
						}
149
						}
154
						# Disable temporarily @MAC access
150
						# Disable temporarily @MAC access
155
					}
151
					}
156
				# The user is a humanoide ;-)
152
				# The user is a humanoide ;-)
157
					else {
153
					else {
158
						if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
154
						if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
159
						else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
155
						else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
160
						echo "</TD>";
-
 
161
						echo "<TD>";
156
						echo "<TD>";
-
 
157
						echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
162
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
158
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
163
						echo "<INPUT type=submit name='action' value='$l_disconnect'>";
159
						echo "<INPUT type=submit name='action' value='$l_disconnect'>";
-
 
160
						echo "</FORM></TD>";
164
						}
161
						}
165
					}
162
					}
166
			# equipment without authenticated user
163
			# equipment without authenticated user
167
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
164
			else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
168
				echo "ALCASAR system";
165
				echo "ALCASAR system";
169
				echo "</TD>";
-
 
170
				echo "<TD>";
166
				echo "<TD>";
171
				echo "&nbsp;";
167
				echo "&nbsp;";
-
 
168
				echo "</TD>";
172
				}	
169
				}	
173
			else {  
170
			else {  
174
				echo "&nbsp;";
171
				echo "&nbsp;";
175
				echo "</TD>";
172
				echo "<TD>";		
176
				echo "<TD>";
173
				echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
177
 
-
 
178
				# Dissociate user (... or other) who is not connected yet
174
				# Dissociate user (... or other) who is not connected yet
179
				echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
175
				echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
180
				echo "<INPUT type='submit' name='action' value='$l_dissociate'>";
176
				echo "<INPUT type='submit' name='action' value='$l_dissociate'>";
181
 
-
 
182
				# Enable temporarily @MAC access
177
				# Enable temporarily @MAC access
183
				echo "<INPUT type=submit name='action' value='$l_connect'>";
178
				echo "<INPUT type=submit name='action' value='$l_connect'>";
184
 
-
 
-
 
179
				echo "</FORM></TD>";
185
			}
180
			}
186
 
-
 
187
			echo "</TR></FORM>";
181
			echo "</tr>";
188
		}
182
		}
189
		?>
183
		?>
190
		</td></tr>
-
 
191
	</table>
184
	</table>
192
	</td></tr>
185
	</td></tr>
193
</table>
186
</table>
194
</html>
187
</html>
195
 
188