From owner-freebsd-net@FreeBSD.ORG Mon Apr 25 17:36:04 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A37716A4CF for ; Mon, 25 Apr 2005 17:36:04 +0000 (GMT) Received: from www6.web2010.com (www6.web2010.com [216.157.5.254]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0065243D2D for ; Mon, 25 Apr 2005 17:36:04 +0000 (GMT) (envelope-from MLandman@face2interface.com) Received: from delliver.face2interface.com (inoc202-203.veranet.net [216.238.202.203] (may be forged)) by www6.web2010.com (8.12.10/8.9.0) with ESMTP id j3PHZioM009638; Mon, 25 Apr 2005 13:35:45 -0400 (EDT) Message-Id: <6.2.0.14.0.20050425133401.02a79d20@mail.newdiets.com> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 25 Apr 2005 13:35:57 -0400 To: Abu Khaled , Alex Soares de Moura From: Marty Landman In-Reply-To: References: <426BE9EA.5090303@rnp.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed cc: freebsd-net@freebsd.org Subject: Re: scaning the local network with arping/sh script X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2005 17:36:04 -0000 > > 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