pyknock
UDP port knocking suite with HMAC-PSK authentication. Once it receives valid packet signed with valid pre-shared key, it runs command to open or close access. Commands should be specified by user via server command line. Server allows use of substitution placeholders in configured commands:
$ip- IP address mentioned in signed packet$af- IP address type:inetorinet6$cmd- requested action:openorclose
See Usage for examples.
❤️ ❤️ ❤️
You can say thanks to the author by donations to these wallets:
- ETH:
0xB71250010e8beC90C5f9ddF408251eBA9dD7320e - BTC:
- Legacy:
1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8a - Segwit:
bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntw
- Legacy:
Main Idea
In this application UDP datagrams are choosen for a reason. Typical configuration of firewalled machine allows only packets to some public ports and drops packets to all other ports. With UDP external observer can't distinguish between accepted packet and packet dropped by firewall. Therefore, if firewall configuration drops all UDP packets except packets to pyknock port, external observer can't even detect there is something awaiting for magic packet. So, it may be used to hide machine completely from network for unauthenticated peers. Also, it may be used as classical port-knocking solution, adding another protection layer to sensitive network application.
Features
- Uses cryptographically authenticated messages.
- Resistant to replay attacks.
- Post-quantum ready cryptography (HMAC-PSK with SHA-256).
- Works completely in user-space. May run even as unprivileged user.
Requirements
Only Python 2.6+ required. Python 3 is also supported.
Installation
Place file anywhere you want and run. Or use pip install pyknock to install it into your system as python package. Scripts shall become available at standard binary paths.
Usage
Server example:
pyknock-server MySecretPSK 'ipset add -exist myallowedset $ip timeout 3600' 'ipset del -exist myallowedset $ip'
Client example:
pyknock-client open my-protected-host.com MySecretPSK
Client behind NAT example:
pyknock-client -S $(curl -s https://canihazip.com/s) open my-protected-host.com MySecretPSK
See help for more options.
Metadata
Release files for pyknock 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyknock-0.4.3.tar.gz | 5.0 kB | Without provenance | Details for pyknock-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyknock-0.4.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pyknock-0.4.3-py2.py3-none-any.whl |
Total release size: 11.7 kB
Release files / pyknock-0.4.3.tar.gz
| Download URL | pyknock-0.4.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da592e15a5430f79855e1a666b4935ac29195564936e64bdaa3f12fd230127b9
|
|
BLAKE2b-256 checksum How to use checksums |
46618499eea1b59cfedbfa541200cf90db7858fb1aaa0ed9222f299dba380a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
|
Release files / pyknock-0.4.3-py2.py3-none-any.whl
| Download URL | pyknock-0.4.3-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1126d25776c69ddcc798edbdb047d4b9cf862ce036265a294b3b4d60944b036a
|
|
BLAKE2b-256 checksum How to use checksums |
5a761fd05b1088f32b7f8d56976cc8a5a2e6ebdf490dcf6d8ed2eb03ae5dc823
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
|
Security for pyknock 0.4.3
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.