mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +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())
|
if (o.ping_group_sz < o.minHostGroupSz())
|
||||||
o.ping_group_sz = o.minHostGroupSz();
|
o.ping_group_sz = o.minHostGroupSz();
|
||||||
HostGroupState hstate(o.ping_group_sz, o.randomize_hosts,
|
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 {
|
do {
|
||||||
ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports);
|
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
|
The target_expressions array MUST REMAIN VALID IN MEMORY as long as
|
||||||
this class instance is used -- the array is NOT copied.
|
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);
|
assert(lookahead > 0);
|
||||||
this->argc = argc;
|
this->argc = argc;
|
||||||
this->argv = argv;
|
this->argv = argv;
|
||||||
@@ -296,7 +296,7 @@ HostGroupState::HostGroupState(int lookahead, int rnd, unsigned long num_random,
|
|||||||
current_batch_sz = 0;
|
current_batch_sz = 0;
|
||||||
next_batch_no = 0;
|
next_batch_no = 0;
|
||||||
randomize = rnd;
|
randomize = rnd;
|
||||||
if (num_random >= 0) {
|
if (gen_rand) {
|
||||||
current_group.generate_random_ips(num_random);
|
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. */
|
/* The maximum number of entries we want to allow storing in defer_buffer. */
|
||||||
static const unsigned int DEFER_LIMIT = 64;
|
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();
|
~HostGroupState();
|
||||||
Target **hostbatch;
|
Target **hostbatch;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user