A good shortcut for getting a list of IP addresses from a range in address/mask format is to use the Net::Netmask module. The enumerate method or the size and nth methods would be quite helpful.

Speaking of ranges of IP addresses and needing root access for ICMP ping... Ping scanning your own network can be a useful tool, but its usefulness is limited 1. Scanning someone else's network is more than rude. It may constitute a breach of acceptable use policies or terms of service contracts. It may even be illegal under certain circumstances in certain jurisdictions, but I'm not a lawyer so I couldn't say where or under what circumstances it would be. Ping flooding a machine or a range of addresses is even worse.

Pinging requires root access for the same reason many other things do. It is potentially destructive if used incorrectly. Under normal circumstances and for proper use, it's handy and benign. Please use it properly.

1 If you need to see what addresses are assigned by your DHCP server, there should be a way to query that server rather than pinging your whole network. If you have static assignments, they should go in a database as they are assigned. Any attacker putting a machine on your network that they want hidden will prevent that machine from responding to pings, so you'd only catch a real novice script kiddie.


In reply to Re: Net::Ping issues by mr_mischief
in thread Net::Ping issues by chris_henderson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.