I've been searching for this for a while, i didn't even found this question been asked before. So, i'm looking for a method to iterate over the IPv4 address space or CIDR in a nice random order without worrying of duplication. I've seen this implemented in Zmap
Asked
Active
Viewed 336 times
0
-
Is Zmap good enough for you? – Stephen Lin Oct 21 '14 at 08:39
-
Just generate random addresses and check if they've been visited before. Theres nothing special about IP addresses compared to integers in this case. – simonzack Oct 21 '14 at 10:23
-
possible duplicate of [Create Random Number Sequence with No Repeats](http://stackoverflow.com/questions/693880/create-random-number-sequence-with-no-repeats) – simonzack Oct 21 '14 at 10:24
1 Answers
0
you could start use something like:
import random
r = random.randrange
ip = "{}.{}.{}.{}".format(r(0,255),r(0,255),r(0,255),r(0,255))
however you should still check if the IP is valid. i.e. filter 0.0.0.0 and so on

greole
- 4,523
- 5
- 29
- 49