| Line 96... |
Line 96... |
| 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); // retrieve ALCASAR MAC address
|
| 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')) // for each device on LAN, retrieve the MAC manufacturer
|
| 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 |
unset($mac_manufacturer);
|
| Line 120... |
Line 120... |
| 120 |
else
|
120 |
else
|
| 121 |
{
|
121 |
{
|
| 122 |
echo "<TD>$detail[0]</TD>";
|
122 |
echo "<TD>$detail[0]</TD>";
|
| 123 |
}
|
123 |
}
|
| 124 |
echo "<TD>";
|
124 |
echo "<TD>";
|
| 125 |
# authenticated equipment
|
125 |
if ($detail[4] == "1"){ // authenticated equipment
|
| 126 |
if ($detail[4] == "1"){
|
- |
|
| 127 |
# retrieve user info
|
- |
|
| 128 |
$login = $detail[5];
|
126 |
$login = $detail[5];
|
| 129 |
//if (is_file("lib/sql/defaults.php")) //retrieve user groups
|
127 |
unset ($found_users); $search = $login; $search_IN = 'username'; // is user in database ?
|
| 130 |
include("../lib/sql/defaults.php");
|
128 |
if (is_file("../lib/sql/find.php"))
|
| 131 |
if (is_file("../lib/sql/user_info.php")) //retrieve user info
|
- |
|
| 132 |
include("../lib/sql/user_info.php");
|
129 |
include("../lib/sql/find.php");
|
| 133 |
# The user is an allowed MAC address
|
130 |
if (isset ($found_users)) // user is in database
|
| 134 |
if ($detail[5] == $detail[0]){
|
- |
|
| 135 |
if ($cn != '-') {echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed ($cn)</a>";}
|
- |
|
| 136 |
else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed</a>";}
|
- |
|
| 137 |
echo "</TD>";
|
- |
|
| 138 |
echo "<TD>";
|
- |
|
| 139 |
|
131 |
{
|
| 140 |
# Disable temporarily @MAC access
|
132 |
echo "OK - ";
|
| 141 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
133 |
if (is_file("../lib/sql/user_info.php")) //retrieve user info
|
| 142 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
134 |
include("../lib/sql/user_info.php");
|
| 143 |
}
|
135 |
}
|
| - |
|
136 |
# The user is an allowed MAC address
|
| - |
|
137 |
if ($detail[5] == $detail[0]){
|
| - |
|
138 |
if ($cn != '-') {echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed ($cn)</a>";}
|
| - |
|
139 |
else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user\">$l_mac_allowed</a>";}
|
| - |
|
140 |
echo "</TD>";
|
| - |
|
141 |
echo "<TD>";
|
| - |
|
142 |
# Disable temporarily @MAC access
|
| - |
|
143 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
| - |
|
144 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
| - |
|
145 |
}
|
| 144 |
# The user is a humanoide ;-)
|
146 |
# The user is a humanoide ;-)
|
| 145 |
else {
|
147 |
else {
|
| 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>";}
|
148 |
if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";}
|
| 147 |
else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
|
149 |
else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";}
|
| 148 |
echo "</TD>";
|
150 |
echo "</TD>";
|
| 149 |
echo "<TD>";
|
151 |
echo "<TD>";
|
| 150 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
152 |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
|
| 151 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
153 |
echo "<INPUT type=submit name='action' value='$l_disconnect'>";
|
| - |
|
154 |
}
|
| 152 |
}
|
155 |
}
|
| 153 |
}
|
- |
|
| 154 |
# equipment without authenticated user
|
156 |
# equipment without authenticated user
|
| 155 |
else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
|
157 |
else if (($detail[0] == $intif_mac_addr) || ($detail[1] == $private_ip)){
|
| 156 |
echo "ALCASAR system";
|
158 |
echo "ALCASAR system";
|
| 157 |
echo "</TD>";
|
159 |
echo "</TD>";
|
| 158 |
echo "<TD>";
|
160 |
echo "<TD>";
|
| 159 |
echo " ";
|
161 |
echo " ";
|
| 160 |
}
|
162 |
}
|
| 161 |
else {
|
163 |
else {
|
| 162 |
echo " ";
|
164 |
echo " ";
|
| 163 |
echo "</TD>";
|
165 |
echo "</TD>";
|
| 164 |
echo "<TD>";
|
166 |
echo "<TD>";
|
| 165 |
|
167 |
|
| 166 |
# Dissociate user (... or other) who is not connected yet
|
168 |
# Dissociate user (... or other) who is not connected yet
|