~ubuntu-branches/debian/sid/arping/sid

« back to all changes in this revision

Viewing changes to extra/arping-scan-net.sh

  • Committer: Bazaar Package Importer
  • Author(s): Giuseppe Iuculano
  • Date: 2010-04-04 11:36:04 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100404113604-833alrx3q2ikkk23
Tags: 2.09-1
* [ae34a1a] Switch to quilt
* [6fefc48] Updated my email address
* [a4d6a0d] Bump debhelper
* [1280d1e] Bump to Standards-Version 3.8.4
* [ee5d7be] Updated watch file
* [3f22b39] Imported Upstream version 2.09
* [2cab0a0] Switch to dpkg-source 3.0 (quilt) format
* [44915d7] Added autotools-dev in BUild-depends and copy
  config.sub/guess at build time
* [cd3e6d3] Remove config.guess and config.sub at build time
* [183451b] arping-scan-net.sh is now in extra/
* [f432d2a] removed 01_fix_makefile.patch
* [951cfa4] Added ${misc:Depends} in Depends and removed quilt
* [eb272a9] dh-clean-k-is-deprecated, use dh_prep
* [c45d3b6] Refreshed 02_fix_manpage.patch
* [ba77b60] Added VCS control fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# arping-scan-net.sh
 
3
#
 
4
#  Copyright (C) 2002 Thomas Habets <thomas@habets.pp.se>
 
5
#
 
6
#  This library is free software; you can redistribute it and/or
 
7
#  modify it under the terms of the GNU General Public
 
8
#  License as published by the Free Software Foundation; either
 
9
#  version 2 of the License, or (at your option) any later version.
 
10
#
 
11
#  This library is distributed in the hope that it will be useful,
 
12
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
#  General Public License for more details.
 
15
#
 
16
#  You should have received a copy of the GNU General Public License along
 
17
#  with this program; if not, write to the Free Software Foundation, Inc.,
 
18
#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
19
#
 
20
 
 
21
trap "exit 0" INT
 
22
 
 
23
if [ "$1" = "" ]; then
 
24
        echo
 
25
        echo "Usage: $0 <mac address>"
 
26
        echo ""
 
27
        echo "   Sorry, it's not more configurable than that, edit the source"
 
28
        echo
 
29
        exit 1
 
30
fi
 
31
TARGET_MAC="$1"
 
32
 
 
33
# seq doesnt exist on some retarded boxen, comment out if your box is too
 
34
# stupid to have bc and/or tr
 
35
seq() { echo "for (i=$1; i<=$2; i++) i;" | bc | tr "\012" " "; }
 
36
 
 
37
#
 
38
# first number after 'seq' is range start, second is range end
 
39
#
 
40
# default is [192-192].[168-168].[0-0].[0-255]
 
41
#
 
42
#
 
43
# I may put this functionality into ARPing one day if people seem to like it.
 
44
#
 
45
for a in $(seq 192 192); do
 
46
    for b in $(seq 168 168); do
 
47
        for c in $(seq 0 0); do
 
48
            for d in $(seq 0 255); do
 
49
                sh -c "arping -A -q -c 1 -T $a.$b.$c.$d $TARGET_MAC
 
50
                if [ \$? = 0 ]; then
 
51
                    echo Got answer with address: $a.$b.$c.$d
 
52
                fi" &
 
53
            done
 
54
            wait
 
55
        done
 
56
    done
 
57
done
 
58
#exit 1