converting an IP address to host name
If you are coding in Java, try using InetAddress
InetAddress addr = InetAddress.getByName("173.194.36.37");
String host = addr.getHostName();
System.out.println(host);
Get Hostname from IP Address
You've already got the Python code required
socket.gethostbyaddr(ip)
What you need is on the infrastructure side of things. To get an internal hostname, you need to query the internal DNS server for the network in question. Larger networks almost always have internal DNS services but some smaller network don't since they rely on other means (direct IP, NETBIOS, Bonjour, etc.) to find various resources.
TL:DR : You need to query the internal DNS services for the network in question
How to get hostname from IP (Linux)?
In order to use nslookup
, host
or gethostbyname()
then the target's name will need to be registered with DNS or statically defined in the hosts file on the machine running your program. Yes, you could connect to the target with SSH or some other application and query it directly, but for a generic solution you'll need some sort of DNS entry for it.
Related Topics
Global Keybinding on X Using Python Gtk3
How to Get an Windows Executable from My Kivy App (Pyinstaller)
Listening for Global Key-Combinations in Python on Linux
Frequency Counts for Unique Values in a Numpy Array
Writing Python Lists to Columns in Csv
Python Requests Json Returns Single Quote
Conversion Text to Number in Python
How to Pass a List Variable to Subprocess.Call Command in Python
How to Deploy a Python Dash Application on an Internal Company Server
Python Error - "Importerror: Cannot Import Name 'Dist'"
Letsencrypt Importerror: No Module Named Interface on Amazon Linux While Renewing
Convert a Gtk Python Script to C
Cannot Install Python3-Pip on Kali Linux
How to Use CSS Selectors to Retrieve Specific Links Lying in Some Class Using Beautifulsoup
Trouble Importing Tabulate in Python 3.4
Multiple Instances of Python Running Simultaneously Limited to 35