mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Treat a service named "unknown" as if it were not named in nmap-services for
purposes of output. What this means is that the port name will not be "unknown?" or "ssl/unknown?" if version detection failed to find a match, but simply "unknown" or "ssl/unknown".
This commit is contained in:
@@ -4,7 +4,7 @@ o Version detection used to omit the "ssl/" service name prefix if an
|
|||||||
SSL-tunneled port didn't respond to any version probes. Now it keeps
|
SSL-tunneled port didn't respond to any version probes. Now it keeps
|
||||||
"ssl/" as an indication that SSL was discovered, even if the service
|
"ssl/" as an indication that SSL was discovered, even if the service
|
||||||
behind it wasn't identified. Kristof Boeynaems reported the problem
|
behind it wasn't identified. Kristof Boeynaems reported the problem
|
||||||
and contributed a patch.
|
and contributed a patch. [David]
|
||||||
|
|
||||||
o [Ncat] The --talk option has been renamed --chat. --talk remains as an
|
o [Ncat] The --talk option has been renamed --chat. --talk remains as an
|
||||||
undocumented alias.
|
undocumented alias.
|
||||||
|
|||||||
39
output.cc
39
output.cc
@@ -455,36 +455,25 @@ int print_iflist(void) {
|
|||||||
namebuf to 0 length if there is no room.*/
|
namebuf to 0 length if there is no room.*/
|
||||||
static void getNmapServiceName(struct serviceDeductions *sd, int state,
|
static void getNmapServiceName(struct serviceDeductions *sd, int state,
|
||||||
char *namebuf, int buflen) {
|
char *namebuf, int buflen) {
|
||||||
char *dst = namebuf;
|
const char *tunnel_prefix;
|
||||||
int lenremaining = buflen;
|
|
||||||
int len;
|
int len;
|
||||||
if (buflen < 1) return;
|
|
||||||
|
|
||||||
if (sd->service_tunnel == SERVICE_TUNNEL_SSL) {
|
if (sd->service_tunnel == SERVICE_TUNNEL_SSL)
|
||||||
if (lenremaining < 5) goto overflow;
|
tunnel_prefix = "ssl/";
|
||||||
strncpy(dst, "ssl/", lenremaining);
|
else
|
||||||
dst += 4;
|
tunnel_prefix = "";
|
||||||
lenremaining -= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sd->name && (sd->service_tunnel != SERVICE_TUNNEL_SSL ||
|
if (sd->name != NULL && strcmp(sd->name, "unknown") != 0) {
|
||||||
sd->dtype == SERVICE_DETECTION_PROBED)) {
|
/* The port has a name and the name is not "unknown". How confident are we? */
|
||||||
if (o.servicescan && state == PORT_OPEN && sd->name_confidence <= 5)
|
if (o.servicescan && state == PORT_OPEN && sd->name_confidence <= 5)
|
||||||
len = Snprintf(dst, lenremaining, "%s?", sd->name);
|
len = Snprintf(namebuf, buflen, "%s%s?", tunnel_prefix, sd->name);
|
||||||
else len = Snprintf(dst, lenremaining, "%s", sd->name);
|
else
|
||||||
|
len = Snprintf(namebuf, buflen, "%s%s", tunnel_prefix, sd->name);
|
||||||
} else {
|
} else {
|
||||||
len = Snprintf(dst, lenremaining, "%s", "unknown");
|
len = Snprintf(namebuf, buflen, "%sunknown", tunnel_prefix);
|
||||||
}
|
}
|
||||||
if (len > lenremaining || len < 0) goto overflow;
|
if (len >= buflen || len < 0)
|
||||||
dst += len;
|
namebuf[0] = '\0';
|
||||||
lenremaining -= len;
|
|
||||||
|
|
||||||
if (lenremaining < 1) goto overflow;
|
|
||||||
*dst = '\0';
|
|
||||||
return;
|
|
||||||
|
|
||||||
overflow:
|
|
||||||
*namebuf = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
|
|||||||
Reference in New Issue
Block a user