Questions tagged [gethostbyaddr]

A command in a few different langauges (i.e. Python, PHP) to perform a Reverse-DNS lookup

gethostbyaddr is a built in command to the Python programming language. It resides in the socket module. Taking an IP address as an input, it performs a reverse-DNS lookup to retrieve a list of strings. Among the outputs is the host name corresponding to that IP address.

43 questions
0
votes
0 answers

gethostbyname() and gethostbyaddr() returning different host names?

gethostbyname() and gethostbyaddr() are both returning different h_name values in their returned hostent structs when I call them in my program. I'm wondering if this behaviour is normal or should the two return identical host names?
Vimzy
  • 1,871
  • 8
  • 30
  • 56
0
votes
1 answer

How to store human readable IP in struct in_addr?

Say if you have the following IP address: 192.168.0.255 How can I store that human readable IP address into a struct in_addr? I'm brand new to network programming in C at this low level, so any help would be greatly appreciated.
Vimzy
  • 1,871
  • 8
  • 30
  • 56
0
votes
1 answer

Python script to read through a list and grab reverse DNS entry

Background: I have always wanted to try my hand at scripting so here goes! Problem: When gethostbyaddr gets to an IP with no DNS entry it errors and my script doesn't continue on. Here is what I have so far: import socket file = 'ServerList' f =…
0
votes
1 answer

python gethostbyaddr unknown host mac

I'm trying to use the socket function gethostbyaddr in python. It's working perfectly on Linux but not on OSX It's working on distant address like 8.8.8.8 >>> socket.gethostbyaddr('8.8.8.8') ('google-public-dns-a.google.com',…
0
votes
1 answer

How to make no statement if not show hostname - gethostbyaddr

I try to make simple php script to show hostname using gethostbyaddr. Let pretend the ip xxx.xxx.xxx.4 will show the hostname and ip xxx.xxx.xxx.5 not show hostname. My question is, how do i make if no hostname statement? Thank you. $ips =…
Syafeuq
  • 429
  • 1
  • 4
  • 9
0
votes
1 answer

where will gethostbyaddr() get the hostname from

In case of gethostbyname(), it returns ip addr by doing name resolution using DNS and /etc/hosts or Netbios. How will gethostbyaddr() work? how will this function get hostname from address ?
Chandu
  • 1,837
  • 7
  • 30
  • 51
0
votes
1 answer

faster or batch alternative to python's socket.gethostbyaddr()?

Is there a faster or batch alternative to socket.gethostbyaddr() for the purpose of determining the host, given an IP address? Thank you.
Lamps1829
  • 2,231
  • 3
  • 24
  • 32
0
votes
1 answer

Segmentation fault when using gethostbyaddr()

#include #include #include int main(int argc, char **argv) { char *ptr = NULL; struct hostent *hptr = NULL; struct in_addr *hipaddr = NULL; ptr = argv[1]; inet_aton(ptr,hipaddr); hptr =…
dsfa24
  • 41
  • 6
0
votes
1 answer

gethostbyaddr and netdb implementation file

Where is gethostbyaddr and netdb.h functions implemented? I can only find the header file where it is extern'ed (netdb.h) Thanks
user2034614
  • 59
  • 1
  • 6
0
votes
2 answers

Which is faster for resolving an IP?

Has anyone done any testing to see which is faster/more efficient/better for resolving an IP address in a PHP script? This exec('host '. $_SERVER['REMOTE_ADDR']); or this gethostbyaddr($_SERVER['REMOTE_ADDR']);
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
-1
votes
2 answers

Slow PHP Routine



        
Ace158
  • 1
-1
votes
2 answers

nslookup an ip address. some issues!!! and python script required

i do nslookup for this ip.. nslookup 74.125.225.79 and the hostname is given as: Host Name : ord08s07-in-f15.1e100.net -- but when i browse to 74.125.225.79 or using the ord08s07-in-f15.1e100.net it takes me to google.com I understand that it is a…
ihightower
  • 3,093
  • 6
  • 34
  • 49
-2
votes
1 answer

PHP: gethostbyaddr() returning an invalid url

I'm working a PHP script to try and resolve a vague URL (for example typing in facebook.com) as an absolute url (such as https://www.facebook.com); similar to what your browser does on a daily basis using PHP. So far I've got the following…
Raisus
  • 148
  • 3
  • 23
1 2
3