1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-20 05:09:02 +00:00

Smooth out random starting timing offsets in OS scan.

Previously it was taking a random u8 mod 100, which meant that the
numbers 0-55 were 50% more likely to come up than any others. Make it a
u16 instead, so that the numbers 0-35 are only about 0.15% more likely.
This commit is contained in:
david
2012-03-16 20:02:53 +00:00
parent 7d34d8c529
commit f0dcb3c2ce

View File

@@ -1901,7 +1901,7 @@ int FPHost6::schedule() {
if (o.debugging > 3)
log_write(LOG_PLAIN, "[%s] Slots granted!\n", this->target_host->targetipstr());
this->timedprobes_sent = true;
int whentostart = get_random_u8()%100;
int whentostart = get_random_u16()%100;
for (size_t i = 0; i < this->timed_probes; i++) {
this->netctl->scheduleProbe(&(this->fp_probes[i]), whentostart + i*100);
this->probes_sent++;
@@ -2125,7 +2125,7 @@ int FPHost6::schedule() {
/* Finally do the actual retransmission. Like the first time,
* we schedule them 100ms apart, starting at same random point
* between right now and 99ms. */
int whentostart = get_random_u8()%100;
int whentostart = get_random_u16()%100;
for (size_t l = 0; l < this->timed_probes; l++) {
this->fp_probes[l].incrementRetransmissions();
this->fp_probes[l].resetTimeSent();