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

Let scripts set/preserve port.version.service_fp

Previously, calling nmap.set_port_version would delete a service
fingerprint if it existed. Now, setting probestate to anything but
"hardmatched" will preserve the fingerprint, if it exists. This allows
scripts (like http-server-header) to use "softmatched" to set version
info but still encourage users to submit fingerprints.
This commit is contained in:
dmiller
2014-09-20 05:40:43 +00:00
parent 0351db35b9
commit d50436def8

View File

@@ -572,6 +572,7 @@ static int l_set_port_version (lua_State *L)
*hostname = (lua_getfield(L, 4, "hostname"), lua_tostring(L, -1)),
*ostype = (lua_getfield(L, 4, "ostype"), lua_tostring(L, -1)),
*devicetype = (lua_getfield(L, 4, "devicetype"), lua_tostring(L, -1)),
*service_fp = (lua_getfield(L, 4, "service_fp"), lua_tostring(L, -1)),
*service_tunnel = (lua_getfield(L, 4, "service_tunnel"),
lua_tostring(L, -1));
if (service_tunnel == NULL || strcmp(service_tunnel, "none") == 0)
@@ -594,7 +595,8 @@ static int l_set_port_version (lua_State *L)
target->ports.setServiceProbeResults(p->portno, p->proto,
probestate, name, tunnel, product,
version, extrainfo, hostname, ostype, devicetype,
(cpe.size() > 0) ? &cpe : NULL, NULL);
(cpe.size() > 0) ? &cpe : NULL,
probestate==PROBESTATE_FINISHED_HARDMATCHED ? NULL : service_fp);
return 0;
}