Oct 13, '04 09:45:00AM • Contributed by: MartySells
To use it, start by downloading the script from my page; you can do this in the Terminal by typing:
curl -O 'http://www.studiosells.net/msells/netinv'
Once downloaded, move it to a directory on your path and make it executable with chmod a+rx ./netinv (assuming you're in that directory). Read the rest of the hint for some sample output and further explanations on how the tool works.Sample Output:
$ ./netinv IP MAC DNSname NBname Vendor ---------- ---------- ---------- ---------- ---------- 192.168.3.1 0:a0:c5:e2:4a:16 ? ZYXEL COMMUNICATION 192.168.3.3 0:0:39:8:4:1a ? PIZZA TOSHIBA CORPORATION 192.168.3.4 0:4:e2:52:4e:11 dell CANADA SMC Networks, Inc. 192.168.3.40 0:50:e4:99:2c:39 meatloaf MEATLOAF APPLE COMPUTER, INC. 192.168.3.52 0:b:db:a7:4c:5 ? STACY Dell ESG PCBA Test 192.168.3.60 0:4:76:da:47:1d dell DELL 3 Com Corporation 192.168.0.110 00:03:93:bf:17:c0 eyeBook EYEBOOK Apple Computer, Inc. 192.168.3.200 0:3:93:bd:26:1e fatmac FATMAC Apple Computer, Inc.Notes:
- Since this works from your ARP table it will only include hosts that you've ARPed for:
- The host you run it on will not be included. I considered this a big enough non-feature that you can specify the -l option to have the the local system included. The code for doing this is quite sketchy, but I didn't want to add more module requirements.
- You can ping hosts to get them added to your ARP table, or one way to quickly populate is to do a scan of some sort.
- Assuming you have nmap installed, just do nmap -sP 192.168.0.0/24
- If you don't nave nmap, here's a slower method:
Note that port 22 does not have to be open on the system. I just found that using nc was faster than using ping -c 1.perl -e 'for $i (1..10) { system qq!nc -z -w 1 192.168.0.$i 22!; }' - There are command line options to disable the vendor and netbios lookups, as well as to produce non-justified tab separated output without the header. See netinv -h for details.
- If you don't have the Perl module Net::MAC::Vendor, then netinv will use a built-in vendor lookup that seems to work OK, but is probably not as robust. Try installing the module with perl -MCPAN -e 'install Net::MAC::Vendor'. There's also a web page where you can do MAC-to-vendor lookups.
