#!/usr/bin/perl # # external.pl (c) 2002 by Benjamin Schweizer # http://www.redsheep.de/ # ####################################################################### # this script is called by 'echolot -X external.pl' # it is given an ip address as $1, a default string as $2 and # its output's first line is the host description # output is "netbiosname" @dns = `nmblookup -A $ARGV[0]`; while (<@dns>) { if ($_ eq "<00>" and $client eq "") { $client = lc($last); } if ($_ eq "<00>" and $client ne "") { $group = lc($last); } $last = $_; } if ($group . $client eq "") { print $ARGV[1]; } else { print $group . "-" . $client; }