| Line 7... |
Line 7... |
| 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 |
/********************
|
| - |
|
13 |
* READ CONF FILES *
|
| - |
|
14 |
*********************/
|
| - |
|
15 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
| - |
|
16 |
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
|
| - |
|
17 |
$conf_files=array(CONF_FILE,ETHERS_FILE);
|
| - |
|
18 |
foreach ($conf_files as $file){
|
| - |
|
19 |
if (!file_exists($file)){
|
| - |
|
20 |
exit("Requested file ".$file." isn't present");}
|
| - |
|
21 |
if (!is_readable($file)){
|
| - |
|
22 |
exit("Can't read the file ".$file);}
|
| - |
|
23 |
}
|
| 12 |
#retrieve IP_address of ALCASAR
|
24 |
#retrieve IP_address of ALCASAR
|
| 13 |
$alcasar_conf_file="/usr/local/etc/alcasar.conf";
|
25 |
$alcasar_conf_file="/usr/local/etc/alcasar.conf";
|
| 14 |
$ouvre=fopen("$alcasar_conf_file","r");
|
26 |
$ouvre=fopen("$alcasar_conf_file","r");
|
| 15 |
if ($ouvre){
|
27 |
if ($ouvre){
|
| 16 |
while (!feof ($ouvre))
|
28 |
while (!feof ($ouvre))
|
| Line 19... |
Line 31... |
| 19 |
if (strpos($tampon,"=")!==false){
|
31 |
if (strpos($tampon,"=")!==false){
|
| 20 |
$tmp = explode("=",$tampon);
|
32 |
$tmp = explode("=",$tampon);
|
| 21 |
$conf[$tmp[0]] = $tmp[1];
|
33 |
$conf[$tmp[0]] = $tmp[1];
|
| 22 |
}
|
34 |
}
|
| 23 |
}
|
35 |
}
|
| 24 |
}else{
|
- |
|
| 25 |
exit("Erreur d'ouverture du fichier $alcasar_conf_file");
|
- |
|
| 26 |
}
|
36 |
}
|
| 27 |
fclose($ouvre);
|
37 |
fclose($ouvre);
|
| 28 |
$tmp = explode("/",$conf["PRIVATE_IP"]);
|
38 |
$tmp = explode("/",$conf["PRIVATE_IP"]);
|
| 29 |
$intif = $conf["INTIF"];
|
39 |
$intif = $conf["INTIF"];
|
| 30 |
$private_ip=$tmp[0];
|
40 |
$private_ip=$tmp[0];
|
| Line 107... |
Line 117... |
| 107 |
if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
|
117 |
if(file_exists('/usr/share/arp-scan/ieee-oui.txt')) // for each device on LAN, retrieve the MAC manufacturer
|
| 108 |
{
|
118 |
{
|
| 109 |
$oui_id = substr(str_replace("-","",$detail[0]),0,6);
|
119 |
$oui_id = substr(str_replace("-","",$detail[0]),0,6);
|
| 110 |
exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
|
120 |
exec ("grep $oui_id /usr/share/arp-scan/ieee-oui.txt | cut -f2", $mac_manufacturer);
|
| 111 |
if(empty($mac_manufacturer[0]))
|
121 |
if(empty($mac_manufacturer[0]))
|
| 112 |
{
|
122 |
{
|
| 113 |
$mac_manufacturer[0] = "Unknown";
|
123 |
$mac_manufacturer[0] = "Unknown";
|
| 114 |
}
|
- |
|
| 115 |
|
124 |
}
|
| 116 |
echo "<td>$detail[0] ($mac_manufacturer[0])</td>";
|
125 |
echo "<td>$detail[0] <font size=\"1\">($mac_manufacturer[0])</font>";
|
| 117 |
unset($mac_manufacturer);
|
126 |
unset($mac_manufacturer);
|
| 118 |
}
|
127 |
}
|
| 119 |
else
|
128 |
else
|
| 120 |
{
|
129 |
{
|
| 121 |
echo "<td>$detail[0]</td>";
|
130 |
echo "<td>$detail[0]";
|
| 122 |
}
|
131 |
}
|
| - |
|
132 |
exec ("grep $detail[0] /usr/local/etc/alcasar-ethers |cut -d' ' -f3", $mac_in_ether_file);
|
| - |
|
133 |
if (!empty($mac_in_ether_file[0]))
|
| - |
|
134 |
{
|
| - |
|
135 |
echo " - <b>" . ltrim($mac_in_ether_file[0],'#') . "</b>";
|
| - |
|
136 |
}
|
| 123 |
echo "<td>";
|
137 |
echo "</td><td>";
|
| 124 |
if ($detail[4] == "1"){ // authenticated equipment
|
138 |
if ($detail[4] == "1"){ // authenticated equipment
|
| 125 |
$login = $detail[5];
|
139 |
$login = $detail[5];
|
| 126 |
unset ($found_users); unset ($cn);
|
140 |
unset ($found_users); unset ($cn);
|
| 127 |
$search = $login; $search_IN = 'username'; // is user in database ?
|
141 |
$search = $login; $search_IN = 'username'; // is user in database ?
|
| 128 |
if (is_file("../lib/sql/find.php"))
|
142 |
if (is_file("../lib/sql/find.php"))
|
| Line 138... |
Line 152... |
| 138 |
if (isset ($found_users)) { #MAC is in database
|
152 |
if (isset ($found_users)) { #MAC is in database
|
| 139 |
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>";
|
153 |
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>";
|
| 140 |
echo "</td><td>";
|
154 |
echo "</td><td>";
|
| 141 |
}
|
155 |
}
|
| 142 |
else { #MAC is temporarily allowed
|
156 |
else { #MAC is temporarily allowed
|
| 143 |
echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_temporarily_allowed</a>";
|
157 |
echo "<b>$l_mac_temporarily_allowed</b>";
|
| 144 |
echo "</td><td>";
|
158 |
echo "</td><td>";
|
| 145 |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
|
159 |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
|
| 146 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
160 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
| 147 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
161 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
| 148 |
echo "</FORM></TD>";
|
162 |
echo "</FORM></TD>";
|
| Line 171... |
Line 185... |
| 171 |
echo " ";
|
185 |
echo " ";
|
| 172 |
echo "<TD>";
|
186 |
echo "<TD>";
|
| 173 |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
|
187 |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
|
| 174 |
# Dissociate user (... or other) who is not connected yet
|
188 |
# Dissociate user (... or other) who is not connected yet
|
| 175 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
189 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
| - |
|
190 |
if (empty($mac_in_ether_file[0]))
|
| - |
|
191 |
{
|
| 176 |
echo "<INPUT type='submit' name='action' value='$l_dissociate'>";
|
192 |
echo "<INPUT type='submit' name='action' value='$l_dissociate'>"; // Dissociate only MAC not in ether file (dhcp)
|
| 177 |
# Enable temporarily @MAC access
|
193 |
}
|
| 178 |
echo "<INPUT type=submit name='action' value='$l_connect'>";
|
194 |
echo "<INPUT type=submit name='action' value='$l_connect'>"; // Enable temporarily @MAC access
|
| 179 |
echo "</FORM></TD>";
|
195 |
echo "</FORM></TD>";
|
| 180 |
}
|
196 |
}
|
| - |
|
197 |
unset ($mac_in_ether_file);
|
| 181 |
echo "</tr>";
|
198 |
echo "</tr>";
|
| 182 |
}
|
199 |
}
|
| 183 |
?>
|
200 |
?>
|
| 184 |
</table>
|
201 |
</table>
|
| 185 |
</td></tr>
|
202 |
</td></tr>
|