{# Copyright (C) 2017 Steven Hessing (steven.hessing@gmail.com) This is free software, licensed under the GNU General Public License v3. /usr/lib/lua/luci/view/clients.htm #} {% local cjson = require "cjson" local os = require "os" local lfs = require "lfs" local noddosdir = "/var/lib/noddos/" local dumpfile= noddosdir .. "DeviceDump.json" local profilefile = noddosdir .. "DeviceProfiles.json" local last_modified = "" local devices local profiles function file_exists(path) local file = io.open(path, "rb") if file then file:close() end return file ~= nil end last_modified = os.date("%c", lfs.attributes(dumpfile)[modification]) io.input(dumpfile) t = io.read("*all") devices = cjson.decode(t) io.input(profilefile) t = io.read("*all") profiles = cjson.decode(t) devicevalues = {} local v for i, v in ipairs(profiles) do devicevalues[v.DeviceProfileUuid] = v end %} Noddos Clients

Clients

The following clients have been discovered on the network. The last discovery was completed at {{last_modified}}
Recognized Clients
{% for i,v in ipairs(devices) do if v.DeviceProfileUuid ~= "" then %} {% end end %}
Hostname IPv4 MAC Manufacturer Model Class
{{v.Hostname}} {{v.Ipv4Address}} {{v.MacAddress}} {{devicevalues[v.DeviceProfileUuid].Manufacturer}} {{devicevalues[v.DeviceProfileUuid].Model}} {{devicevalues[v.DeviceProfileUuid].ThingClass}}

Unrecognized Clients
{% for i,v in ipairs(devices) do if v.DeviceProfileUuid == "" then %} {% end end %}
Hostname IPv4 MAC Manufacturer Model DhcpVendor DhcpHostname
{{v.Hostname}} {{v.Ipv4Address}} {{v.MacAddress}} {{v.SsdpManufacturer}} {{v.SsdpModelName}} {{v.DhcpVendor1}} {{v.DhcpHostname}}