Skip to main content

DNS Tunneling client and server

Project description

pydnst

DNS Tunneling client and server in Python

INSTALLATION

pip3 install pydnst

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

FEATURES

pydnst is a DNS tunneling implementation in Python, supporting Linux only (the client might require a few paths tweaks to run on Windows).
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 a response to a keep-alive. Then the client sends another query 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.
A simple rich interface on the server side enables to send commands to specific clients, and watch the responses in real-time.
The client being implemented in Python is not stealth.

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 client on your victim machine.

USAGE

Install the pydnst package on client and server

pip3 install pydnst
python3 -m pydnst --help

Generate certificates (recommended), to encrypt the shared key transfer between client and server

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 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

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

pydnst-1.0.3.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

pydnst-1.0.3-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file pydnst-1.0.3.tar.gz.

File metadata

  • Download URL: pydnst-1.0.3.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pydnst-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7ff5961fa592dffdcc4d1e600140f4ee964efc4f99c6bf5d78f78c2ae173f513
MD5 56ddca8f0e20a9a3a52fef166948e4e4
BLAKE2b-256 48a990d29c1bf3e25172edffc117e4f030c220cc43bab409e38e00465dc09d02

See more details on using hashes here.

File details

Details for the file pydnst-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pydnst-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pydnst-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8939c080f9fe1231a642f40ccef0d6bcacaf1961eb4ef85d0c49b1c0a8812e48
MD5 8fba01d2c95be1fe39213cf86a361cbd
BLAKE2b-256 61c95fe7aea827218e6f1bc3beb20bd26b91c26c68a315874a542197d7898018

See more details on using hashes here.

Supported by

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