123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <%#
- 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
- -%>
- <%-
- require "nixio.fs"
- require "os"
- local last_modified = "<boottime>"
- local style = true
- local v
- local devdump
- if nixio.fs.access("/var/lib/noddos/DeviceDump.json") then
- last_modified = os.date("%c", nixio.fs.stat("/var/lib/noddos/DeviceDump.json")['mtime'])
- io.input("/var/lib/noddos/DeviceDump.json")
- t = io.read("*all")
- devdump = luci.jsonc.parse(t)
- io.input("/var/lib/noddos/DeviceProfiles.json")
- t = io.read("*all")
- temp = luci.jsonc.parse(t)
- devicevalues = {}
- for i, v in ipairs(temp) do
- devicevalues[v.DeviceProfileUuid] = v
- end
- end
- -%>
- <%+header%>
- <div class="cbi-map" id="cbi-network">
- <h2 name="content"><%:Clients%></h2>
- <div class="cbi-map-descr"><%:The following clients have been discovered on the network. The last discovery was completed at %><%=last_modified%></div>
- <fieldset class="cbi-section">
- <legend><%:Recognized Clients%></legend>
- <div class="cbi-section-node">
- <table class="cbi-section-table">
- <tr class="cbi-section-table-titles">
- <th class="cbi-section-table-cell"><%:Hostname%></th>
- <th class="cbi-section-table-cell"><%:IPv4%></th>
- <th class="cbi-section-table-cell"><%:MAC%></th>
- <th class="cbi-section-table-cell"><%:Manufacturer%></th>
- <th class="cbi-section-table-cell"><%:Model%></th>
- <th class="cbi-section-table-cell"><%:Class%></th>
- </tr>
- <%
- for i,v in ipairs(devdump) do
- if v.DeviceProfileUuid ~= "" then
- %>
- <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
- <td class="cbi-value-field"><%=v.Hostname%></td>
- <td class="cbi-value-field"><%=v.Ipv4Address%></td>
- <td class="cbi-value-field"><a href="/cgi-bin/clientdetails?mac=<%=v.MacAddress%>"><%=v.MacAddress%></a></td>
- <td class="cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].Manufacturer%></td>
- <td class="cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].Model%></td>
- <td class="cbi-value-field"><%=devicevalues[v.DeviceProfileUuid].ThingClass%></td>
- </tr>
- <%
- style=false
- end
- end
- %>
- </table>
- </div>
- </fieldset>
- <br />
- <fieldset class="cbi-section">
- <legend><%:Unrecognized Clients%></legend>
- <div class="cbi-section-node">
- <table class="cbi-section-table">
- <tr class="cbi-section-table-titles">
- <th class="cbi-section-table-cell"><%:Hostname%></th>
- <th class="cbi-section-table-cell"><%:IPv4%></th>
- <th class="cbi-section-table-cell"><%:MAC%></th>
- <th class="cbi-section-table-cell"><%:Manufacturer%></th>
- <th class="cbi-section-table-cell"><%:Model%></th>
- <th class="cbi-section-table-cell"><%:DhcpVendor%></th>
- <th class="cbi-section-table-cell"><%:DhcpHostname%></th>
- </tr>
- <%
- for i,v in ipairs(devdump) do
- if v.DeviceProfileUuid == "" then
- %>
- <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
- <td class="cbi-value-field"><%=v.Hostname%></td>
- <td class="cbi-value-field"><%=v.Ipv4Address%></td>
- <td class="cbi-value-field"><a href="/cgi-bin/clientdetails?mac=<%=v.MacAddress%>"><%=v.MacAddress%></a></td>
- <td class="cbi-value-field"><%=v.SsdpManufacturer%></td>
- <td class="cbi-value-field"><%=v.SsdpModelName%></td>
- <td class="cbi-value-field"><%=v.DhcpVendor1%></td>
- <td class="cbi-value-field"><%=v.DhcpHostname%></td>
- </tr>
- <%
- style=false
- end
- end
- %>
- </table>
- </div>
- </fieldset>
- </div>
- <%+footer%>
|