mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Prints a friendly error message when --resume is used with other options. Fixes #84
This commit is contained in:
23
main.cc
23
main.cc
@@ -175,6 +175,7 @@ int main(int argc, char *argv[]) {
|
||||
char *cptr;
|
||||
int ret;
|
||||
int i;
|
||||
int resume;
|
||||
|
||||
set_program_name(argv[0]);
|
||||
|
||||
@@ -216,14 +217,22 @@ int main(int argc, char *argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (argc == 3 && strcmp("--resume", argv[1]) == 0) {
|
||||
/* OK, they want to resume an aborted scan given the log file specified.
|
||||
Lets gather our state from the log file */
|
||||
if (gather_logfile_resumption_state(argv[2], &myargc, &myargv) == -1) {
|
||||
fatal("Cannot resume from (supposed) log file %s", argv[2]);
|
||||
/* Don't allow users to use --resume with other options */
|
||||
for (i=0; i<argc; i++) {
|
||||
if ( strcmp("--resume", argv[i]) == 0) {
|
||||
resume = 1;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user