mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Removed the log-errors option from the code, by treating it as if it was always true. This was done for the action item of o Remove Nmap's --log-errors feature and make its behavior the default. I also updated the docs/refguide.xml to reflect this change. I have not yet compiled the Dockbook.xml however.
This commit is contained in:
@@ -316,7 +316,6 @@ void NmapOps::Initialize() {
|
|||||||
xsl_stylesheet = NULL;
|
xsl_stylesheet = NULL;
|
||||||
spoof_mac_set = false;
|
spoof_mac_set = false;
|
||||||
mass_dns = true;
|
mass_dns = true;
|
||||||
log_errors = false;
|
|
||||||
deprecated_xml_osclass = false;
|
deprecated_xml_osclass = false;
|
||||||
resolve_all = 0;
|
resolve_all = 0;
|
||||||
dns_servers = NULL;
|
dns_servers = NULL;
|
||||||
|
|||||||
@@ -321,8 +321,7 @@ class NmapOps {
|
|||||||
int resolve_all;
|
int resolve_all;
|
||||||
char *dns_servers;
|
char *dns_servers;
|
||||||
|
|
||||||
// Logging options
|
|
||||||
bool log_errors;
|
|
||||||
// If true, write <os><osclass/><osmatch/></os> as in xmloutputversion 1.03
|
// If true, write <os><osclass/><osmatch/></os> as in xmloutputversion 1.03
|
||||||
// rather than <os><osmatch><osclass/></osmatch></os> as in 1.04 and later.
|
// rather than <os><osmatch><osclass/></osmatch></os> as in 1.04 and later.
|
||||||
bool deprecated_xml_osclass;
|
bool deprecated_xml_osclass;
|
||||||
|
|||||||
@@ -3873,35 +3873,6 @@ hosts with at least one
|
|||||||
device mischaracterization (such as Nmap treating a PPP
|
device mischaracterization (such as Nmap treating a PPP
|
||||||
connection as ethernet).</para> </listitem> </varlistentry>
|
connection as ethernet).</para> </listitem> </varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<option>--log-errors</option> (Log errors/warnings to normal mode output file)
|
|
||||||
<indexterm significance="preferred"><primary><option>--log-errors</option></primary></indexterm>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
|
|
||||||
<para>Warnings and errors printed by Nmap usually go only to
|
|
||||||
the screen (interactive output), leaving any normal-format
|
|
||||||
output files (usually specified with <option>-oN</option>)
|
|
||||||
uncluttered. When you do want to see those messages in the
|
|
||||||
normal output file you specified, add this option. It is
|
|
||||||
useful when you aren't watching the interactive output or
|
|
||||||
when you want to record errors while debugging a problem.
|
|
||||||
The error and warning messages will still appear in
|
|
||||||
interactive mode too. This won't work for most errors
|
|
||||||
related to bad command-line arguments because Nmap may not
|
|
||||||
have initialized its output files yet. In addition, some
|
|
||||||
Nmap error and warning messages use a different system which
|
|
||||||
does not yet support this option.</para>
|
|
||||||
|
|
||||||
<para>An alternative to <option>--log-errors</option> is
|
|
||||||
redirecting interactive output (including the standard error
|
|
||||||
stream) to a file. Most Unix shells make this
|
|
||||||
approach easy, though it can be difficult on Windows.</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<variablelist><title>Miscellaneous output options</title>
|
<variablelist><title>Miscellaneous output options</title>
|
||||||
|
|||||||
1
nmap.cc
1
nmap.cc
@@ -847,7 +847,6 @@ void parse_options(int argc, char **argv) {
|
|||||||
} else if (optcmp(long_options[option_index].name, "dns-servers") == 0) {
|
} else if (optcmp(long_options[option_index].name, "dns-servers") == 0) {
|
||||||
o.dns_servers = strdup(optarg);
|
o.dns_servers = strdup(optarg);
|
||||||
} else if (optcmp(long_options[option_index].name, "log-errors") == 0) {
|
} else if (optcmp(long_options[option_index].name, "log-errors") == 0) {
|
||||||
o.log_errors = 1;
|
|
||||||
} else if (optcmp(long_options[option_index].name, "deprecated-xml-osclass") == 0) {
|
} else if (optcmp(long_options[option_index].name, "deprecated-xml-osclass") == 0) {
|
||||||
o.deprecated_xml_osclass = true;
|
o.deprecated_xml_osclass = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "webxml") == 0) {
|
} else if (strcmp(long_options[option_index].name, "webxml") == 0) {
|
||||||
|
|||||||
@@ -115,12 +115,11 @@ void fatal(const char *fmt, ...) {
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_STDERR, fmt, ap);
|
log_vwrite(LOG_STDERR, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (o.log_errors) {
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_NORMAL, fmt, ap);
|
log_vwrite(LOG_NORMAL, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
|
||||||
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "\nQUITTING!\n");
|
log_write(LOG_NORMAL|LOG_STDERR, "\nQUITTING!\n");
|
||||||
|
|
||||||
if (xml_tag_open())
|
if (xml_tag_open())
|
||||||
xml_close_start_tag();
|
xml_close_start_tag();
|
||||||
@@ -163,13 +162,10 @@ void error(const char *fmt, ...) {
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_STDERR, fmt, ap);
|
log_vwrite(LOG_STDERR, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (o.log_errors) {
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_NORMAL, fmt, ap);
|
log_vwrite(LOG_NORMAL, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
log_write(LOG_NORMAL|LOG_STDERR , "\n");
|
||||||
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +193,7 @@ void pfatal(const char *fmt, ...) {
|
|||||||
Vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
Vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, "%s: %s (%d)\n",
|
log_write(LOG_NORMAL|LOG_STDERR, "%s: %s (%d)\n",
|
||||||
errbuf, strerror_s, error_number);
|
errbuf, strerror_s, error_number);
|
||||||
|
|
||||||
if (xml_tag_open())
|
if (xml_tag_open())
|
||||||
@@ -230,7 +226,7 @@ void pfatal(const char *fmt, ...) {
|
|||||||
HeapFree(GetProcessHeap(), 0, strerror_s);
|
HeapFree(GetProcessHeap(), 0, strerror_s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (o.log_errors) log_flush(LOG_NORMAL);
|
log_flush(LOG_NORMAL);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -255,19 +251,17 @@ void gh_perror(const char *fmt, ...) {
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_STDERR, fmt, ap);
|
log_vwrite(LOG_STDERR, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (o.log_errors) {
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
log_vwrite(LOG_NORMAL, fmt, ap);
|
log_vwrite(LOG_NORMAL, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
log_write(LOG_NORMAL|LOG_STDERR, ": %s (%d)\n",
|
||||||
log_write(o.log_errors? LOG_NORMAL|LOG_STDERR : LOG_STDERR, ": %s (%d)\n",
|
|
||||||
strerror_s, error_number);
|
strerror_s, error_number);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HeapFree(GetProcessHeap(), 0, strerror_s);
|
HeapFree(GetProcessHeap(), 0, strerror_s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (o.log_errors) log_flush(LOG_NORMAL);
|
log_flush(LOG_NORMAL);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user