1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31:31 +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

@@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
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]
o [NSE] Made the ftp-anon script return a directory listing when
anonymous login is allowed. [Gutek, David]

View File

@@ -1551,6 +1551,21 @@ LUALIB_API int luaopen_openssl(lua_State *L) {
</listitem>
</varlistentry>
<varlistentry>
<term><option>host.traceroute</option>
</term>
<listitem>
<para>
This is an array of traceroute hops, present when the
<option>--traceroute</option> option was used. Each entry is a
host table with fields <literal>name</literal>,
<literal>ip</literal> and <literal>times.srtt</literal> (round
trip time). The TTL for an entry is implicit given its position
in the table. An empty table represents a timed-out hop.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>port</option>
</term>

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