示例#1
0
 /**
  *
  */
 public function index()
 {
     if (\Request::has('bssidName')) {
         $q_bssidName = trim(\Request::get('bssidName'));
         $bssids = \App\Bssid::where('bssidName', $q_bssidName)->paginate(10);
     } else {
         $bssids = \App\Bssid::where('bssidName', '<>', '')->paginate(10);
     }
     return view('bssids.index', compact('bssids'));
 }
示例#2
0
文件: Bssid.php 项目: afdalwahyu/lnms
 /**
  * poller clientMacAddress
  *
  * @return Array
  */
 public function poll_clientMacAddress()
 {
     // return
     $_ret = [];
     $snmp = new \App\Lnms\Snmp($this->node->ip_address, $this->node->snmp_comm_ro);
     // walk coDot11StationMACAddress
     $walk_coDot11StationMACAddress = $snmp->walk(OID_Colubris_coDot11StationMACAddress);
     if (count($walk_coDot11StationMACAddress) == 0 || $walk_coDot11StationMACAddress === false) {
         // not found coDot11StationMACAddress
         return $_ret;
     }
     // oid.ifIndex.clientIndex
     foreach ($walk_coDot11StationMACAddress as $key1 => $clientMacHex) {
         $clientMacAddress = str_replace(' ', ':', $clientMacHex);
         $clientSuffix = str_replace(OID_Colubris_coDot11StationMACAddress . '.', '', $key1);
         $tmp1 = explode('.', $clientSuffix);
         $ifIndex = $tmp1[0];
         $clientIndex = $tmp1[1];
         // find port_id
         $port = \App\Port::where('node_id', $this->node->id)->where('ifIndex', $ifIndex)->first();
         if ($port) {
             // find bssid
             $bssid = \App\Bssid::where('node_id', $this->node->id)->where('port_id', $port->id)->first();
             //
             $clientDetails = $snmp->get([OID_Colubris_coDot11StationIPAddress . '.' . $clientSuffix, OID_Colubris_coDot11SignalLevel . '.' . $clientSuffix]);
             if (isset($clientDetails[OID_Colubris_coDot11StationIPAddress . '.' . $clientSuffix])) {
                 $clientIpAddress = $clientDetails[OID_Colubris_coDot11StationIPAddress . '.' . $clientSuffix];
             } else {
                 $clientIpAddress = null;
             }
             if (isset($clientDetails[OID_Colubris_coDot11SignalLevel . '.' . $clientSuffix])) {
                 $clientSignalStrength = $clientDetails[OID_Colubris_coDot11SignalLevel . '.' . $clientSuffix];
             } else {
                 $clientSignalStrength = null;
             }
             if ($bssid) {
                 // found bssid
                 $_ret[] = ['table' => 'bds', 'action' => 'insert', 'key' => ['node_id' => $this->node->id, 'bssid_id' => $bssid->id, 'clientMacAddress' => $clientMacAddress, 'timestamp' => \Carbon\Carbon::now()], 'data' => ['clientIpAddress' => $clientIpAddress, 'clientSignalStrength' => $clientSignalStrength, 'clientBytesReceived' => 0, 'clientBytesSent' => 0]];
             }
         }
     }
     return $_ret;
 }
示例#3
0
文件: Ap.php 项目: afdalwahyu/lnms
 /**
  * poller ap client
  *
  * @return Array
  */
 public function poll_apClient()
 {
     // return
     $_ret = [];
     $snmp = new \App\Lnms\Snmp($this->node->ip_address, $this->node->snmp_comm_ro);
     $walk_nUserApBSSID = $snmp->walk(OID_Aruba_nUserApBSSID);
     if (count($walk_nUserApBSSID) == 0) {
         return $_ret;
     }
     // oid.clientMacDec(6).clientIpAddress(4) = bssidMacHex
     foreach ($walk_nUserApBSSID as $key1 => $bssidMacHex) {
         $bssidMacAddress = str_replace(' ', ':', trim($bssidMacHex));
         $clientSuffix = str_replace(OID_Aruba_nUserApBSSID . '.', '', $key1);
         $tmp1 = explode('.', $clientSuffix);
         $clientMacAddress = sprintf("%02s", dechex($tmp1[0])) . ':' . sprintf("%02s", dechex($tmp1[1])) . ':' . sprintf("%02s", dechex($tmp1[2])) . ':' . sprintf("%02s", dechex($tmp1[3])) . ':' . sprintf("%02s", dechex($tmp1[4])) . ':' . sprintf("%02s", dechex($tmp1[5]));
         $clientIpAddress = $tmp1[6] . '.' . $tmp1[7] . '.' . $tmp1[8] . '.' . $tmp1[9];
         // find bssid
         $bssid = \App\Bssid::where('bssidMacAddress', $bssidMacAddress)->first();
         $clientSignalStrength = 0;
         $clientBytesReceived = 0;
         $clientBytesSent = 0;
         // get more details about client
         $clientDetails = $snmp->get([OID_Aruba_staUserAgent . '.' . $clientSuffix, OID_Aruba_staUserType . '.' . $clientSuffix]);
         if (isset($clientDetails[OID_Aruba_staUserAgent . '.' . $clientSuffix])) {
             $clientUserAgent = $clientDetails[OID_Aruba_staUserAgent . '.' . $clientSuffix];
         } else {
             $clientUserAgent = '';
         }
         if (isset($clientDetails[OID_Aruba_staUserType . '.' . $clientSuffix])) {
             $clientUserType = $clientDetails[OID_Aruba_staUserType . '.' . $clientSuffix];
         } else {
             $clientUserType = '';
         }
         if ($bssid) {
             // found bssid
             $_ret[] = ['table' => 'bds', 'action' => 'insert', 'key' => ['node_id' => $bssid->node->id, 'bssid_id' => $bssid->id, 'clientMacAddress' => $clientMacAddress, 'timestamp' => \Carbon\Carbon::now()], 'data' => ['clientIpAddress' => $clientIpAddress, 'clientSignalStrength' => $clientSignalStrength, 'clientBytesReceived' => $clientBytesReceived, 'clientBytesSent' => $clientBytesSent, 'clientUserAgent' => $clientUserAgent, 'clientUserType' => $clientUserType]];
         }
     }
     return $_ret;
 }
