Skip to content

Basic DNS(Domain Name System) servers .We'll be retrieving the correct records from their zone files and converting them into bytes that can be added to our DNS response to be sent back to the client.It also include the process of DNS enumeration.

License

Notifications You must be signed in to change notification settings

Pookie-n-Rookie/DNS_SERVER

Repository files navigation

Overview

This DNS server is a simple implementation of a DNS server that processes DNS queries and provides responses based on zone data. It supports common DNS record types like A, AAAA, NS, and SOA, and can handle both standard queries and reverse lookups.

Functionality

This server listens for DNS queries, processes them, and responds with the appropriate DNS records, based on the zone data available. The server supports standard DNS query types, including A (host address), AAAA (IPv6 address), NS (name server), and SOA (start of authority).

The DNS query and response structure follows the format outlined in RFC 1035, where the request is divided into the header and question sections, and the response includes the answer, authority, and additional sections.

Features

mydns.py

  • Handles Common Record Types: A, AAAA, NS, SOA.
  • Supports Reverse Lookups: Based on the zone data provided.
  • Query Resolution: Resolves queries against configured zones.

dns_enumeration.py

  • returns various important information about the target like DNS record types, host names, IP addresses and much more depending upon the configuration of that target system.

Setting Up the Python Environment

This guide will help you set up a Python virtual environment and install the required dependencies from the requirement.txt file.

Prerequisites

  • Python 3.7+ must be installed on your system.
  • pip (Python's package manager) should be available.

Steps

Clone the Repository

First, clone the repository from GitHub:

git clone <repository_url>
cd <repository_directory>

Replace <repository_url> with your repository URL and <repository_directory> with the name of the folder created.

Create a Virtual Environment

Run the following command to create a virtual environment:

python -m venv venv

This will create a virtual environment named venv in the current directory.

Activate the Virtual Environment

Windows:

venv\Scripts\activate

macOS/Linux:

source venv/bin/activate

Install Dependencies

After activating the virtual environment, install the required dependencies:

pip install -r requirement.txt

Start the DNS server:

python mydns.py

Open another terminal and use nslookup to test:

# Query default @(domain name specified in the ORIGIN) record for example.com
nslookup example.com 127.0.0.1

# Query specific record types
nslookup -type=a example.com 127.0.0.1
nslookup -type=aaaa example.com 127.0.0.1
nslookup -type=soa example.com 127.0.0.1
nslookup -type=ns example.com 127.0.0.1

# Query subdomain (e.g., www.example.com)
nslookup www.example.com 127.0.0.1

Run the enumeration script:

python enumeration.py

enter the domain:< enter as you desire >

Testing:

Explanation of mydns.py

mydns.1.mp4

Explanation of dns_enumeration.py

for testing I have used google.com and instagram.com(you might check for other sites too)

dns_enumeration.mp4

References

  1. RFC 1035 - Domain Names - Implementation and Specification: Read Here
  2. Hand-Writing DNS Messages by Routley: Read Here
  3. Python DNS TOOLKIT:Read Here

Disclaimer

This project is made for educational purposes only. It is intended to demonstrate how a DNS server operates and should not be used in production environments. Always ensure security and compliance when dealing with network services.

About

Basic DNS(Domain Name System) servers .We'll be retrieving the correct records from their zone files and converting them into bytes that can be added to our DNS response to be sent back to the client.It also include the process of DNS enumeration.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages