Skip to main content

VSM Stealth Protocol - Invisible P2P encrypted transport

Project description

vsmprotocol

GitHub: cezarpena/vsm-protocol

Make a port invisible to every scanner on the internet — then talk through it anyway.

VSM does not open sockets. There is no listen(), no accept(), no entry in netstat or lsof. The port does not exist as far as the operating system is concerned. But authorized peers can still connect, because the server is sniffing raw packets with libpcap and looking for a specific cryptographic signature hidden inside the TCP header.

The Trick: ISN Steganography

Every TCP connection starts with a SYN packet that carries a 32-bit Initial Sequence Number. Normally this is random noise. VSM replaces it with an HMAC-SHA256 signature derived from the peer's private key and the current 30-second time window.

The server extracts the ISN from every incoming SYN, computes what the correct value should be, and compares:

  • Mismatch → packet is silently dropped. No response. Port appears dead.
  • Match → server injects a raw SYN-ACK, completing a handshake entirely outside the kernel.

After the stealth handshake, a Noise XX key exchange provides mutual authentication and ChaCha20-Poly1305 encryption.


Install

pip install vsmprotocol

Requires sudo — raw packet injection needs root.


Firewall Setup (Required)

The kernel will send RST packets for traffic on ports it doesn't know about. You must silence them:

macOS:

echo "block drop out proto tcp from any to any port 9999" | sudo pfctl -a "com.apple/vsm" -f - && sudo pfctl -e

Linux:

sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST --sport 9999 -j DROP

Usage

Server

import vsmprotocol as vsm
import time

def on_knock(sid, peer):
    print(f"Stealth connection from {peer.decode()}")

def on_msg(sid, peer, msg):
    print(f"{peer.decode()}: {msg.decode()}")

identity = vsm.generate_identity()

# Store the return value — prevents garbage collection of C callbacks
refs = vsm.start_server(9999, identity, on_knock, on_msg)

while True:
    time.sleep(1)

Client

import vsmprotocol as vsm

identity = vsm.generate_identity()
sid = vsm.dial("lo0", "127.0.0.1", 9999, identity)

if sid != -1:
    vsm.send_message(sid, "Message through an invisible port.")

What's Inside

  • Core: Go shared library using libpcap for raw packet injection/sniffing
  • FFI: ctypes for zero-dependency native calls from Python
  • Encryption: Noise XX handshake → ChaCha20-Poly1305
  • Bundled binaries: macOS (ARM + Intel), Linux (AMD64), Windows (AMD64)

License

MIT · © 2026 Cezar Pena

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

vsmprotocol-0.1.2.tar.gz (10.9 MB view details)

Uploaded Source

Built Distribution

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

vsmprotocol-0.1.2-py3-none-any.whl (10.9 MB view details)

Uploaded Python 3

File details

Details for the file vsmprotocol-0.1.2.tar.gz.

File metadata

  • Download URL: vsmprotocol-0.1.2.tar.gz
  • Upload date:
  • Size: 10.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for vsmprotocol-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8bf5a4472cd6505a267e3d99fc26fb8180347beafcc02e523747ec3547aa5fb9
MD5 1b4c944218f213a26e49078400407da5
BLAKE2b-256 824656c607fa7db7479dbd148b83348f3e59fd344fe3b6edfb26e128e9576dc0

See more details on using hashes here.

File details

Details for the file vsmprotocol-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: vsmprotocol-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for vsmprotocol-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a790d9bc4ffa5611d047fd1f83dfbd18b935f9b154482d6b997b722ba55d546
MD5 ae58488c5d99841ad2b9a1a67aeaf2f9
BLAKE2b-256 337325d224908005a24955f20e590699ee93cc047b828237010a840cfe2a8748

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