2 Copyright (C)
2017 Steven Hessing
<steven.hessing@gmail.com
>
3 This is free software, licensed under the GNU General Public License v3.
4 /usr/lib/lua/luci/view/clients.htm
12 local last_modified =
"<boottime>"
17 if nixio.fs.access(
"/var/lib/noddos/DeviceDump.json") then
18 last_modified = os.date(
"%c", nixio.fs.stat(
"/var/lib/noddos/DeviceDump.json")['mtime'])
19 io.input(
"/var/lib/noddos/DeviceDump.json")
21 devdump = luci.jsonc.parse(t)
22 io.input(
"/var/lib/noddos/DeviceProfiles.json")
24 temp = luci.jsonc.parse(t)
26 for i, v in ipairs(temp) do
27 devicevalues[v.DeviceProfileUuid] = v
34 <div class=
"cbi-map" id=
"cbi-network">
35 <h2 name=
"content"><%:Clients%
></h2>
36 <div class=
"cbi-map-descr"><%:The following clients have been discovered on the network. The last discovery was completed at %
><%=last_modified%
></div>
38 <fieldset class=
"cbi-section">
39 <legend><%:Recognized Clients%
></legend>
40 <div class=
"cbi-section-node">
41 <table class=
"cbi-section-table">
42 <tr class=
"cbi-section-table-titles">
43 <th class=
"cbi-section-table-cell"><%:Hostname%
></th>
44 <th class=
"cbi-section-table-cell"><%:IPv4%
></th>
45 <th class=
"cbi-section-table-cell"><%:MAC%
></th>
46 <th class=
"cbi-section-table-cell"><%:Manufacturer%
></th>
47 <th class=
"cbi-section-table-cell"><%:Model%
></th>
48 <th class=
"cbi-section-table-cell"><%:Class%
></th>
52 for i,v in ipairs(devdump) do
53 if v.DeviceProfileUuid ~=
"" then
55 <tr class=
"cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
56 <td class=
"cbi-value-field"><%=v.Hostname%
></td>
57 <td class=
"cbi-value-field"><%=v.Ipv4Address%
></td>
58 <td class=
"cbi-value-field"><a href=
"/cgi-bin/clientdetails?mac=<%=v.MacAddress%>"><%=v.MacAddress%
></a></td>
59 <td class=
"cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].Manufacturer%
></td>
60 <td class=
"cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].Model%
></td>
61 <td class=
"cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].ThingClass%
></td>
72 <fieldset class=
"cbi-section">
73 <legend><%:Unrecognized Clients%
></legend>
74 <div class=
"cbi-section-node">
75 <table class=
"cbi-section-table">
76 <tr class=
"cbi-section-table-titles">
77 <th class=
"cbi-section-table-cell"><%:Hostname%
></th>
78 <th class=
"cbi-section-table-cell"><%:IPv4%
></th>
79 <th class=
"cbi-section-table-cell"><%:MAC%
></th>
80 <th class=
"cbi-section-table-cell"><%:Manufacturer%
></th>
81 <th class=
"cbi-section-table-cell"><%:Model%
></th>
82 <th class=
"cbi-section-table-cell"><%:DhcpVendor%
></th>
83 <th class=
"cbi-section-table-cell"><%:DhcpHostname%
></th>
87 for i,v in ipairs(devdump) do
88 if v.DeviceProfileUuid ==
"" then
90 <tr class=
"cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
91 <td class=
"cbi-value-field"><%=v.Hostname%
></td>
92 <td class=
"cbi-value-field"><%=v.Ipv4Address%
></td>
93 <td class=
"cbi-value-field"><a href=
"/cgi-bin/clientdetails?mac=<%=v.MacAddress%>"><%=v.MacAddress%
></a></td>
94 <td class=
"cbi-value-field"><%=v.SsdpManufacturer%
></td>
95 <td class=
"cbi-value-field"><%=v.SsdpModelName%
></td>
96 <td class=
"cbi-value-field"><%=v.DhcpVendor1%
></td>
97 <td class=
"cbi-value-field"><%=v.DhcpHostname%
></td>