-- -- (C) 2013-16 - ntop.org -- dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path if(ntop.isPro()) then package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path require "snmp_utils" end require "lua_utils" require "graph_utils" require "alert_utils" require "historical_utils" mac = _GET["mac"] vlanId = _GET["vlanId"] if(vlanId == nil) then vlanId = 0 end interface.select(ifname) ifstats = interface.getStats() ifId = ifstats.id prefs = ntop.getPrefs() sendHTTPHeader('text/html; charset=iso-8859-1') ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc") dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") if(mac == nil) then print("
Mac parameter is missing (internal error ?)
") return end mac_info = interface.getMacInfo(mac, vlanId) if(mac_info == nil) then print('
Mac '.. mac .. ' cannot be found. ') print("
") dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua") return end print [[
") print("\n") print("") if(isAdministrator()) then print(" ]] else -- print("") end print("") print("\n") print("\n") if((mac_info["bytes.sent"]+mac_info["bytes.rcvd"]) > 0) then print("\n") end print("\n") print("
MAC Address "..mac) s = get_symbolic_mac(mac, true) if(s ~= mac) then print(" ("..s..")") end if(_GET["custom_name"] ~=nil) then setHostAltName(mac, _GET["custom_name"]) end if(_GET["custom_icon"] ~=nil) then setHostIcon(mac, _GET["custom_icon"]) end print(getHostIcon(mac)) local label = getHostAltName(mac) print(" [ Show Hosts ]") print("") print [[
]] print[[]] print[[]] print[[") pickIcon(mac) print [[  ]] print('\n') print [[
 
First / Last Seen" .. formatEpoch(mac_info["seen.first"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.first"]) .. " ago]" .. "" .. formatEpoch(mac_info["seen.last"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.last"]) .. " ago]" .. "
Sent vs Received Traffic Breakdown") breakdownBar(mac_info["bytes.sent"], "Sent", mac_info["bytes.rcvd"], "Rcvd", 0, 100) print("
Traffic Sent / Received" .. formatPackets(mac_info["packets.sent"]) .. " / ".. bytesToSize(mac_info["bytes.sent"]) .. " " .. formatPackets(mac_info["packets.rcvd"]) .. " / ".. bytesToSize(mac_info["bytes.rcvd"]) .. "
") dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")