
yellowman
Novice
Aug 22, 2006, 4:49 AM
Post #3 of 3
(137 views)
|
|
Re: [davorg] List Netbios Names
[In reply to]
|
Can't Post
|
|
I am just using the sample code that came with the module so that I can play around with it and when I run what is below all that I get back is the IP addresses. It looks like the first print statement works (print "$ip ";), but the last print statement is ignored (print "$mac_address $domain\\$machine $user";). Any ideas as to why? use Net::NBName; use Net::Netmask; $mask = shift or die "expected: <subnet>\n"; $nb = Net::NBName->new; $subnet = Net::Netmask->new2($mask); for $ip ($subnet->enumerate) { print "$ip "; $ns = $nb->node_status($ip); if ($ns) { for my $rr ($ns->names) { if ($rr->suffix == 0 && $rr->G eq "GROUP") { $domain = $rr->name; } if ($rr->suffix == 3 && $rr->G eq "UNIQUE") { $user = $rr->name; } if ($rr->suffix == 0 && $rr->G eq "UNIQUE") { $machine = $rr->name unless $rr->name =~ /^IS~/; } } $mac_address = $ns->mac_address; print "$mac_address $domain\\$machine $user"; } print "\n"; }
|