#!/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 "fullquallifieddomainname" @dns = `/usr/bin/host @ARGV[0]`; ($a, $b, $c, $d, $name) = split (" ", $dns[0]); chop ($name); if ($name ne "n" and $name ne "3(NXDOMAIN") { print $name; } else { print $ARGV[1]; }