Finding the Ip Address of a Domain

Reverse ip, find domain names on ip address

You can use nslookup on the IP. Reverse DNS is defined with the .in-addr.arpa domain.

Example:

nslookup somedomain.com

yields 123.21.2.3, and then you do:

nslookup 123.21.2.3

this will ask 3.2.21.123.in-addr.arpa and yield the domain name (if there is one defined for reverse DNS).

Finding the IP address of a domain

require 'socket'
IPSocket::getaddress('www.google.com') #=> "74.125.79.147"

How to get **all** IP addresses of a domain?

You could use a transparent proxy upstream of the computer(s).

For single computers, I've also used the hosts file and a special DNS server to poison DNS records by creating a false entry for facebook.com and www.facebook.com. I point it to a page somewhere with a page saying "You've been busted."

This works okay until your users figure out how to use anonymous proxies.

After a couple of steps, this really becomes a human issue. If at a business, it becomes a business policy and falls under HR. If at home, watch your kids' computer time.

find IP address by domain in go

If you're only interested in IPv4 addresses, you can get it like this:

package main

import (
"fmt"
"net"
)

func main(){
ips, _ := net.LookupIP("google.com")
for _, ip := range ips {
if ipv4 := ip.To4(); ipv4 != nil {
fmt.Println("IPv4: ", ipv4)
}
}
}

Finding the IP address of a domain

require 'socket'
IPSocket::getaddress('www.google.com') #=> "74.125.79.147"

Linux command to translate domain name to IP

Use this

$ dig +short stackoverflow.com

69.59.196.211

or this

$ host stackoverflow.com

stackoverflow.com has address 69.59.196.211
stackoverflow.com mail is handled by 30 alt2.aspmx.l.google.com.
stackoverflow.com mail is handled by 40 aspmx2.googlemail.com.
stackoverflow.com mail is handled by 50 aspmx3.googlemail.com.
stackoverflow.com mail is handled by 10 aspmx.l.google.com.
stackoverflow.com mail is handled by 20 alt1.aspmx.l.google.com.

Finding out the Domain Name of an IP Address using C#

IPAddress address = IPAddress.Parse("127.0.0.1");
IPHostEntry entry = Dns.GetHostEntry(address );
Console.WriteLine(entry.HostName);

How to differentiate IP-addresses from domain names during parsing

You should test the user input with regex, just like the ping command does. Below example should match any numeric variation from 0.0.0.0 to 255.255.255.255. Anything that doesn't match should be treated as a domain name.

/^(?=.*[^\.]$)((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.?){4}$/


Related Topics



Leave a reply



Submit