Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

sip Samba IP

by mkmcconn (Chaplain)
on Nov 07, 2001 at 08:07 UTC ( #123764=snippet: print w/replies, xml ) Need Help??
Description:

Tiny, limited name lookup utility for linux/unix machines on Windows networks.
Ex:

 ping $(sip host)
 scp username@$(sip linuxhost):.profile ./
 lynx http://$(sip pwshost)/cgi-bin/env.pl

-n
    sip -n host,
-i
  Choose one of multiple network interfaces listening for nmb.
  Pattern-match is from left to right.
     sip -ni 192. host

#!/usr/bin/perl -w
# sip -  Samba IP lookup derived from nmblookup output.
# Queries for names available to Samba but not DNS.

use strict;
use Getopt::Std;

use vars qw($opt_n $opt_i);
getopts('ni:');

if (! @ARGV){
     print usage();
     die "\n";
}

my (undef,@hosts) = split (/\n/, `nmblookup $ARGV[0]`);
$opt_i ||= "";

for (@hosts){
    s/\S+$|\s//g;
    m/^$opt_i/ and print $_.($opt_n?"\n":"");
}

sub usage
{
    my ($prog) = $0 =~ m!([^/]+)$!;
    return <<HERE ;

USAGE:
$0 [-i <network>] [-n] <host>:

  nmblookup the host to retrieve the numerical ip. Ex:
\tping \$($prog host)
\tscp ($ENV{'USER'}\@\$($prog linuxhost):.profile ./
\tlynx http://\$($prog pwshost)/cgi-bin/env.pl

-n
  Print newline after output. Ex:
\t$prog -n host

-i
  Choose one of multiple network interfaces listening for nmb.
  Pattern-match is from left to right.
\t$prog -ni 192. host

HERE

}
__END__
~
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2023-06-06 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (26 votes). Check out past polls.

    Notices?