Skip to content

Commit

Permalink
Reworked ASN URLs for hosts so that they not point to the new ASN rep…
Browse files Browse the repository at this point in the history
…ort page

git-svn-id: https://svn.ntop.org/svn/ntop/trunk/ntopng@8661 a02cd0c1-8e76-42e1-a119-56f9641475e2
  • Loading branch information
deri committed Dec 7, 2014
1 parent b74caa2 commit 93fb4c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/lua/get_as_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function print_single_as(value)
end
print('", ')

print("\"column_name\" : \""..value["name"])
print("\"column_name\" : \""..printASN(tonumber(value["id"]), value["name"]))
if((value["country"] ~= nil) and (value["country"] ~= "")) then
print("&nbsp;<img src='/img/blank.gif' class='flag flag-".. string.lower(value["country"]) .."'>")
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/lua/get_hosts_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ for _key, _value in pairsByKeys(vals, funct) do
if(value["asn"] == 0) then
print(", \"column_asn\" : 0")
else
print(", \"column_asn\" : \"" .. printASN(value["asn"], value["asname"]) .."\"")
print(", \"column_asn\" : \"<A HREF=" .. ntop.getHttpPrefix() .. "/lua/hosts_stats.lua?asn=".. value["asn"] ..">"..value["asname"].."</A>\"")
end
end

Expand Down
10 changes: 7 additions & 3 deletions scripts/lua/host_details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,14 @@ print [[
print("</th><td colspan=2>"..host["vlan"].."</td></tr>\n")
end
if(host["os"] ~= "") then print("<tr><th>OS</th><td colspan=2>" .. mapOS2Icon(host["os"]) .. " </td></tr>\n") end
if((host["asn"] ~= nil) and (host["asn"] > 0)) then print("<tr><th>ASN</th><td>".. printASN(host["asn"], host.asname) .. " [ " .. host.asname .. " ] </td>")
if((host["asn"] ~= nil) and (host["asn"] > 0)) then
print("<tr><th>ASN</th><td>")

print('<td><A HREF="http://itools.com/tool/arin-whois-domain-search?q='.. host["ip"] ..'&submit=Look+up">Whois Lookup</A> <i class="fa fa-external-link fa-lg"></i></td>')
print("</td></tr>\n") end

print("<A HREF=" .. ntop.getHttpPrefix() .. "/lua/hosts_stats.lua?asn=".. host.asn ..">"..host.asname.."</A> (ASN ".. host.asn..")</td>")
print('<td><A HREF="http://itools.com/tool/arin-whois-domain-search?q='.. host["ip"] ..'&submit=Look+up">Whois Lookup</A> <i class="fa fa-external-link fa-lg"></i></td>')
print("</td></tr>\n")
end

if((host["category"] ~= nil) and (host["category"] ~= "")) then
cat = getCategory(host["category"])
Expand Down
13 changes: 8 additions & 5 deletions scripts/lua/hosts_stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ print [[

if(protocol == nil) then protocol = "" end

if(_GET["asn"] ~= nil) then asn = " for AS ".._GET["asn"] else asn = "" end

if(mode == "all") then
print('title: "All '..protocol..' Hosts",\n')
print('title: "All '..protocol..' Hosts'..asn..'",\n')
elseif(mode == "local") then
print('title: "Local '..protocol..' Hosts",\n')
print('title: "Local '..protocol..' Hosts'..asn..'",\n')
elseif(mode == "remote") then
print('title: "Remote '..protocol..' Hosts",\n')
print('title: "Remote '..protocol..' Hosts'..asn..'",\n')
else
print('title: "Local Networks",\n')
print('title: "Local Networks'..asn..'",\n')
end
print ('rowCallback: function ( row ) { return host_table_setID(row); },')

Expand All @@ -97,7 +99,8 @@ print [[/lua/hosts_stats.lua?mode=local">Local Only</a></li><li><a href="]]
print (ntop.getHttpPrefix())
print [[/lua/hosts_stats.lua?mode=remote">Remote Only</a></li><li>&nbsp;</li><li><a href="]]
print (ntop.getHttpPrefix())
print [[/lua/hosts_stats.lua?mode=network">Local Networks</a></li></ul> </div>' ],
print [[/lua/hosts_stats.lua?mode=network">Local Networks</a></li></ul>]]
print [[</div>' ],
columns: [
{
title: "Key",
Expand Down
4 changes: 2 additions & 2 deletions scripts/lua/modules/lua_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ end

function printASN(asn, asname)
if(asn > 0) then
return("<A HREF='http://as.robtex.com/as"..asn..".html' title='"..asname.."'>"..asn.."</A> <i class='fa fa-external-link fa-lg'></i>")
return("<A HREF='http://as.robtex.com/as"..asn..".html' title='"..asname.."'>"..asname.."</A> <i class='fa fa-external-link fa-lg'></i>")
else
return("")
return(asname)
end
end

Expand Down

0 comments on commit 93fb4c1

Please sign in to comment.