07/11

Project 07 · of 11

Anonymising virtual router

SAÉ 3.02 · BUT2 · Development / Networking · group project Completed
PythonTCP/UDP socketsThreadsOnion routingAsymmetric encryptionPyQtMariaDBGit
The project

This SAÉ (paired with the event-driven programming module) requires designing and implementing from scratch an anonymous communication system between several clients, using distributed virtual routers. Anonymity relies on onion routing: chains of routers where each router only knows its direct neighbours (previous and next), without ever seeing the full origin of the message. It is how Tor (The Onion Router) works, reproduced at the scale of a student project.

The architecture is built on three roles. A master server defines the topology and distributes the keys: it receives each router's listening port and public key, then hands out the public keys to the clients. The clients build “onion” messages: they pick a random path (for example three routers) and stack several layers of encryption (layer 3, encrypted with router 3's key, contains the final message; layer 2, encrypted with router 2's key, contains router 3's address and layer 3; and so on). The routers decrypt a single layer, discover the address of the next hop and forward the rest.

In practice, the system has multiple routers and is deployed on at least two machines (Linux and Windows VMs for testing). Communication relies on TCP/UDP sockets in Python, simultaneous connections are handled with threads (multi-client server, dynamic ports), and a simplified asymmetric encryption scheme (public/private key pair per router) has to be coded by hand, without any cryptography library. Routing tables, keys and anonymised logs are stored in a MariaDB database. The client and the master have Qt graphical interfaces: the client handles connection and non-blocking message sending, the master displays the network, routes, logs and key distribution.

The project requires fully manual development (no auto-generated code), a clear and commented code structure, a mandatory Git repository, and a video demo showing traffic anonymisation. By its nature (anonymisation, layered encryption, Tor-style routing), it has a strong cybersecurity dimension.

Goal

Design and implement an anonymous communication system between several clients using virtual routers, guaranteeing anonymity through onion routing (chains of routers where each router only knows its direct neighbour), on a distributed network.

Approach
  • Distributed architecture: a master server (supervisor, route generator), several virtual routers and several clients.
  • Multi-router client-server communication over Python sockets on at least two machines (Linux + Windows VMs).
  • Handling simultaneous connections with threads (multi-client server, dynamic ports).
  • Hand-designing a simplified asymmetric encryption scheme (public key / private key), without any crypto library.
  • Layered encryption (onion routing): the client stacks the layers, each router decrypts only one.
  • Public key distribution by the master (each router sends it its public key, which is passed on to the clients).
  • Storing routing tables, keys and anonymised logs in MariaDB.
  • Qt graphical interfaces: client (connection + non-blocking sending) and master (network view, routes, logs).
  • Project management (planning, Git tracking, logbook) and a video demonstrating the anonymisation.
Technical challenges
  • Coding asymmetric encryption entirely by hand, without relying on any cryptography library.
  • Stacking and decrypting the successive layers correctly so that no router ever sees the full origin of the message.
  • Handling simultaneous connections and dynamic ports with threads in a multi-client server.
  • Getting multi-hop routing to work end to end in a distributed environment of several machines.
Critical learning outcomes (framework)
  • AC23.01 — Automate system administration with scripts.
  • AC23.02 — Develop an application from a given specification.
  • AC23.03 — Use a network protocol to program a client/server application.
  • AC23.04 — Install and administer a database management system.
  • AC23.05 — Access a dataset from an application and/or a website.
Deliverables
  • Complete source code through the Git repository (mandatory submission).
  • Documentation answering the specification (structure, protocol, encryption algorithm with its strengths/weaknesses).
  • Installation and user documentation.
  • Project management report and a video demonstrating traffic anonymisation.

Interactive demo · onion routing

Type a message and send it: the client stacks one encryption layer per router, and each router peels off only one.

The interactive demo needs JavaScript.