#!/usr/local/bin/perl # # This script does a reverse address lookup, returning # a host name when given an IP address. It uses the # gethostbyaddr function call, which means it will use # whatever name resolution method the host running the # program uses. This is meant to provide a more easily # parsed format for output than nslookup provides. # # Andy Welter # www.the-welters.com # January 16, 2001 # use Socket; $addr=$ARGV[0]; $hostname=gethostbyaddr(inet_aton ($addr), AF_INET); if ( $hostname ) { print "$hostname\n"; } else { exit 1; };