DEV Community

Cover image for Simple tool check informations from domain name with golang
Duc Tran
Duc Tran

Posted on

Simple tool check informations from domain name with golang

LOOKUP

LOOKUP is a simple tool check IP informations, CNAME, NS(Name Server), A records, MX records, TXT records with Go.

     /\/| __   /\/| __
    |/\/ /_/  |/\/ /_/
      ___     ___
     / _ \   / _ \
    | (_) | | (_) |
     \___/   \___/
Enter fullscreen mode Exit fullscreen mode

Full source code in here

Fundamental

  • CNAME: is a Canonical Name Record or Alias Record. A type of resource record in the Domain Name System (DNS), that specifies that one domain name is an alias of another canonical domain name.

  • A and AAAA Record: An A and AAAA record are actually primary DNS records. They associate a domain name with a specific IP address.

  • TXT Record : A TXT record (short for text record) is a type of resource record in the Domain Name System (DNS) used to provide the ability to associate arbitrary text with a host or other name, such as human readable information about a server, network, data center, or other accounting information.

  • MX(Mail Exchanger) Record: A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a resource record in the Domain Name System (DNS). It is possible to configure several MX records, typically pointing to an array of mail servers for load balancing and redundancy.

  • NameServer: Nameserver is a server on the internet specialized in handling queries regarding the location of a domain name's various services. Nameservers are a fundamental part of the Domain Name System (DNS). They allow using domains instead of IP addresses.

Install

First, install golang.

Then, clone from soucre code and setup:

git clone https://github.com/ductnn/lookup.git
cd lookup
go get
Enter fullscreen mode Exit fullscreen mode

Usage

Without docker

Run command:

go run main.go
# Enter domain you want to check.
# Example
google.com
Enter fullscreen mode Exit fullscreen mode



Check result:

CNAME



TXT records



IP informations



Name Servers



MX records



With docker

Check Dockerfile and build with command:

docker build -t <your-image> -f Dockerfile .
Enter fullscreen mode Exit fullscreen mode

or pulls my image in here, and run container

docker run -it ductn4/loo
Enter fullscreen mode Exit fullscreen mode

With file binary

You can down file binary in here for running tool:

# Download file bin to your local
chmod +x loo
./loo
# And check result ...
Enter fullscreen mode Exit fullscreen mode

Test with facebook.com:

➜  bin git:(master) ✗ ./loo

     /\/| __   /\/| __
    |/\/ /_/  |/\/ /_/
      ___     ___
     / _ \   / _ \
    | (_) | | (_) |
     \___/   \___/


Enter subdomain or domain name:
facebook.com

CNAME
+---------------------+--------------+---------------+
| DOMAIN OR SUBDOMAIN |    DOMAIN    |     CNAME     |
+---------------------+--------------+---------------+
| facebook.com        | facebook.com | facebook.com. |
+---------------------+--------------+---------------+

TXT records
+--------------+----------------------------------------------------------------------+
|    DOMAIN    |                             TXT RECORDS                              |
+--------------+----------------------------------------------------------------------+
| facebook.com | google-site-verification=A2WZWCNQHrGV_TWwKh6KHY90tY0SHZo_RnyMJoDaG0s |
+              +----------------------------------------------------------------------+
|              | v=spf1                                                               |
|              | redirect=_spf.facebook.com                                           |
+              +----------------------------------------------------------------------+
|              | google-site-verification=sK6uY9x7eaMoEMfn3OILqwTFYgaNp4llmguKI-C3_iA |
+              +----------------------------------------------------------------------+
|              | google-site-verification=wdH5DTJTc9AYNwVunSVFeK0hYDGUIEOGb-RReU6pJlY |
+--------------+----------------------------------------------------------------------+

IP Informations
+--------------+------------------------------------+------------------+------------------+------------------------+
|    DOMAIN    |                 IP                 | CITY AND COUNTRY |     LOCATION     |      ORGANIZATION      |
+--------------+------------------------------------+------------------+------------------+------------------------+
| facebook.com | 31.13.75.35                        | Hong             | 22.2783,114.1747 | AS32934 Facebook,      |
|              |                                    | Kong, HK         |                  | Inc.                   |
+              +------------------------------------+------------------+------------------+                        +
|              | 2a03:2880:f15a:83:face:b00c:0:25de | Dublin,          | 53.3331,-6.2489  |                        |
|              |                                    | IE               |                  |                        |
+--------------+------------------------------------+------------------+------------------+------------------------+

Name Servers
+--------------+--------------------+
|    DOMAIN    |    NAME SERVERS    |
+--------------+--------------------+
| facebook.com | b.ns.facebook.com. |
+              +--------------------+
|              | d.ns.facebook.com. |
+              +--------------------+
|              | a.ns.facebook.com. |
+              +--------------------+
|              | c.ns.facebook.com. |
+--------------+--------------------+

MX Records
+--------------+-----------------------------+
|    DOMAIN    |         MX RECORDS          |
+--------------+-----------------------------+
| facebook.com | smtpin.vvv.facebook.com.    |
|              | 10                          |
+--------------+-----------------------------+
Enter fullscreen mode Exit fullscreen mode

Okkk! Thank you for reading 😍 🤩 🥳

Top comments (2)

Collapse
 
blakegates profile image
blakegates

This is awesome! Love the idea.

Collapse
 
ductnn profile image
Duc Tran

Thank you :D