Skip to content

Arasoul/secure-network-communication

Repository files navigation

Secure Sender/Receiver + MITM Proxy

A simple educational project for learning about network security, encryption, and how data can be intercepted.

⚠️ Important: This is for learning only. Only use it on networks you own or have permission to test.

What is This Project?

This project has 3 programs:

  1. Sender - A program to encrypt and send files
  2. Receiver - A program to receive and decrypt files
  3. MITM Proxy - A program that sits between sender and receiver to intercept data

Setup (Easy Steps)

1. Install Python

Download Python 3.8+ from python.org

2. Install Dependencies

Open command line and run:

python -m venv .venv
.venv\Scripts\activate          # Windows
source .venv/bin/activate       # Mac/Linux

pip install -r requirements.txt

3. Run the Programs (3 windows)

Window 1 - Start Receiver:

python receiver.py

Then click "Start Server"

Window 2 - Start MITM Proxy:

python mitm.py 127.0.0.1

Choose 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!

How It Works

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

What You Can Send

  • Text - Messages and chat
  • Images - PNG, JPG files
  • Audio Files - WAV, MP3
  • Microphone - Record and send live audio

Encryption Options

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

Files Created When Running

  • received_files/ - Decrypted files from receiver
  • mitm_captured/ - Files captured by MITM

Troubleshooting

"Connection refused"

  • Make sure receiver starts first
  • Make sure MITM starts second
  • Make sure sender connects to correct IP

PyAudio won't install (Windows)

"No module Tkinter"

# Ubuntu/Debian
sudo apt-get install python3-tk

# Fedora
sudo dnf install python3-tkinter

Example: Send a Message

  1. Start receiver → click "Start Server"
  2. Start MITM → choose 1
  3. Start sender → enter 127.0.0.1 → click Connect
  4. In sender, click "Send Text"
  5. Type your message → click Send
  6. Check receiver - you'll see the decrypted message!
  7. Check MITM folder - you'll see captured data

Understanding the Code

sender.py

  • Creates a GUI window
  • Lets you pick encryption type (AES/SDES/TEA)
  • Encrypts your data
  • Sends it through MITM to receiver

receiver.py

  • Creates a GUI window
  • Listens for connections
  • Receives encrypted data
  • Decrypts it
  • Saves files to received_files/

mitm.py

  • 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)

Network Ports

  • Port 6000 - Where sender connects to MITM
  • Port 5000 - Where MITM connects to receiver

Security Notes

⚠️ Important:

  • 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

What You'll Learn

  • 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

File Info

  • sender.py - ~400 lines
  • receiver.py - ~450 lines
  • mitm.py - ~500 lines
  • Total: ~1,350 lines of Python code

Questions?

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.

About

Educational network security project demonstrating encrypted communication and MITM interception. Features sender/receiver applications with AES encryption and a transparent proxy for learning how data can be intercepted and analyzed. For authorized educational use only.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages