GithubHelp home page GithubHelp logo

pydns's Introduction

pydns

A fully python 3 implementation of a DNS server

Notes

  • At the moment the only records supported are IPV4 A records (however the main codebase is there to support others)
  • TTL will be set to 0 as not to corrupt cache with bad records, in the future this can be changed
  • Sometimes must run as root/admin to bind port 53 (any port < 1000)
  • This "server" only supports UDP based DNS requests (ATM), and will not make actual DNS queries to retrieve actual results: the intention of this "server" is to send fake addresses back to clients that send requests to it based on the contents of the given hosts.txt file

Hosts

You can setup hosts in a hosts.txt file in the format

DOMAIN IP

Example

test.com 127.0.0.1
google.com 216.58.212.110

Run

Must use python 3

python main.py
usage: main.py [-h] [-f HOSTS] [-a ADDRESS] [-p PORT] [-d]

A python DNS server

optional arguments:
  -h, --help            show this help message and exit
  -f HOSTS, --hosts HOSTS
                        The file to load hosts from
  -a ADDRESS, --address ADDRESS
                        Address to bind
  -p PORT, --port PORT  Port to bind
  -d, --debug           Print debug messages

Testing

Windows

  1. Open nslookup
  2. Enter SET debug
  3. Optional enter SET TYPE=ALL
  4. Enter server 127.0.0.1 or whatever IP you bound to (must be using port 53)
  5. Query a domain name you have in your hosts.txt configuration

Linux

drill @127.0.0.1 domain

See the drill manpage for more info

License

MIT license

pydns's People

Contributors

douile avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.