Skip to main content

a simple client to observe dns pollution network situation under Great Firewall.

Project description

publish PyPI version

dns-observe

a simple client to observe dns pollution network situation under The Great Firewall of China.

Features

  • Pure Python implementation with no third-party dependencies
  • Uses raw UDP sockets and implements DNS protocol parsing per RFC 1035
  • Listens continuously for a configurable time window to capture multiple responses
  • Box-drawing character output for visually grouping multiple answers

Supported Query Types

Type Status Description
A ✅ Supported IPv4 address records
AAAA ✅ Supported IPv6 address records
CNAME ✅ Supported Canonical name records
TXT 📝 Planned Text records
HTTPS 📝 Planned HTTPS service binding records
NS 📝 Planned Name server records
MX 📝 Planned Mail exchange records

Installing

Install and update using pip: pip install dns-observe

usage

cli

> dns-observe -h
usage: dns-observe [-h] [-s DNS_SERVER] [-q {A,AAAA,CNAME,TXT,HTTPS}] [-t WAIT_TIME] [--transaction-id TRANSACTION_ID] [-v] domain

Observing DNS pollution

positional arguments:
  domain                query domain

options:
  -h, --help            show this help message and exit
  -s, --dns_server DNS_SERVER
                        DNS server (default: 1.1.1.1)
  -q, --query_type {A,AAAA,CNAME,TXT,HTTPS}
                        DNS record type (default: A)
  -t, --wait_time WAIT_TIME
                        socket reception duration in seconds (default: 5)
  -id, --transaction-id TRANSACTION_ID
                        DNS transaction ID (0=random, 1-65535=fixed) (default: 0)
  -v, --version         show program's version number and exit

python:

> python -m dns_observe api.openai.com

from dns_observe import DNSQuery, RecordType
dns = DNSQuery('1.1.1.1')
dns.query('api.openai.com')
dns.query('claude.ai', RecordType.AAAA)

output:

- Time: 2024-11-22 11:18:16.977688, Name: api.openai.com, TTL: 153, A: 103.56.16.112
- Time: 2024-11-22 11:18:16.978715, Name: api.openai.com, TTL: 206, A: 192.133.77.145
┌ Time: 2024-11-22 11:18:17.140652, Name: api.openai.com, TTL: 46, A: 162.159.140.245
└ Time: 2024-11-22 11:18:17.140652, Name: api.openai.com, TTL: 46, A: 172.66.0.243

How to Packaging Python Projects

https://packaging.python.org/en/latest/tutorials/packaging-projects/

python -m build

# testpypi
py -m twine upload --repository testpypi dist/*

# pypi
py -m twine upload dist/*

dev

> pip install -e .

test

> python tests/test_run.py

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

dns_observe-0.7.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

dns_observe-0.7.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file dns_observe-0.7.1.tar.gz.

File metadata

  • Download URL: dns_observe-0.7.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dns_observe-0.7.1.tar.gz
Algorithm Hash digest
SHA256 b3d44d1477f4e3f6c42254c08c369887623beda358e40dd08e7e6da969ca8e88
MD5 50c167be22befedc81982dec9bbb8598
BLAKE2b-256 fa11bd4c2519a853dee3fa0dad8ce7df8f0932275da62c8993aa8ca0e151e453

See more details on using hashes here.

Provenance

The following attestation bundles were made for dns_observe-0.7.1.tar.gz:

Publisher: publish-to-test-pypi.yml on xavierskip/dns-observe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dns_observe-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: dns_observe-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dns_observe-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfb1f139131cc60a58b29d145a56ca749ef8146465467a184c26286a5ed281e
MD5 9d3f190498ae0cf588f8a7e3f4fa9fa7
BLAKE2b-256 c0e3ab3bddc5d27c8339d94e28a9f192b3721c1d38a1335bb98ba0a284c5862f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dns_observe-0.7.1-py3-none-any.whl:

Publisher: publish-to-test-pypi.yml on xavierskip/dns-observe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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