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! ๐
- ๐ What's the Buzz? ๐
- ๐งฉ How Does the Magic Happen? ๐ช
- ๐ What's Inside the Spellbook? ๐
- ๐ Features That Make Us Soar
- ๐ฎ Let's Get Started! ๐
- ๐ Communication Protocol Codes
- ๐ ๏ธ Technical Marvels
- ๐ค Joining the Quest
- ๐ Acknowledgments
- ๐ Reach Out!
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!
- Batch Mode Operation: No pesky GUIs here! The client reads server info from a
transfer.infofile. 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.
- ๐งต 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. ๐ฒ
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.
- 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.
- 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.
- CRC32 Checksum: The magical seal ensuring the file hasn't been tampered with by dark forces. ๐งฟ
- 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! ๐
- Fire Up the Server: Run
server_sql.pyand watch the magic begin. โจ - Port Configuration: The server reads the port number from
port.info. Customize it to your liking! ๐ง - Database Initialization: If
defensive.dbisn't found, the server conjures it up automatically. ๐งโโ๏ธ - Operation: The server listens for clients, handles registrations, and stores files in the
received_filesdirectory.
-
Compile the Client: Use Visual Studio 2022 with C++17 to compile
client.cpp. Let the code knights assemble! โ๏ธ -
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 -
Run the Client: Execute the compiled client to send your file through the enchanted network. ๐
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."
- 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. ๐
Feel free to fork this repository, open issues, or submit pull requests. Let's band together to make this project legendary! ๐ก๏ธโ๏ธ
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! ๐
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! ๐๐ฉโ๐ป๐จโ๐ป