Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Suppress output from nslookup

by Necos (Friar)
on May 18, 2007 at 02:47 UTC ( [id://616149]=note: print w/replies, xml ) Need Help??


in reply to Suppress output from nslookup

Well, perl has the gethostby* functions, and in your case, you need gethostbyaddr(). From the perldoc page:

For the gethost*() functions, if the "h_errno" variable is sup-ported in C, it will be returned to you via $? if the function call fails. The @addrs value returned by a successful call is a list of the raw addresses returned by the corresponding sys- tem library call. In the Internet domain, each address is four bytes long and you can unpack it by saying something like:  ($a,$b,$c,$d) = unpack('C4',$addr[0]);

The Socket library makes this slightly easier:
use Socket; $iaddr = inet_aton("127.1"); # or whatever address $name = gethostbyaddr($iaddr, AF_INET); # or going the other way $straddr = inet_ntoa($iaddr);


This should get you going in the right direction.
Theodore Charles III
Network Administrator
Los Angeles Senior High
4650 W. Olympic Blvd.
Los Angeles, CA 90019
323-937-3210 ext. 224
email->secon_kun@hotmail.com
perl -e "map{print++$_}split//,Mdbnr;"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found