Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Generate Random IP Addresses

by dave_the_m (Parson)
on Sep 07, 2004 at 13:33 UTC ( #389033=note: print w/ replies, xml ) Need Help??


in reply to Generate Random IP Addresses

Well, it would be absolutely trivial to do, but why would you want a random external IP address?

Dave.


Comment on Re: Generate Random IP Addresses
Re^2: Generate Random IP Addresses
by simonm (Vicar) on Sep 07, 2004 at 17:54 UTC
    ... why would you want a random external IP address?

    I can think of lots of reasons, but none of them are good ones -- like checking for an open mail relay to send your spam through, or directing your script-kiddie exploit tool against...

      The only potentially good reason I can think of is to test your IP-matching regexen. That is, if you're against using Regexp::Common::net.
        Actually, I have a legitimate use for this. I want to compare the accuracy of two competing products, which are essentially large ip range databases. I have both in my DB now, and am writing a script to perform lookups on a large number of random IPs. I am examining those cases where the results do not line up.
Re^2: Generate Random IP Addresses
by Anonymous Monk on Oct 26, 2004 at 02:47 UTC
    Random sampling in a certain ip range is one reason...
Re^2: Generate Random IP Addresses
by Anonymous Monk on Mar 15, 2008 at 15:27 UTC
    Im looking to generate a list of ips starting from something like 71.100.100.180 or something like that. need help doing this. I need to ban a whole city from something lol. :-P I think this is what the monkey guy might be trying to do as well.

      Various ways using various mysteriously named functions from various mysteriously named packages, but it's easy enough with pure perl:

      ## Subs to convert dotted-quads to integers and vice versa sub dq2n{ unpack 'N', pack 'C4', split '\.', $_[ 0 ] };; sub n2dq{ join '.', unpack 'C4', pack 'N', $_[ 0 ] };; $start = dq2n( '71.100.100.180' );; print n2dq( $_ ) for $start .. $start + 100;; 71.100.100.180 71.100.100.181 71.100.100.182 ... 71.100.100.254 71.100.100.255 71.100.101.0 71.100.101.1 71.100.101.2 ... 71.100.101.22 71.100.101.23 71.100.101.24

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://389033]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-07-22 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (126 votes), past polls