1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Provide raw OS fingerprint to scripts. See #223

This commit is contained in:
dmiller
2017-12-10 01:06:34 +00:00
parent e0042ac7e3
commit 42fc53fbbf
2 changed files with 28 additions and 11 deletions

View File

@@ -1912,6 +1912,17 @@ host.os = {
</listitem>
</varlistentry>
<varlistentry>
<term><option>host.os_fp</option>
</term>
<listitem>
<para>If OS detection was performed, this is a string containing the OS
fingerprint for the host. The format is described in
<xref linkend="osdetect-fingerprint-format"/>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>port</option>
</term>

View File

@@ -220,8 +220,13 @@ void set_hostinfo(lua_State *L, Target *currenths) {
* result, we will use it in the scripts
* matches which aren't perfect are not needed in the scripts
*/
if (currenths->osscanPerformed() && FPR != NULL &&
FPR->overall_results == OSSCAN_SUCCESS && FPR->num_perfect_matches > 0 &&
if (currenths->osscanPerformed() && FPR != NULL) {
/* Set os_fp to the raw fingerprint. isGoodFP = false because we don't want
* submissions this way, but we could change this in the future (if we want
* submissions directly from NSE scripts, for instance)
*/
nseU_setsfield(L, -1, "os_fp", (const char *) FPR->merge_fpr(currenths, false, false));
if (FPR->overall_results == OSSCAN_SUCCESS && FPR->num_perfect_matches > 0 &&
FPR->num_perfect_matches <= 8 )
{
int i;
@@ -234,6 +239,7 @@ void set_hostinfo(lua_State *L, Target *currenths) {
}
lua_setfield(L, -2, "os");
}
}
}
static int l_clock_ms (lua_State *L)