Skip to main content

A lightweight DNS-based message broker

Project description

TXTpresso

TXTpresso is an unconventional and experimental project aimed at exploring the possibilities of using DNS protocol and TXT records with zero-second TTL for lightweight API-like data communication. Welcome to the geeky side of internet protocols!

Example Usage

dig @127.0.0.1 time.txtpresso TXT +short

"2024-02-01 13:44:35"

Code

from txtpresso.server import TXTpressoServer, BaseHandler
from datetime import datetime

class TimeHandler(BaseHandler):
    def handle(self):
        return datetime.now().strftime('%Y-%m-%d %H:%M:%S')

if __name__ == '__main__':
    server = TXTpressoServer()
    server.register_handler('time', TimeHandler)
    server.start()

Goal

The goal of TXTpresso is to use the DNS protocol's unique features to create a lightweight, fast, and potentially harder-to-detect communication system compared to traditional HTTP APIs.

Concept

Using DNS TXT records and UDP, TXTpresso offers simple and swift communication methods compared to the overhead of HTTP requests, headers, and JSON payloads. By using unique lookups, such as test${UTIME}.domain, TXTpresso bypasses some caching issues, though users should be cautious of the potential impact on DNS traffic and server load.

Use Cases

  1. Bypassing firewalls or restrictions: By using DNS instead of HTTP APIs, this "under-the-radar" method might allow for communication in scenarios where traditional internet access is limited or blocked.
  2. Lightweight communication: If the emphasis is on simplicity and speed rather than robustness, using DNS lookups and UDP might keep things fast and lightweight compared to a full-blown HTTP API.
  3. Novel applications or hacks: As a fun, experimental project, you could come up with neat applications that take advantage of the DNS protocol's unique characteristics.

Methods

GET

TXTpresso's GET method is is using the concept of utilizing subdomains to represent queries or endpoints. By sending a DNS query for a TXT record on a specific subdomain (like time.domain), you essentially request data associated with that subdomain. The server, in turn, processes the query and sends back the corresponding data in the TXT record.

Example: To query the current time, use the dig command to search for a TXT record on time.domain:

dig @txtpresso.server.com +short txt time.txtpresso

POST

TXTpresso's POST method relies on BASE64-encoding the data you want to send and embedding it as part of a subdomain in a DNS query. This approach essentially transforms the subdomain into a carrier of your data payload. Upon receiving the query, the server decodes the information from the subdomain and processes it accordingly.

Example: Encode your data (limited to 512 bytes) in a DNS-friendly format, such as Base64, and send it as a subdomain for a DNS query.

dig @txtpresso.server.com +short a c3VwZXJ0cm91cGVyCg.post.txtpresso

Caveats

Be mindful of some limitations when using TXTpresso:

  1. Increased DNS traffic and potential server load.
  2. Caching complications, depending on unique lookups.
  3. Limitations in data size - a maximum of 512 bytes.
  4. Potential latency and packet loss with UDP.

Reminder

This experimental project is intended for educational purposes and to demonstrate the unconventional application of the DNS protocol. Always consider the broader impact on internet infrastructure and use TXTpresso responsibly.

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

TXTpresso-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

TXTpresso-0.1.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file TXTpresso-0.1.3.tar.gz.

File metadata

  • Download URL: TXTpresso-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for TXTpresso-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e48fd0148537e8857223f84b7f11f71b8f1b3f8cf4631b3f19f52c5f1d5ad13c
MD5 427adc55f35e9b635603f1c69270ac8a
BLAKE2b-256 deed1762f10bded9f857659b9ab82534abf843e41ec316e2d1d4b9732d05f66b

See more details on using hashes here.

File details

Details for the file TXTpresso-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: TXTpresso-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for TXTpresso-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a09988a024eec101a5fdc5058dd92ff4a26f6dcecec664673dc18b20d53c0ad9
MD5 0c7de586f7d6e9e94a8f9fdcd3999544
BLAKE2b-256 e37c825e24c50c8fcabecbb159c266eb354d0bd12e77b830dc53551e15a72605

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