1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-30 10:09:03 +00:00

This commit adds a new routine to nbase_rnd.c that generates 32bit

numbers in a collision-free way for a full 2^32 cycle.  This allows
Nmap to generate random IPs with -iR that don't have duplicates.

See:
http://seclists.org/nmap-dev/2009/q3/0695.html

How this is done is documented in the code.
This commit is contained in:
bmenrigh
2009-09-02 02:03:22 +00:00
parent e88a1d2b83
commit 3bce03ad8d

View File

@@ -425,7 +425,7 @@ static char *grab_next_host_spec(FILE *inputfd, int argc, char **fakeargv) {
if (o.generate_random_ips) {
do {
ip.s_addr = get_random_u32();
ip.s_addr = get_random_unique_u32();
} while (ip_is_reserved(&ip));
Strncpy(host_spec, inet_ntoa(ip), sizeof(host_spec));
} else if (!inputfd) {