1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

o [NSE] Host tables now have a host.traceroute member when --traceroute

is used. This array contains the IP address, reverse DNS name, and RTT
  for each traceroute hop. [Henri Doreau]
This commit is contained in:
david
2010-08-28 15:50:10 +00:00
parent 2dedb261d9
commit b2350aa947
3 changed files with 45 additions and 0 deletions

View File

@@ -154,6 +154,32 @@ void set_hostinfo(lua_State *L, Target *currenths) {
FingerPrintResults *FPR = currenths->FPR;
/* add distance (in hops) if traceroute has been performed */
if (currenths->traceroute_hops.size() > 0)
{
std::list<TracerouteHop>::iterator it;
int i = 1;
lua_newtable(L);
for (it = currenths->traceroute_hops.begin(); it != currenths->traceroute_hops.end(); it++)
{
lua_pushinteger(L, i++);
lua_newtable(L);
/* fill the table if the hop has not timed out, otherwise an empty table
* is inserted */
if (!it->timedout) {
setsfield(L, -1, "ip", inet_ntop_ez(&it->addr, sizeof(it->addr)));
if (!it->name.empty())
setsfield(L, -1, "name", it->name.c_str());
lua_newtable(L);
setnfield(L, -1, "srtt", it->rtt / 1000.0);
lua_setfield(L, -2, "times");
}
lua_settable(L, -3);
}
lua_setfield(L, -2, "traceroute");
}
/* if there has been an os scan which returned a pretty certain
* result, we will use it in the scripts
* matches which aren't perfect are not needed in the scripts