From e39d3e410199e4dae03f940c4e5bf7c306c85792 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 20 Oct 2015 17:48:56 +0000 Subject: [PATCH] Fix deprecation warning on -iL by not coercing it to -i, the actual deprecated option --- nmap.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nmap.cc b/nmap.cc index 2d87aea7c..b4851732f 100644 --- a/nmap.cc +++ b/nmap.cc @@ -599,7 +599,7 @@ void parse_options(int argc, char **argv) { {"oS", required_argument, 0, 0}, {"oH", required_argument, 0, 0}, {"oX", required_argument, 0, 0}, - {"iL", required_argument, 0, 'i'}, + {"iL", required_argument, 0, 0}, {"iR", required_argument, 0, 0}, {"sI", required_argument, 0, 0}, {"source_port", required_argument, 0, 'g'}, @@ -942,6 +942,18 @@ void parse_options(int argc, char **argv) { exit(0); } else if (strcmp(long_options[option_index].name, "badsum") == 0) { o.badsum = 1; + } else if (strcmp(long_options[option_index].name, "iL") == 0) { + if (o.inputfd) { + fatal("Only one input filename allowed"); + } + if (!strcmp(optarg, "-")) { + o.inputfd = stdin; + } else { + o.inputfd = fopen(optarg, "r"); + if (!o.inputfd) { + fatal("Failed to open input file %s for reading", optarg); + } + } } else if (strcmp(long_options[option_index].name, "iR") == 0) { o.generate_random_ips = 1; o.max_ips_to_scan = strtoul(optarg, &endptr, 10);