Advertisement
qiwichupa

IPScan - ipscan.sh

Aug 5th, 2011
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. for subnet in 90 70 71 10 20 30 60 91
  4. do
  5.    
  6.     case $subnet in
  7.                     90)
  8.                     iface="eth25";
  9.                     ;;
  10.                     70)
  11.                     iface="eth23";
  12.                     ;;
  13.                     71)
  14.                     iface="eth20";
  15.                     ;;
  16.                     10)
  17.                     iface="eth26";
  18.                     ;;
  19.             20)
  20.             iface="eth27";
  21.             ;;
  22.             30)
  23.             iface="eth28";
  24.             ;;
  25.             60)
  26.             iface="eth21";
  27.             ;;
  28.             91)
  29.             iface="eth24";
  30.             ;;
  31.     esac
  32.  
  33.     arp-scan --interface $iface  192.168.$subnet.0/24 | awk '{print $1" "$2}' | grep 192 > /tmp/ipscan.tmp
  34.  
  35.     exec 3</tmp/ipscan.tmp
  36.     while read -u 3 name; do
  37.         ip=`echo $name| awk '{print $1}'`;
  38.         mac=`echo $name| awk '{print $2}'`;
  39.         nbname=`wbinfo -I $ip| awk '{print $2}'`;
  40.         /home/ipscan/bin/logwrite.pl  "$ip" "$mac" "$nbname";
  41.     done
  42. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement