Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: MAC Address and NIC Device on Network.

by vladdrak (Monk)
on Jun 27, 2001 at 05:27 UTC ( [id://91807]=note: print w/replies, xml ) Need Help??


in reply to MAC Address and NIC Device on Network.

There is a Resource Kit utility called getmac.exe that can prove useful. You'll want to either compile a list of the machines you want to check, or enumerate an NT domain to check those machines. You could also walk IP addresses if you don't have a network browse list built up. Anyways, your code might be:
my @machines=("host1","host2","host3"); my %macs=(); for my $machine (@machines) { my $macraw=`getmac $machine`; if ($macraw =~ /(match something)/) { $macs{$1}=$machine; } } print "$macs{$_} $_\n" for (keys %macs);
Which would fill $macraw with something like this:
Transport Address Transport Name ----------------- -------------- 00-00-00-00-00-00 \Device\NetbiosSmb 00-A0-B0-6C-38-D0 \Device\NetBT_El90x1
..which you'll clean up with the regex buffer, and then toss it in a hash. The NetBT_El90x just identifies the interface as a 3Com 9xx card. Intels show as E100b, Compaq NetFlex as NetFlx, etc. In Win2k the identifer is actually a GUID that maps back to the driver/service name (joy!). If you have a good idea of what NICs are on your LAN it makes it easier.. you'll probably want to do a dirty scan first on everything, then refine your regex.

Good Luck,
Vlad

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://91807]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-18 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found