mirror of
https://github.com/nmap/nmap.git
synced 2026-02-06 13:36:36 +00:00
Use targetname, the forward DNS name, in Target::NameIP if it is
available, in preference to hostname, the reverse DNS name. NameIP is used to represent the host in output messages.
This commit is contained in:
@@ -325,9 +325,12 @@ void Target::setTargetName(char *name) {
|
||||
const char *Target::NameIP(char *buf, size_t buflen) {
|
||||
assert(buf);
|
||||
assert(buflen > 8);
|
||||
if (hostname) {
|
||||
if (targetname)
|
||||
Snprintf(buf, buflen, "%s (%s)", targetname, targetipstring);
|
||||
else if (hostname)
|
||||
Snprintf(buf, buflen, "%s (%s)", hostname, targetipstring);
|
||||
} else Strncpy(buf, targetipstring, buflen);
|
||||
else
|
||||
Strncpy(buf, targetipstring, buflen);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user