1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 05:01:29 +00:00

Changed a few error() calls to log_write(). Removed the (redundant)

"\n" from a few error() calls.  Changed a few f?printf() calls to
error() or log_write().

Most notably, I didn't change any of the --interactive printf()s or
the usage printf() call.

I think we should draw up some internal notes on when to use
LOG_STDOUT versus LOG_PLAIN versus all the other LOG_* options.
This commit is contained in:
bmenrigh
2009-04-07 23:10:51 +00:00
parent ae9def6d85
commit b38b5f6270
3 changed files with 9 additions and 9 deletions

View File

@@ -152,7 +152,7 @@ int main(int argc, char *argv[]) {
#ifdef __amigaos__ #ifdef __amigaos__
if(!OpenLibs()) { if(!OpenLibs()) {
printf("Couldn't open TCP/IP Stack Library(s)!\n"); error("Couldn't open TCP/IP Stack Library(s)!");
exit(20); exit(20);
} }
MiamiBPFInit((struct Library *)MiamiBase, (struct Library *)SocketBase); MiamiBPFInit((struct Library *)MiamiBase, (struct Library *)SocketBase);

14
nmap.cc
View File

@@ -875,7 +875,7 @@ int nmap_main(int argc, char *argv[]) {
Snprintf(buf, sizeof(buf), "%s.xml", logfilename(optarg, tm)); Snprintf(buf, sizeof(buf), "%s.xml", logfilename(optarg, tm));
xmlfilename = strdup(buf); xmlfilename = strdup(buf);
} else if (strcmp(long_options[option_index].name, "thc") == 0) { } else if (strcmp(long_options[option_index].name, "thc") == 0) {
printf("!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n"); log_write(LOG_STDOUT, "!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n");
exit(0); exit(0);
} else if (strcmp(long_options[option_index].name, "badsum") == 0) { } else if (strcmp(long_options[option_index].name, "badsum") == 0) {
o.badsum = 1; o.badsum = 1;
@@ -1022,7 +1022,7 @@ int nmap_main(int argc, char *argv[]) {
case 'h': printusage(argv[0], 0); break; case 'h': printusage(argv[0], 0); break;
case '?': printusage(argv[0], -1); break; case '?': printusage(argv[0], -1); break;
case 'I': case 'I':
printf("WARNING: identscan (-I) no longer supported. Ignoring -I\n"); error("WARNING: identscan (-I) no longer supported. Ignoring -I");
break; break;
// o.identscan++; break; // o.identscan++; break;
case 'i': case 'i':
@@ -1226,7 +1226,7 @@ int nmap_main(int argc, char *argv[]) {
} }
break; break;
case 'V': case 'V':
printf("\n%s version %s ( %s )\n", NMAP_NAME, NMAP_VERSION, NMAP_URL); log_write(LOG_STDOUT, "\n%s version %s ( %s )\n", NMAP_NAME, NMAP_VERSION, NMAP_URL);
exit(0); exit(0);
break; break;
case 'v': o.verbose++; break; case 'v': o.verbose++; break;
@@ -1317,12 +1317,12 @@ int nmap_main(int argc, char *argv[]) {
} }
if(o.traceroute && (o.idlescan || o.connectscan)) { if(o.traceroute && (o.idlescan || o.connectscan)) {
error("Warning: Traceroute does not support idle or connect scan, disabling...\n"); error("Warning: Traceroute does not support idle or connect scan, disabling...");
o.traceroute = 0; o.traceroute = 0;
} }
if(o.traceroute && !o.isr00t) { if(o.traceroute && !o.isr00t) {
error("Warning: Traceroute has to be run as root, disabling...\n"); error("Warning: Traceroute has to be run as root, disabling...");
o.traceroute = 0; o.traceroute = 0;
} }
@@ -1350,7 +1350,7 @@ int nmap_main(int argc, char *argv[]) {
#ifdef WIN32 #ifdef WIN32
if (o.sendpref & PACKET_SEND_IP) { if (o.sendpref & PACKET_SEND_IP) {
error("WARNING: raw IP (rather than raw ethernet) packet sending attempted on Windows. This probably won't work. Consider --send-eth next time.\n"); error("WARNING: raw IP (rather than raw ethernet) packet sending attempted on Windows. This probably won't work. Consider --send-eth next time.");
} }
#endif #endif
if (spoofmac) { if (spoofmac) {
@@ -2812,7 +2812,7 @@ int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file) {
} }
if (foundsomething && o.debugging > 1) if (foundsomething && o.debugging > 1)
error("Fetchfile found %s", filename_returned); log_write(LOG_PLAIN, "Fetchfile found %s", filename_returned);
return foundsomething; return foundsomething;

View File

@@ -678,7 +678,7 @@ Traceroute::trace (vector < Target * >&Targets) {
u16 total_size, total_complete; u16 total_size, total_complete;
if (o.af () == AF_INET6) { if (o.af () == AF_INET6) {
error ("Traceroute does not support ipv6\n"); error("Traceroute does not support ipv6");
return; return;
} }