Python asynchronous DNS client and server library.
Python asynchronous DNS client and server library. With async-dnspy clients you can make asynchronous DNS requests to any DNS server with raw DNS data. This gives you a chance to create your low level DNS query. You can even create invalid DNS query and test your DNS servers. Most important feature of async-dnspy is to make load testing on servers.
On the first release of async-dnspy TCP and UDP clients are available that connects, send and received response of raw DNS queries. There is already a decoder class that decodes raw data and creates you readable high level DNS message. It works on Python 3.5 or newer.
Online documentation is available on https://async-dnspy.readthedocs.io/.
With in next release TCP and UDP servers will be implemented.
$ pip install asyncdnspy
Download the latest asyncdnspy library from: https://github.com/abdullahselek/async-dnspy
Extract the source distribution and run:
$ python setup.py build $ python setup.py install
The test suite can be run against a single Python version which requires pip install pytest and optionally pip install pytest-cov (these are included if you have installed dependencies from requirements.testing.txt)
To run the unit tests with a single Python version:
$ py.test tests -s -v
to also run code coverage:
$ py.test tests -s -v --cov-report html --cov=asyncdnspy
Getting the code
The code is hosted at Github.
Check out the latest development version anonymously with:
$ git clone https://github.com/abdullahselek/async-dnspy.git $ cd async-dnspy
I try to document as much as I can and unit tests have all the usages. Below you can find a single sample to get an idea how to TCP client to make a DNS A record query.
tcp_client = TCPClient('184.108.40.206', 53) tcp_client.connect() dns_raw_message = DNSRawMessage() data = dns_raw_message.query('google.com', RecordType.a, SocketType.tcp) _ = tcp_client.send(data) response = tcp_client.receive() dns_message = DNSMessageDecoder.decode(data, response, RecordType.a, SocketType.tcp) ipv4_address = dns_message.answers.get_ipv4_address()
Contributions of any kind (bug fixes, new features…) are welcome! Please do open pull request with a clear description and adding unit tests.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size asyncdnspy-0.1.1-py3-none-any.whl (14.7 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
Hashes for asyncdnspy-0.1.1-py3-none-any.whl