Skip to main content

pydnst

DNS Tunneling client and server in Python

INSTALLATION

pip3 install pydnst

For convenience the client, server, and c2 are in the same package, however the "rich" dependency is only used by the c2 module.

FEATURES

pydnst is a DNS tunneling implementation in Python, supporting Linux only (the client might require a few paths tweaks to run on Windows).
A simple rich interface on the server side enables to send commands to specific clients, and watch the responses in real-time.
The client sends keep-alive requests every 30 seconds. If the server has a command to send to a specific client, it sends it in response to a keep-alive. Then the client sends other queries containing the command response.
The server can manage up to 250 clients, communication is encrypted with a unique Fernet key per client, generated on the fly and shared using RSA encryption.
The client being implemented in Python is not stealth, and intentionally exposes its hostname in clear text (you can tweak that).

alt text

SET UP

First acquire access to a machine with a public IP, this is where the pydnst server will run.
Then acquire a DNS name, as short as possible, and configure its nameservers with glue records pointing to your public IP.
You can then configure your pydnst.toml field DNST_SERVER_NAME, and run pydnst server on your public machine, and pydnst client on your victim machine.
Of course you can also experiment with it in a local environment similarly configured.

USAGE

Install the pydnst package on client and server

pip3 install pydnst
python3 -m pydnst --help

This creates server_private.pem (copy to server) and server_public.pem (copy to client). After copying server_private.pem to server, don't forget to chmod 600.

python3 -m pydnst create_certificates

Generate configuration

This creates pydnst.toml : edit if needed and then copy to client and server.
On client, edit the MAIN_INTERFACE to use the DNS server of this interface, or DNS_SERVER_ADDRESS to circumvent it.
On server, edit the LISTENING_INTERFACE.
On both, specify the DNST_SERVER_NAME (the DNS name purchased).

python3 -m pydnst config

On server

In one terminal, run the server (pydnst.toml must be in the current directory) :
Logs are under pydnst.log

python3 -m pydnst server run

In another terminal, run the c2 commander (pydnst.toml must be in the current directory), which enables to send commands and watch responses in real-time.

python3 -m pydnst server c2

On client

In one terminal, run the client (pydnst.toml must be in the current directory) :
Logs are under pydnst.log

python3 -m pydnst client run

Metadata

Release files for pydnst 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydnst 1.0.4
File Size Uploaded Provenance Actions
pydnst-1.0.4.tar.gz 26.3 kB Without provenance Details for pydnst-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydnst 1.0.4
File Interpreter ABI Platform Actions
pydnst-1.0.4-py3-none-any.whl Python 3 none any Details for pydnst-1.0.4-py3-none-any.whl

Total release size: 52.4 kB

Release files / pydnst-1.0.4.tar.gz

Download URL pydnst-1.0.4.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
940ff46be1e10af6473b00b92c1ce269a26c5150273340718c99600dee6b582e
BLAKE2b-256 checksum
How to use checksums
fe24fa7f331c7558bd0bbe35094db0ff11a699ea6680cfe2552d343e5e5b692d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / pydnst-1.0.4-py3-none-any.whl

Download URL pydnst-1.0.4-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3639344d679b8ba07872220539cf55faef253718eb43d36b6a94341b38b6306
BLAKE2b-256 checksum
How to use checksums
274de9c3dedda578be542c196585a471ab3406b0318d641578373596eee810de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for pydnst 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page