mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Don't scan infinite random when no targets specified
This commit is contained in:
2
nmap.cc
2
nmap.cc
@@ -2094,7 +2094,7 @@ int nmap_main(int argc, char *argv[]) {
|
||||
if (o.ping_group_sz < o.minHostGroupSz())
|
||||
o.ping_group_sz = o.minHostGroupSz();
|
||||
HostGroupState hstate(o.ping_group_sz, o.randomize_hosts,
|
||||
o.generate_random_ips ? o.max_ips_to_scan : 0, argc, (const char **) argv);
|
||||
o.generate_random_ips, o.max_ips_to_scan, argc, (const char **) argv);
|
||||
|
||||
do {
|
||||
ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports);
|
||||
|
||||
@@ -285,7 +285,7 @@ bool target_needs_new_hostgroup(Target **targets, int targets_sz, const Target *
|
||||
The target_expressions array MUST REMAIN VALID IN MEMORY as long as
|
||||
this class instance is used -- the array is NOT copied.
|
||||
*/
|
||||
HostGroupState::HostGroupState(int lookahead, int rnd, unsigned long num_random, int argc, const char **argv) {
|
||||
HostGroupState::HostGroupState(int lookahead, int rnd, bool gen_rand, unsigned long num_random, int argc, const char **argv) {
|
||||
assert(lookahead > 0);
|
||||
this->argc = argc;
|
||||
this->argv = argv;
|
||||
@@ -296,7 +296,7 @@ HostGroupState::HostGroupState(int lookahead, int rnd, unsigned long num_random,
|
||||
current_batch_sz = 0;
|
||||
next_batch_no = 0;
|
||||
randomize = rnd;
|
||||
if (num_random >= 0) {
|
||||
if (gen_rand) {
|
||||
current_group.generate_random_ips(num_random);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
/* The maximum number of entries we want to allow storing in defer_buffer. */
|
||||
static const unsigned int DEFER_LIMIT = 64;
|
||||
|
||||
HostGroupState(int lookahead, int randomize, unsigned long num_random, int argc, const char *argv[]);
|
||||
HostGroupState(int lookahead, int randomize, bool gen_rand, unsigned long num_random, int argc, const char *argv[]);
|
||||
~HostGroupState();
|
||||
Target **hostbatch;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user