示例#4
0
文件: Bssid.php 项目: afdalwahyu/lnms
 /**
  * poller clientMacAddress
  *
  * @return Array
  */
 public function poll_clientMacAddress()
 {
     // return
     $_ret = [];
     $snmp = new \App\Lnms\Snmp($this->node->ip_address, $this->node->snmp_comm_ro);
     // walk cDot11ClientIpAddress
     $walk_cDot11ClientIpAddress = $snmp->walk(OID_cDot11ClientIpAddress);
     if (count($walk_cDot11ClientIpAddress) == 0) {
         // not found cDot11ClientIpAddress
         return $_ret;
     }
     $walk1 = $snmp->walk(OID_cDot11ClientSignalStrength);
     // oid.?.??.bssidNameDec.clientMacAddressDec = clientIpAddressHex
     foreach ($walk_cDot11ClientIpAddress as $key1 => $clientIpAddressHex) {
         $clientSuffix = str_replace(OID_cDot11ClientIpAddress . '.', '', $key1);
         $tmp1 = explode('.', $clientSuffix);
         // find which bssidName each client connected
         // TODO : for now ignore the first 2-bytes
         // find bssidName
         $bssidName = '';
         for ($i = 2; $i < count($tmp1) - 6; $i++) {
             $bssidName .= chr($tmp1[$i]);
         }
         // find clientMacAddress
         $clientMacAddress = '';
         for ($i = count($tmp1) - 6; $i < count($tmp1); $i++) {
             $clientMacAddress .= sprintf("%02s", dechex($tmp1[$i])) . ':';
         }
         $clientMacAddress = trim($clientMacAddress, ':');
         // find clientIpAddress
         $tmp2 = explode(' ', trim($clientIpAddressHex));
         $clientIpAddress = '';
         for ($i = 0; $i < count($tmp2); $i++) {
             $clientIpAddress .= hexdec($tmp2[$i]) . '.';
         }
         $clientIpAddress = trim($clientIpAddress, '.');
         // get cDot11ClientStatisticEntry
         $walk_clientStatistics = $snmp->get([OID_cDot11ClientSignalStrength . '.' . $clientSuffix, OID_cDot11ClientBytesReceived . '.' . $clientSuffix, OID_cDot11ClientBytesSent . '.' . $clientSuffix]);
         if (isset($walk_clientStatistics[OID_cDot11ClientSignalStrength . '.' . $clientSuffix])) {
             $clientSignalStrength = $walk_clientStatistics[OID_cDot11ClientSignalStrength . '.' . $clientSuffix];
         } else {
             $clientSignalStrength = null;
         }
         if (isset($walk_clientStatistics[OID_cDot11ClientBytesReceived . '.' . $clientSuffix])) {
             $clientBytesReceived = $walk_clientStatistics[OID_cDot11ClientBytesReceived . '.' . $clientSuffix];
         } else {
             $clientBytesReceived = null;
         }
         if (isset($walk_clientStatistics[OID_cDot11ClientBytesSent . '.' . $clientSuffix])) {
             $clientBytesSent = $walk_clientStatistics[OID_cDot11ClientBytesSent . '.' . $clientSuffix];
         } else {
             $clientBytesSent = null;
         }
         // find bssid
         $bssid = \App\Bssid::where('node_id', $this->node->id)->where('bssidName', $bssidName)->first();
         if ($bssid) {
             // found bssid
             $_ret[] = ['table' => 'bds', 'action' => 'insert', 'key' => ['node_id' => $this->node->id, 'bssid_id' => $bssid->id, 'clientMacAddress' => $clientMacAddress, 'timestamp' => \Carbon\Carbon::now()], 'data' => ['clientIpAddress' => $clientIpAddress, 'clientSignalStrength' => $clientSignalStrength, 'clientBytesReceived' => $clientBytesReceived, 'clientBytesSent' => $clientBytesSent]];
         }
     }
     return $_ret;
 }
示例#5
0
 /**
  * display bssids in node
  *
  */
 public function bssids($id)
 {
     $node = \App\Node::findOrFail($id);
     $bssids = \App\Bssid::where('node_id', $id)->orderBy('bssidIndex')->paginate(10);
     return view('nodes.bssids', compact('node', 'bssids'));
 }
示例#6
0
 /**
  *
  * @return view
  */
 public function dashboard_by_clients()
 {
     // summary by bssid
     $bssids = \App\Bssid::orderBy('bssidClients_count', 'desc')->paginate(10);
     return view('pages.dashboard_by_clients', compact('bssids'));
 }