mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Reduce a level of indirection in traceroute entries in NSE
This commit is contained in:
@@ -1905,7 +1905,7 @@ host.os = {
|
|||||||
This is an array of traceroute hops, present when the
|
This is an array of traceroute hops, present when the
|
||||||
<option>--traceroute</option> option was used. Each entry is a
|
<option>--traceroute</option> option was used. Each entry is a
|
||||||
host table with fields <literal>name</literal>,
|
host table with fields <literal>name</literal>,
|
||||||
<literal>ip</literal> and <literal>times.srtt</literal> (round
|
<literal>ip</literal> and <literal>srtt</literal> (round
|
||||||
trip time). The TTL for an entry is implicit given its position
|
trip time). The TTL for an entry is implicit given its position
|
||||||
in the table. An empty table represents a timed-out hop.
|
in the table. An empty table represents a timed-out hop.
|
||||||
</para>
|
</para>
|
||||||
|
|||||||
@@ -205,9 +205,7 @@ void set_hostinfo(lua_State *L, Target *currenths) {
|
|||||||
nseU_setsfield(L, -1, "ip", inet_ntop_ez(&it->addr, sizeof(it->addr)));
|
nseU_setsfield(L, -1, "ip", inet_ntop_ez(&it->addr, sizeof(it->addr)));
|
||||||
if (!it->name.empty())
|
if (!it->name.empty())
|
||||||
nseU_setsfield(L, -1, "name", it->name.c_str());
|
nseU_setsfield(L, -1, "name", it->name.c_str());
|
||||||
lua_newtable(L);
|
|
||||||
nseU_setnfield(L, -1, "srtt", it->rtt / 1000.0);
|
nseU_setnfield(L, -1, "srtt", it->rtt / 1000.0);
|
||||||
lua_setfield(L, -2, "times");
|
|
||||||
}
|
}
|
||||||
lua_rawseti(L, -2, lua_rawlen(L, -2)+1);
|
lua_rawseti(L, -2, lua_rawlen(L, -2)+1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ action = function(host)
|
|||||||
-- avoid timedout hops, marked as empty entries
|
-- avoid timedout hops, marked as empty entries
|
||||||
-- do not add the current scanned host.ip
|
-- do not add the current scanned host.ip
|
||||||
if hop.ip then
|
if hop.ip then
|
||||||
local rtt = tonumber(hop.times.srtt) * 1000
|
local rtt = tonumber(hop.srtt) * 1000
|
||||||
local geo
|
local geo
|
||||||
if not ipOps.isPrivate(hop.ip) then
|
if not ipOps.isPrivate(hop.ip) then
|
||||||
-- be sure not to cache the target address, since it's not likely to be
|
-- be sure not to cache the target address, since it's not likely to be
|
||||||
|
|||||||
Reference in New Issue
Block a user