Re: scaning the local network with arping/sh script

From: Marty Landman (MLandman_at_face2interface.com)
Date: 04/25/05

  • Next message: Bruce M Simpson: "Re: Multicast routing with VLANs"
    Date: Mon, 25 Apr 2005 13:35:57 -0400
    To: Abu Khaled <khaled.abu@gmail.com>, Alex Soares de Moura <alex@rnp.br>
    
    

    > > Abu Khaled wrote:
    > >
    > > >I don't know much about scripting but i tried to write one to scan my
    > > >local network using the net/arping port.

    Hi, I wrote a similar script a while back to run on my rh linux box; it's
    pretty quick and uses the ping cmd.

    > #!/bin/bash
    >
    > pingEm()
    > {
    > echo "preparing pings"
    > for((i=1;i<255;i++))
    > do
    > echo "ping -c1 192.168.0.$i > $$/$i &" >> pingEmAll.$$
    > done
    > echo "start pinging"
    > chmod +x pingEmAll.$$ && `./pingEmAll.$$`
    > }
    >
    > findEm()
    > {
    > for((i=1;i<255;i++))
    > do
    > awk '/64 bytes from /' $$/$i > ans
    > awk '{ print length($0) }' ans > len
    > if [ `more len` ]
    > then
    > echo "$i is on the network"
    > fi
    > done
    > }
    >
    > mkdir $$ && pingEm
    > findEm
    > rm -r $$ & rm pingEmAll.$$ ans len
    >
    > echo End of story
    >
    >
    > The output looks like this:
    >
    > $ ./findIps
    > preparing pings
    > start pinging
    > 1 is on the network
    > 3 is on the network
    > 7 is on the network
    > 160 is on the network
    > 240 is on the network
    > End of story
    > $
    >

    hth,

    Marty

    Marty Landman, Face 2 Interface Inc. 845-679-9387
    Search & Sort Easily: http://face2interface.com/Products/FormATable.shtml
    Web Installed Formmail: http://face2interface.com/formINSTal

    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Bruce M Simpson: "Re: Multicast routing with VLANs"