mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Add connected device for bridged, edit regex
This commit is contained in:
parent
80b0634d2d
commit
c2cff9d947
@ -1,11 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
||||||
if ($arrHostapdConf['WifiAPEnable'] == 1) {
|
if ($arrHostapdConf['WifiAPEnable'] == 1) {
|
||||||
$client_iface = 'uap0';
|
$client_iface = 'uap0';
|
||||||
} else {
|
} else {
|
||||||
$client_iface = RASPI_WIFI_CLIENT_INTERFACE;
|
$client_iface = RASPI_WIFI_CLIENT_INTERFACE;
|
||||||
|
}
|
||||||
|
$MACPattern = '([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}';
|
||||||
|
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
||||||
|
$moreLink = "index.php?page=hostapd_conf";
|
||||||
|
exec('arp -i '.$client_iface.' -a | grep -E $(iw dev '.$client_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|") | tr -d "()" | awk -F" " \'{print $7 " " $4 " " $2 " " $1}\'', $clients);
|
||||||
|
} else {
|
||||||
|
$moreLink = "index.php?page=dhcpd_conf";
|
||||||
|
exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep -oE '.$MACPattern.' | paste -sd "|")', $clients);
|
||||||
}
|
}
|
||||||
exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep -oE "(([0-9]|[a-f]|[A-F]){2}:){5}([0-9]|[a-f]|[A-F]){2}" | tr "\n" "\|" | sed "s/.$//")', $clients);
|
|
||||||
$ifaceStatus = $wlan0up ? "up" : "down";
|
$ifaceStatus = $wlan0up ? "up" : "down";
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -89,7 +96,7 @@ $ifaceStatus = $wlan0up ? "up" : "down";
|
|||||||
</table>
|
</table>
|
||||||
<?php if (sizeof($clients) >2) : ?>
|
<?php if (sizeof($clients) >2) : ?>
|
||||||
<div class="col-lg-12 float-right">
|
<div class="col-lg-12 float-right">
|
||||||
<a class="btn btn-outline-info" role="button" href="index.php?page=dhcpd_conf"><?php echo _("More");?> <i class="fas fa-chevron-right"></i></a>
|
<a class="btn btn-outline-info" role="button" href="<?php echo $moreLink ?>"><?php echo _("More");?> <i class="fas fa-chevron-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif (sizeof($clients) ==0) : ?>
|
<?php elseif (sizeof($clients) ==0) : ?>
|
||||||
<div class="col-lg-12 mt-3"><?php echo _("No connected devices");?></div>
|
<div class="col-lg-12 mt-3"><?php echo _("No connected devices");?></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user