Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions projects/DNS Record/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## DNS Record

This script takes the website name as input and returns its dns records.

#Requirements to run this file:

External library called dnspython has been used here and it can be installed easily by using the following command:

pip install -r requirements.txt

#How to use this script?

1.Install the requirements.

2. Type the following command

python dns_record.py

3.It will ask for a website:

You can give any website name for example: google.com
30 changes: 30 additions & 0 deletions projects/DNS Record/dns_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#Simple program to fetch dns record of a given website

import json
import dns.resolver

#Dictionary to store the dns record of a website
dns_record = {}

#User defined website
website = input("Enter the name of the website: ")

#Fetching the 'A' record of the website and storing it in the dictionary
a_record = dns.resolver.resolve(website, 'A')
for ipval in a_record:
dns_record['A_Record_IP'] = ipval.to_text()

#List to store the mx records of a website
mx_record_list = []

#Fetching the mx records and storing them in the dictionary
mx_record = dns.resolver.resolve(website,'MX')
for server in mx_record:
mx_record_list.append(server)
for i, element in enumerate(mx_record_list):
dns_record['MX_Record', i+1] = element

#Displaying the record on the screen
for key,value in dns_record.items():
print(f"{key} = {value}")

1 change: 1 addition & 0 deletions projects/DNS Record/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dnspython==2.0.0