mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Provide raw OS fingerprint to scripts. See #223
This commit is contained in:
@@ -1912,6 +1912,17 @@ host.os = {
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</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>
|
<varlistentry>
|
||||||
<term><option>port</option>
|
<term><option>port</option>
|
||||||
</term>
|
</term>
|
||||||
|
|||||||
@@ -220,19 +220,25 @@ void set_hostinfo(lua_State *L, Target *currenths) {
|
|||||||
* result, we will use it in the scripts
|
* result, we will use it in the scripts
|
||||||
* matches which aren't perfect are not needed in the scripts
|
* matches which aren't perfect are not needed in the scripts
|
||||||
*/
|
*/
|
||||||
if (currenths->osscanPerformed() && FPR != NULL &&
|
if (currenths->osscanPerformed() && FPR != NULL) {
|
||||||
FPR->overall_results == OSSCAN_SUCCESS && FPR->num_perfect_matches > 0 &&
|
/* Set os_fp to the raw fingerprint. isGoodFP = false because we don't want
|
||||||
FPR->num_perfect_matches <= 8 )
|
* submissions this way, but we could change this in the future (if we want
|
||||||
{
|
* submissions directly from NSE scripts, for instance)
|
||||||
int i;
|
*/
|
||||||
const OS_Classification_Results *OSR = FPR->getOSClassification();
|
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;
|
||||||
|
const OS_Classification_Results *OSR = FPR->getOSClassification();
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (i = 0; i < FPR->num_perfect_matches; i++) {
|
for (i = 0; i < FPR->num_perfect_matches; i++) {
|
||||||
push_osmatch_table(L, FPR->matches[i], OSR);
|
push_osmatch_table(L, FPR->matches[i], OSR);
|
||||||
lua_rawseti(L, -2, i + 1);
|
lua_rawseti(L, -2, i + 1);
|
||||||
|
}
|
||||||
|
lua_setfield(L, -2, "os");
|
||||||
}
|
}
|
||||||
lua_setfield(L, -2, "os");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user