A simple educational project for learning about network security, encryption, and how data can be intercepted.
This project has 3 programs:
- Sender - A program to encrypt and send files
- Receiver - A program to receive and decrypt files
- MITM Proxy - A program that sits between sender and receiver to intercept data
Download Python 3.8+ from python.org
Open command line and run:
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # Mac/Linux
pip install -r requirements.txtWindow 1 - Start Receiver:
python receiver.pyThen click "Start Server"
Window 2 - Start MITM Proxy:
python mitm.py 127.0.0.1Choose option 1 (passive mode)
Window 3 - Start Sender:
python sender.py- Enter IP: 127.0.0.1
- Click Connect
- Choose encryption (AES is best)
- Send something!
Sender → MITM Proxy → Receiver
(encrypt) (intercept) (decrypt)
- Sender encrypts your data
- MITM reads it without decryption (passive) or swaps it (active)
- Receiver decrypts and saves it
- Text - Messages and chat
- Images - PNG, JPG files
- Audio Files - WAV, MP3
- Microphone - Record and send live audio
| Type | Security | Use? |
|---|---|---|
| AES | Strong ✅ | Yes, it's real encryption |
| SDES | Weak |
Only to learn how it works |
| TEA | Weak |
Only to learn how it works |
received_files/- Decrypted files from receivermitm_captured/- Files captured by MITM
"Connection refused"
- Make sure receiver starts first
- Make sure MITM starts second
- Make sure sender connects to correct IP
PyAudio won't install (Windows)
- Download wheel from: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
- Save it in project folder
- Run:
pip install PyAudio‑0.2.14‑cp311‑cp311‑win_amd64.whl - (Replace 311 with your Python version)
"No module Tkinter"
# Ubuntu/Debian
sudo apt-get install python3-tk
# Fedora
sudo dnf install python3-tkinter- Start receiver → click "Start Server"
- Start MITM → choose 1
- Start sender → enter 127.0.0.1 → click Connect
- In sender, click "Send Text"
- Type your message → click Send
- Check receiver - you'll see the decrypted message!
- Check MITM folder - you'll see captured data
- Creates a GUI window
- Lets you pick encryption type (AES/SDES/TEA)
- Encrypts your data
- Sends it through MITM to receiver
- Creates a GUI window
- Listens for connections
- Receives encrypted data
- Decrypts it
- Saves files to
received_files/
- Runs a proxy server
- Listens on port 6000 (sender connects here)
- Connects to receiver on port 5000
- Can read encrypted data (without key)
- Can replace audio (active mode)
- Port 6000 - Where sender connects to MITM
- Port 5000 - Where MITM connects to receiver
- SDES and TEA are NOT secure - only for learning
- AES is real encryption - safe to use
- This project sends keys in plain text (so MITM can intercept)
- Real systems would use better security
- How encryption works
- How to intercept network traffic
- How to decrypt data (if you have the key)
- Network programming basics
- Python GUI programming
- Client-server architecture
sender.py- ~400 linesreceiver.py- ~450 linesmitm.py- ~500 lines- Total: ~1,350 lines of Python code
Check the code comments - they explain what each part does.
That's it! Now you can see how network security works.
Remember: Only use this on your own computer or networks you have permission to test.