3 -- clientdetails.lua : Provides details about client devices discovered by Noddos
4 -- Copyright (C) 2017 Steven Hessing (steven.hessing@gmail.com)
5 -- This is free software, licensed under the GNU General Public License v3.
9 print ("Content-type: Text/html\n")
10 local info = os.getenv("QUERY_STRING")
15 function print_row(key)
23 for name, value in string.gmatch(info .. '&', '(.-)%=(.-)%&') do
24 value = string.gsub(value , '%+', ' ')
25 value = string.gsub(value , '%%(%x%x)', function(dpc)
26 return string.char(tonumber(dpc,16))
30 value = string.gsub(value, "%&", "&")
31 value = string.gsub(value, "%<", "<")
32 value = string.gsub(value, '%"', """)
39 if nixio.fs.access("/var/lib/noddos/DeviceDump.json") then
40 io.input("/var/lib/noddos/DeviceDump.json")
41 local t = io.read("*all")
42 local json = require "luci.jsonc"
43 local devdump = json.parse(t)
44 for i, v in ipairs(devdump) do
45 if v.MacAddress == params["mac"] then
49 io.input("/var/lib/noddos/DeviceProfiles.json")
51 local temp = json.parse(t)
52 for i, v in ipairs(temp) do
53 if device.DeviceProfileUuid == v.DeviceProfileUuid then
61 <title>Client Details by Noddos</title>
62 <meta charset="utf-8">
63 <!--[if lt IE 9]><script src="/luci-static/bootstrap/html5.js?v=git-17.100.70571-29fabe2"></script><![endif]-->
64 <meta name="viewport" content="initial-scale=1.0">
65 <link rel="stylesheet" href="/luci-static/bootstrap/cascade.css?v=git-17.100.70571-29fabe2">
66 <link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="/luci-static/bootstrap/mobile.css?v=git-17.100.70571-29fabe2" type="text/css" />
67 <link rel="shortcut icon" href="/luci-static/bootstrap/favicon.ico">
68 <script src="/luci-static/resources/xhr.js?v=git-17.100.70571-29fabe2"></script>
71 <h1>Client Details</h1>
75 if params["mac"] ~= nil then
77 for i, key in ipairs{"MacAddress", "Ipv4Address", "Ipv6Address", "DeviceProfileUuid", "DhcpHostname", "DhcpVendor", "SsdpFriendlyName", "SsdpLocation", "SsdpManufacturer", "SsdpModelName", "SsdpModelUrl", "SsdpSerialNumber", "SsdpServer","SsdpUserAgent", "MdnsDeviceUrl", "MdnsHw", "MdnsManufacturer", "MdnsModelName", "MdnsOs", "WsDiscoveryTypes", "WsDiscoveryXaddrs", "DnsQueries"} do
82 print ("no mac address specified")
87 <a href=http://www.noddos.io>Noddos</a>