1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Prints a friendly error message when --resume is used with other options. Fixes #84

This commit is contained in:
paulino
2015-04-16 16:20:18 +00:00
parent 7ebabd4dbe
commit 80a14ef0f6

23
main.cc
View File

@@ -175,6 +175,7 @@ int main(int argc, char *argv[]) {
char *cptr; char *cptr;
int ret; int ret;
int i; int i;
int resume;
set_program_name(argv[0]); set_program_name(argv[0]);
@@ -216,14 +217,22 @@ int main(int argc, char *argv[]) {
return ret; return ret;
} }
if (argc == 3 && strcmp("--resume", argv[1]) == 0) { /* Don't allow users to use --resume with other options */
/* OK, they want to resume an aborted scan given the log file specified. for (i=0; i<argc; i++) {
Lets gather our state from the log file */ if ( strcmp("--resume", argv[i]) == 0) {
if (gather_logfile_resumption_state(argv[2], &myargc, &myargv) == -1) { resume = 1;
fatal("Cannot resume from (supposed) log file %s", argv[2]); if(argc!=3) {
fatal("Cannot use --resume with other options. Usage: nmap --resume <filename>");
}
if (gather_logfile_resumption_state(argv[i+1], &myargc, &myargv) == -1) {
fatal("Cannot resume from (supposed) log file %s", argv[i+1]);
}
} }
return nmap_main(myargc, myargv);
} }
return nmap_main(argc, argv); if (resume == 1) {
return nmap_main(myargc, myargv);
} else {
return nmap_main(argc, argv);
}
} }