Skip to content

Repository files navigation

Petoron P2P Messenger

Own PQS encryption


  • Architecture: Pure P2P - no servers, no databases
  • Key storage: Keys generated in memory, never stored, erased after use
  • Metadata: Only IP and port exist during the session - everything else is encrypted & obfuscated
  • Encryption: PQS v1.2 - PBKDF2-HMAC-SHA256 (200k), BLAKE2s-MAC, custom stream cipher + fake padding
  • Authentication: BLAKE2s-MAC (16 bytes) - instant failure on any data change
  • Packet obfuscation: --stealth mode - padding, hidden structures
  • Connection: Direct peer-to-peer only
  • Anonymity: No accounts, logins, or phone numbers
  • Third-party access: Impossible without physical access to both peers during session
  • History: No storage — all in RAM, wiped on close
  • Message size: Limited only by RAM & MTU — no artificial limits
  • External dependencies: None
  • DPI/blocking resistance: Harder to detect, can be masked
  • Autonomy: Fully offline until peers connect

Listening for incoming connection (Server mode)

  • python3 pqs_chat.py --listen 0.0.0.0:0000 --password --nick --stealth

  • --listen IP:port - Bind to specified IP and port to accept connection

  • --password - Shared session password (PQS key derivation)

  • --nick - Local nickname shown in chat

  • --stealth - Enable packet obfuscation and structure hiding


Connecting to a peer (Client mode) python3 pqs_chat.py --connect 0.0.0.0:0000 --password --nick --stealth

  • --connect IP:port - Bind to specified IP and port to accept connection
  • --password - Shared session password (PQS key derivation)
  • --nick - Local nickname shown in chat
  • --stealth - Enable packet obfuscation and structure hiding

Example:

  • Server mode: python3 pqs_chat.py --listen 0.0.0.0:7777 --password Test12345 --nick Ivan --stealth
  • Client mode: python3 pqs_chat.py --connect 111.222.33.44:7777 --password Test12345 --nick John --stealth

pqs_chat_tor.py (26.01.2026)

REQUIREMENTS

Before using the messenger, ensure the following are installed:

  • Python 3.8+
  • Tor (system Tor daemon or tor binary)
  • PySocks (required only for Tor client)

Install PySocks: pip install PySocks

Tor is used in two different roles:

  • Server side: Tor acts as a Hidden Service gateway
  • Client side: Tor acts as a SOCKS5 proxy

The application pqs_chat_tor.py itself uses Tor only on the client side, via a SOCKS5 proxy (default: 127.0.0.1:9050).


CONNECTING VIA TOR (.ONION CLIENT MODE)

Used ONLY on the client side. Requires running Tor with a SOCKS5 listener.

Command:

python3 pqs_chat_tor.py --connect <ONION_ADDRESS>:PORT --password <pass> --nick <name> --stealth --tor

Options:

  • --connect onion:port Connect to Tor Hidden Service
  • --tor Force SOCKS5 (Tor) connection
  • --password Shared session password
  • --nick Local nickname
  • --stealth Enable obfuscation and noise padding

--tor is required when connecting to .onion addresses, as .onion resolution is only possible via Tor SOCKS5.


EXAMPLE (TOR HIDDEN SERVICE SETUP)

SERVER (clearnet, unchanged):

python3 pqs_chat.py --listen 0.0.0.0:40444 --password Test12345 --nick Ivan --stealth

TOR CONFIGURATION (torrc):

DataDirectory /Users/user/.tor

SocksPort 127.0.0.1:9050

HiddenServiceDir /Users/user/petoron_service
HiddenServicePort 5000 127.0.0.1:40444

SocksPort is required for Tor client connections.

HiddenServicePort is required only on the server side. pqs_chat_tor.py connects to .onion services exclusively via SOCKS5.

START TOR:

tor -f torrc

or

tor -f /path/to/torrc

GET ONION ADDRESS:

cat /Users/user/petoron_service/hostname

CLIENT (TOR):

python3 pqs_chat_tor.py --connect abcd1234example.onion:5000 --password Test12345 --nick John --stealth --tor

ARCHITECTURE NOTES

pqs_chat.py

  • Plain TCP server and direct client

pqs_chat_tor.py

  • Tor/SOCKS5 client only

Server code is NOT modified for Tor. Tor handles routing and anonymity externally.


Licensed under the Petoron P2P Messenger Fair Use License by Ivan Alekseev | Petoron

About

Petoron P2P Messenger - minimalistic, secure and autonomous P2P messenger with built-in encryption - no servers :))

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages