Skip to content

deangabbai/Secure_Communication_Protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Secure File Transfer Magic ๐ŸŽฉโœจ

Welcome to the Defensive Systems Programming Final Project for the Open University of Israel (OUI)! ๐ŸŽ“ This project is a whimsical journey into the realms of secure file transfer between a C++ client and a Python server. We're blending cryptography ๐Ÿ•ต๏ธโ€โ™‚๏ธ, network programming ๐ŸŒ, and a sprinkle of defensive coding ๐Ÿ›ก๏ธ to create a robust and secure application. Ready to embark on this adventure? Let's dive in! ๐Ÿš€


๐Ÿ“š Table of Contents


๐ŸŒŸ What's the Buzz? ๐Ÿ

Imagine sending your precious files over the internet without a care in the world, knowing they're wrapped up tighter than a mummy in a tomb. ๐ŸงŸโ€โ™‚๏ธ That's exactly what we're creating here! A secure client-server application that ensures your files are transferred safely, securely, and with a touch of magic. โœจ

Key Features:

  • ๐Ÿ”’ Encrypted Communication: Keep those prying eyes away!
  • โœ… File Integrity Verification: Trust, but verify.
  • ๐Ÿ‘ฅ Multi-User Support: The more, the merrier!

๐Ÿงฉ How Does the Magic Happen? ๐Ÿช„

๐Ÿ–ฅ๏ธ The Client Side (C++17)

  • Batch Mode Operation: No pesky GUIs here! The client reads server info from a transfer.info file. Simple and efficient. ๐Ÿ“„
  • Crypto++ Library: Our trusty wand for all encryption spells. ๐Ÿง™โ€โ™‚๏ธ
  • ๐Ÿ”‘ RSA Key Exchange: The client conjures an RSA key pair and shares the public key with the server.
  • ๐Ÿ” AES Encryption: The server sends back an enchanted AES key, which the client uses to encrypt the file.
  • ๐Ÿงช CRC32 Verification: A potion to ensure the file's integrity after the journey.

๐Ÿ The Server Side (Python 3.12.1)

  • ๐Ÿงต Multithreading Magic: The server juggles multiple clients effortlessly using Python's threading. ๐Ÿคนโ€โ™‚๏ธ
  • ๐Ÿ“š SQLite Database: A grimoire storing all client info and files securely.
  • ๐Ÿ”‘ AES Key Management: Generating and safeguarding AES keys like a dragon guarding its treasure. ๐Ÿฒ

๐Ÿ“ What's Inside the Spellbook? ๐Ÿ“œ

  • client.cpp: The valiant knight handling everything from registration to secure file transfer.
  • client.h: The knight's code of honorโ€”constants, functions, and protocol codes.
  • server_sql.py: The wise old wizard managing clients, file storage, and the mystical database.

๐Ÿš€ Features That Make Us Soar

๐Ÿ” Secure Communication

  • RSA (1024-bit): Our initial handshake, ensuring only the right parties communicate. ๐Ÿค
  • AES-CBC (256-bit): Encrypting files with the strength of a thousand suns. โ˜€๏ธ
    • Zero IV and PKCS#7 padding for that extra touch of security.

๐Ÿ“Š Reliable Database Storage

  • SQLite Database (defensive.db):
    • clients table: A registry of all heroes (clients) in our realm.
    • files table: Chronicles of all the files received, their integrity, and their origins.

๐Ÿ›ก๏ธ File Integrity Checks

  • CRC32 Checksum: The magical seal ensuring the file hasn't been tampered with by dark forces. ๐Ÿงฟ

โš™๏ธ Robust Error Handling & Reconnection

  • Detailed Logging: Keeping a vigilant eye on all activities. No sneaky goblins slipping through! ๐Ÿ‘€
  • Reconnection Support: If a client falls off their horse, they can get right back on! ๐ŸŽ

๐ŸŽฎ Let's Get Started! ๐ŸŽ‰

๐Ÿ–ง Server Setup

  1. Fire Up the Server: Run server_sql.py and watch the magic begin. โœจ
  2. Port Configuration: The server reads the port number from port.info. Customize it to your liking! ๐Ÿ”ง
  3. Database Initialization: If defensive.db isn't found, the server conjures it up automatically. ๐Ÿง™โ€โ™€๏ธ
  4. Operation: The server listens for clients, handles registrations, and stores files in the received_files directory.

๐Ÿ–ฅ๏ธ Client Setup

  1. Compile the Client: Use Visual Studio 2022 with C++17 to compile client.cpp. Let the code knights assemble! โš”๏ธ

  2. Prepare transfer.info: Include the following magical incantations:

    <server_ip>:<port>
    <client_name>
    <file_path>
    

    Example:

    192.168.1.100:1234
    MerlinTheWizard
    C:\path\to\your\enchanted_document.txt
    
  3. Run the Client: Execute the compiled client to send your file through the enchanted network. ๐ŸŒ


๐Ÿ”„ Communication Protocol Codes

Client Requests:

  • 825: Client Registration ๐Ÿ“ "Greetings! I'd like to join the quest."
  • 826: Sending Public Key ๐Ÿ”‘ "Here's my magic key!"
  • 827: Reconnection Request ๐Ÿ”„ "I'm back from the shadows!"
  • 828: Sending Encrypted File ๐Ÿ“ค "Delivering the secret scroll!"
  • 900: File CRC Verification Passed โœ… "The scroll arrived intact!"
  • 901: File CRC Verification Failed - Retry ๐Ÿ”„ "Something went awry. Let's try again!"
  • 902: File CRC Verification Failed - Final โŒ "Alas, the mission failed."

Server Responses:

  • 1600: Registration Successful ๐ŸŽ‰ "Welcome to the fellowship!"
  • 1601: Registration Failure ๐Ÿšซ "You shall not pass!"
  • 1602: Public Key Acknowledged ๐Ÿ‘ "Key received and accepted."
  • 1603: File Received ๐Ÿ“ฅ "Scroll secured in the archives."
  • 1604: Acknowledgment Received โœ… "Message received loud and clear."
  • 1605: Reconnection Successful ๐Ÿ”„ "Welcome back, brave one!"
  • 1606: Reconnection Failure ๐Ÿšซ "We don't recognize you."
  • 1607: General Error โš ๏ธ "Something's not right in the realm."

๐Ÿ› ๏ธ Technical Marvels

  • Defensive Programming: Our code is armored against the dark arts of bugs and vulnerabilities. ๐Ÿ›ก๏ธ
  • Multi-threading: The server handles multiple clients like a maestro conducting an orchestra. ๐ŸŽถ
  • Error Handling: Gracefully recovering from mishaps, ensuring the quest continues. ๐ŸŒˆ

๐Ÿค Joining the Quest

Feel free to fork this repository, open issues, or submit pull requests. Let's band together to make this project legendary! ๐Ÿ›ก๏ธโš”๏ธ


๐Ÿ™ Acknowledgments

A heartfelt thank you to the Open University of Israel for guiding us through this magical journey. The wisdom imparted by the instructors and the camaraderie among peers made this quest unforgettable. Thank you! ๐ŸŒŸ


๐Ÿ“ž Reach Out!

Got questions, ideas, or just want to chat about magic and code? Don't hesitate to reach out! Let's weave spells together to make the digital realm a safer place. ๐ŸŒโœจ


Thanks for stopping by! May your code be bug-free and your quests successful! Happy coding! ๐Ÿ˜„๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

About

Defensive System-Programming โ€“ Final Project ๐Ÿ›ก๏ธ | Grade: 100 ๐Ÿ† | Course 20937 at OUI ๐ŸŽ“

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors