How to use dig command in Kali Linux [Tutorial]

What is dig command?

The ‘dig command‘ is used in network administration that check and lookup domain name server (DNS) It is dnssec and the part of information gathering.

Well further can’t be discussed much until I give you the definition of name servers….until then everything I say will be moot.

What is a domain name server?

A name server is a software and hardware server that provides provides a network service present at the application layer of the OSI model response to the queries against a directory service. The server component of the domain name system is the perfect example of that. Its job is to translate the IP address from the domain names provided.

So, bottom line dig is the shorthand of domain information groper (dig command), it uses DNS (Domain servers) lookups and gropes the information from the name servers. Why didn’t they use grabber is beyond me!!

So now the usage of this command in

Dig command basic syntax

When you are going to use any command you must know the basic syntax. Dig command basic syntax is useful and necessary.

If you will not follow the basic syntax, you will not get the appropriate result. You can use the following command to know more about dig command

$dig -h
or
$man dig

Basic syntax as follows:

dig [server] [name] [type]

Server
It is the domain name or IP address of the name server to query. This can be an IPv4 address in dotted-decimal notation or an IPv6 address in colon-delimited notation. When the supplied server argument is a hostname, dig resolves that name before querying that name server. If no server argument is provided, dig consults /etc/resolv.conf; if an address is found there, it queries the name server at that address. If either of the -4 or -6 options are in use, then only addresses for the corresponding transport will be tried. If no usable addresses are found, dig will send the query to the localhost. The reply from the name server that responds is displayed.

Name: is the name of the resource record that is to be looked up.

Type: indicates what type of query is required — ANY, A, MX, SIG, etc. type can be any valid query type. If no type argument is supplied, dig will perform a lookup for an A record.

Usage of the dig command.

First on the terminal use the command

dig -h

This command would show all the options used in dig

dig 1

In a similar way, many of the given commands can be used. For eg, let’s use authority now.

Dig command followed by the domain name

root@kali:~#dig www.cyberpratibha.com

; <<>> DiG 9.11.5-P4-5.1+b1-Debian <<>> www.cyberpratibha.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2996
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.cyberpratibha.com.		IN	A

;; ANSWER SECTION:
www.cyberpratibha.com.	12029	IN	CNAME	cyberpratibha.com.
cyberpratibha.com.	14393	IN	A	206.189.45.97

;; Query time: 3 msec
;; SERVER: 192.168.42.129#53(192.168.42.129)
;; WHEN: Wed Oct 23 09:10:57 IST 2019
;; MSG SIZE  rcvd: 86
root@kali:~#

dig authority www.google.com

dig 2

in the above command, the result indicates that the authoritative search went from ns2->ns1->ns4->ns3, which means name server 2 has more authority over the search according to the context of the domain name over name server 1.

Another Example:

Now let us fool around with some other commands

dig 3

dig nssearch www.facebook.com  **searches for name servers**

dig 4

dig additional www.facebook.com **controls all additional queries **

dig nsid www.facebook.com ** searches for the name servers ID**

dig 5

Similarly , there are other options that can be used for several other purposes. Here we go folks yet another command prominent in information gathering.

MODULE 4:- Information Gathering

  1. How to use dnsenum for dns enumeration – Kali
  2. How to use dig command in Kali Linux
  3. whois Kali Linux commands with example
  4. Enumerating DNS Records through dnsenum tool in Kali Linux
  5. Email Harvesting by theharvester tool in Kali Linux
  6. Google Hacking | Open Web Information Gathering
  7. dnsmap | DNS Domain name system brute force attacks
  8. Zone Transfer using dnswalk tool
  9. Website information Gathering through Nikto tool
  10. Search Senstive Data through Metagoofil Kali Linux 2.0
  11. 8 Steps to run Maltego Kali Linux – beginner guide

If Appreciate My Work, You should consider:

Gaurav Mahajan

I am Gaurav Mahajan a blogger, songwriter, code learner, tech enthusiast, food inhaler and overall a nice lazy guy that just loves tech of all forms

Leave a Reply

Your email address will not be published. Required fields are marked *