Skip to main content

A simple DNS server written in vanilla Python.

Project description

slimDNS

A simple DNS server written in vanilla Python.

Installation

pip install slimDNS

or simply git clone this repository.

Minimal example

import slimDNS

dns = slimDNS.server(slimDNS.UDP)

dns.run()

This would host a DNS server without any records.
There's two ways you can add records:

Swap out all records via annotation

@dns.records
def records(server):
	return {
		"example.com" : {
			"A" : {"target" : "264.30.198.2", "ttl" : 60},
			"SOA" : {"target" : "example.com", "ttl" : 60},
			"NS" : {"target" : "example.com", "ttl" : 60, "priority" : 10}
		},
		"nas.example.com" : {
			"A" : {"target" : "264.30.198.2", "type" : "A", "ttl" : 60}
		},
		"_matrix._tcp.riot.example.com" : {
			"SRV" : {"ttl" : 60, "priority" : 10, "port" : 8448, "target" : "nas.example.com"}
		}

	}

Which would swap out all current records for the defined set of records.

Add, delete and update records

dns.remove('example.com', 'A')
dns.add('example.com', 'A', '264.30.198.1')
dns.update('example.com', 'A', '264.30.198.5')

Which would remove the A record example.com,
Then add a new similar one with a new UP and
finally update that new record with a new IP.

Note

Requires Python 3.8+ & Linux (not tested on other platforms).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slimDNS-1.0.0rc1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slimDNS-1.0.0rc1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file slimDNS-1.0.0rc1.tar.gz.

File metadata

  • Download URL: slimDNS-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for slimDNS-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 272b03c27deb79a0473d0dffeb2c926c4e8ef71e552673203861b70b8566f033
MD5 165d7bbf1eb41fdc27b699e9878492b8
BLAKE2b-256 88aa4b53ce9c9f8333d893c0b29707e4185b2ab7aebb5d5f78246558d6d2ef68

See more details on using hashes here.

File details

Details for the file slimDNS-1.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: slimDNS-1.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for slimDNS-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 4735ea01b495a7c299452157dce9fd8f12953a6172315e3d0225a235691f6ebe
MD5 b30dad2a1042fd9d121c3329824d1b2e
BLAKE2b-256 a046d649d098ff264adb4002ac2c0328536b5f8d8ad5e9e36760ea66c7f34a43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page