1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Adding back my '-D rnd' from soc07 which I guess was lost in the move back here to /nmap

This commit is contained in:
kris
2007-08-28 01:04:41 +00:00
parent 433917fc46
commit 69e1ad6a70
2 changed files with 22 additions and 1 deletions

View File

@@ -2525,7 +2525,9 @@ lists the relevant options and describes what they do.</para>
common port scan detectors (such as Solar Designer's
excellent scanlogd) are unlikely to show your IP address at
all. If you don't use <literal>ME</literal>, nmap will put
you in a random position.</para> <para>Note that the hosts
you in a random position. You can also use RND to generate
a random, non-reserved IP address, or RND:&lt;number&gt; to
generate &lt;number&gt; addresses.</para> <para>Note that the hosts
you use as decoys should be up or you might accidentally SYN
flood your targets. Also it will be pretty easy to determine
which host is scanning if only one is actually up on the

19
nmap.cc
View File

@@ -918,6 +918,25 @@ int nmap_main(int argc, char *argv[]) {
if (o.decoyturn != -1)
fatal("Can only use 'ME' as a decoy once.\n");
o.decoyturn = o.numdecoys++;
} else if (!strcasecmp(p, "rnd") || !strncasecmp(p, "rnd:", 4)) {
int i = 1;
/* 'rnd:' is allowed and just gives them one */
if (strlen(p) > 4)
i = atoi(&p[4]);
if (i < 1)
fatal("Bad 'rnd' decoy \"%s\"", p);
if (o.numdecoys + i >= MAX_DECOYS - 1)
fatal("You are only allowed %d decoys (if you need more redefine MAX_DECOYS in nmap.h)", MAX_DECOYS);
while (i--) {
do {
o.decoys[o.numdecoys].s_addr = get_random_u32();
} while (ip_is_reserved(&o.decoys[o.numdecoys]));
o.numdecoys++;
}
} else {
if (o.numdecoys >= MAX_DECOYS -1)
fatal("You are only allowed %d decoys (if you need more redefine MAX_DECOYS in nmap.h)", MAX_DECOYS);