-- -- (C) 2013-20 - ntop.org -- require "flow_utils" local lua_utils = require "lua_utils" print('') print ('

' .. i18n("service_map") .. "

") if(_GET["host"] ~= nil) then print('  ') end local p1 = interface.serviceMapLearningStatus() local p = interface.serviceMap() or {} local host_ip = _GET["host"] -- -- Draw service map -- local nodes = {} local nodes_id = {} local proto_number = {} local num_services = 0 -- tprint(iec) for k,v in pairs(p) do local key = "" if((host_ip == nil) or (v.client == host_ip) or (v.server == host_ip) ) then num_services = num_services + 1 nodes[v["client"]] = true nodes[v["server"]] = true if v["client"] > v["server"] then key = v["client"] .. "," .. v["server"] if proto_number[key] == nil then proto_number[key] = { 1, false , v["client"], v["server"], v.l7_proto} -- { num_recurrencies, bidirection true | monodirectional false, client_ip, server_ip, l7_proto} else proto_number[key][1] = proto_number[key][1] + 1 -- Don't show more then 3 l7 protocols if proto_number[key][1] <= 3 then proto_number[key][5] = proto_number[key][5] .. ", " .. v.l7_proto end -- Checking direction of the service, false monodirectional and true bidirectional if v["server"] ~= proto_number[key][4] then proto_number[key][2] = true end end else key = v["server"] .. "," .. v["client"] if proto_number[key] == nil then proto_number[key] = { 1, false , v["client"], v["server"], v.l7_proto} -- { num_recurrencies, bidirection true | monodirectional false, client_ip, server_ip, l7_proto} else proto_number[key][1] = proto_number[key][1] + 1 -- Don't show more then 3 l7 protocols if proto_number[key][1] <= 3 then proto_number[key][5] = proto_number[key][5] .. ", " .. v.l7_proto end -- Checking direction of the service, false monodirectional and true bidirectional if v["server"] ~= proto_number[key][4] then proto_number[key][2] = true end end end end end if num_services > 0 then print [[

]] end -- -- End service map draw -- print [[

]] print(i18n("protocol")) print [[ ]] print(i18n("client")) print [[ ]] print(i18n("server")) print [[ ]] print(i18n("vlan_id")) print [[ ]] print(i18n("port")) print [[ ]] print(i18n("num_uses")) print [[ ]] print(i18n("last_seen")) print [[ ]] print(i18n("info")) print [[ ]] print(i18n("service_acceptance")) print [[
]] if(isAdministrator()) then if(_GET["action"] == "reset") then interface.flushServiceMap() end if(ifid ~= nil) then print [[
 
]] end end print [[ ]]