danielhilst

Resolve IP from /etc/hosts

Jun 27th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use Socket;
  3.  
  4. print "$ARGV[0]\n";
  5. $iaddr = inet_aton($ARGV[0]); # or whatever address
  6. $name = gethostbyaddr($iaddr, AF_INET);
  7. print "Host name is $name\n";
Advertisement
Add Comment
Please, Sign In to add comment