├── LICENSE ├── README.md └── Zuro.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 zainab Ansari 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zuro ChatBot 🤖 2 | Zuro chatbot logo with the full name written in the center, red theme, and the letter Z prominently displayed to convey a chatbot feel 3 | 4 | 5 | 6 | ## About 📖 7 | 8 | Zuro is a friendly chatbot designed to engage with users in an interactive and entertaining way. It includes features such as text encryption, decryption, and generating fake information. This project utilizes the `rich`, `art`, and `fakefarsi` libraries. 9 | 10 | ## Features ✨ 11 | - **Natural Language Processing (NLP)**: Understands and responds to user queries with a human-like conversational flow. 12 | - **Customizable Responses**: Easily adjustable to tailor responses for different scenarios. 13 | - **Enhanced User Interaction**: Better and more readable console output using the `rich` library. 14 | - **Text Art Display**: Display text art using the `art` library. 15 | - **Generate Fake Information**: Generate fake information using the `fakefarsi` library. 16 | - **Text Encryption and Decryption**: Tools to encrypt and decrypt text. 17 | 18 | 19 | ## Technologies Used 🛠️ 20 | 21 | - **Python**: Core programming language for implementing logic and AI algorithms. 22 | - **FakeFarsi Package**: A package developed by [Mahan Rahmani](https://github.com/mhnrhmni) to produce all kinds of fake information in Farsi language, [Github](https://github.com/mhnrhmni/FakeFarsi). 23 | 24 | ## Installation ⚙️ 25 | 26 | To get started with Zuro ChatBot locally, follow these steps: 27 | 28 | ### 1. Clone the repository 29 | 30 | ```bash 31 | git clone https://github.com/mhnrhmni/Zuro-ChatBot.git 32 | cd Zuro-ChatBot 33 | ``` 34 | 35 | ### 2. Install Dependencies 36 | 37 | You don't need to do anything special to install the requirements, leave it all to the bot 38 | 39 | ### 4. Run the Bot 40 | 41 | After instalation, The chatbot is at your disposal 42 | 43 | ## Usage 💬 44 | 45 | Once Zuro ChatBot is running, you can chat with it directly in your terminal. 46 | 47 | Example interaction: 48 | 49 | ```text 50 | User: Hello, what can I do here? 51 | Zuro: Hi there! I'm Zuro, your assistant. How can I help you today? 52 | ``` 53 | 54 | 55 | ## Contributing 🤝 56 | 57 | We welcome contributions! If you'd like to improve the chatbot or fix bugs, please feel free to open a pull request or create an issue. Here's how you can contribute: 58 | 59 | 1. Fork the repository. 60 | 2. Create a new branch for your feature or bug fix. 61 | 3. Make your changes and commit them. 62 | 4. Push your changes and create a pull request. 63 | 64 | For larger contributions, please ensure to discuss them with the maintainers via GitHub Issues before submitting a pull request. 65 | 66 | ## Issues 🐛 67 | If you encounter any issues, please let us know by opening an [issue](https://github.com/mhnrhmni/Zuro-ChatBot/issues). We'll do our best to resolve it quickly. 68 | 69 | ## License 📜 70 | 71 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 72 | 73 | ## Acknowledgments ❤️ 74 | - Thanks to the open-source community for their amazing tools and libraries. 75 | - Inspired by the need for smarter, more efficient communication solutions. 76 | 77 | ## Autors 🧑‍💻 78 | Made with 💻 and ❤️ by 79 | [Zainab Khan](https://github.com/zainab0077) (Owner) 80 | [Mahan Rahmani](https://github.com/mhnrhmni) (Developer) 81 | 82 | 83 | ## 📫 Connect with Us 84 | For questions, suggestions, or just to say hi, feel free to reach out: 85 | - GitHub: [Zainab Khan](https://github.com/zainab0077) 86 | - Email: *haseb3883838@gmail.com* 87 | 88 | - GitHub: [Mahan Rahmani](https://github.com/mhnrhmni) 89 | - Email: *mahanrahmani777@gmail.com* 90 | 91 | -------------------------------------------------------------------------------- /Zuro.py: -------------------------------------------------------------------------------- 1 | """ 2 | Zuro - A simple chatbot with encryption, decryption, and fake information generation capabilities. 3 | """ 4 | 5 | import hashlib 6 | import subprocess 7 | import sys 8 | 9 | # Third-party dependencies 10 | try: 11 | import rich 12 | import art 13 | import fakefarsi 14 | from Crypto.Cipher import AES 15 | except ImportError: 16 | # Auto-install missing dependencies 17 | def install(package): 18 | """Install a package using pip.""" 19 | subprocess.check_call([sys.executable, "-m", "pip", "install", package]) 20 | 21 | install('rich') 22 | install('art') 23 | install('fakefarsi') 24 | install('pycryptodome') 25 | 26 | from art import text2art 27 | from rich.console import Console 28 | from rich.prompt import Prompt 29 | from fakefarsi import fakefarsi 30 | 31 | console = Console() 32 | 33 | # Create a custom print function for chatbot responses 34 | def chatbot_print(*args, **kwargs): 35 | """ 36 | Wrapper for console.print that automatically adds the chatbot prefix. 37 | Preserves all original console.print functionality. 38 | """ 39 | # If there's a message to print (args has content) 40 | if args: 41 | # If the message already starts with the chatbot prefix, print as is 42 | if isinstance(args[0], str) and args[0].startswith("[bold green]Chatbot:"): 43 | console.print(*args, **kwargs) 44 | else: 45 | # For string arguments, prepend the prefix 46 | if isinstance(args[0], str): 47 | message = f"[bold green]Chatbot:[/] {args[0]}" 48 | console.print(message, *args[1:], **kwargs) 49 | else: 50 | # For non-string first arguments (like panels, tables) 51 | # Print the prefix first, then the content 52 | console.print("[bold green]Chatbot:[/]", *args, **kwargs) 53 | else: 54 | # If no arguments, just print the prefix 55 | console.print("[bold green]Chatbot:[/]", **kwargs) 56 | 57 | def print_ai(): 58 | """Print the AI art representation.""" 59 | ai_art = text2art("AI", font="block") 60 | console.print(ai_art, style="bold red") # Keep original as this is not a chatbot message 61 | 62 | def chatbot(): 63 | """Run the chatbot interaction loop.""" 64 | print_ai() 65 | chatbot_print("Hi! I am your chatbot. You can ask me anything! Type 'what can you do' to see features.") 66 | 67 | while True: 68 | user_input = Prompt.ask("[bold blue]You[/]").lower() 69 | handle_user_input(user_input) 70 | 71 | def handle_user_input(user_input): 72 | """Handle user input and provide appropriate responses.""" 73 | responses = { 74 | # Welcome conversation 75 | "hello": "Hello! How can I help you?", 76 | "hi": "Hi! How can I help you?", 77 | "hey": "Hey! How can I help you?", 78 | "how are you": "I'm just a program, but I'm doing great! How about you?", 79 | "who are you": "I am Zuro, your friendly chatbot. How can I assist you?", 80 | 81 | # Features 82 | "what can you do": "\n\ntype 'Encrypt' to encrypt your text \n\ntype 'Decrypt' to decrypt your text \n\ntype 'fake' to generate a fake information \n\nand you can ask me 'anything' :) \n\ntype 'bye' to exit.", 83 | 84 | # Name 85 | "name": "My name is Zuro. How can I help you?", 86 | "what's your name": "My name is Zuro. I am chat-bot build by Python. How can I help you?", 87 | 88 | # End conversation 89 | "bye": "Goodbye! Have a great day!" 90 | } 91 | 92 | # Command handlers dictionary 93 | commands = { 94 | "encrypt": encrypt_text, 95 | "decrypt": decrypt_text, 96 | "fake": generate_fake_info, 97 | "bye": lambda: (chatbot_print(responses["bye"]), sys.exit()) 98 | } 99 | 100 | # Check for exact matches first 101 | if user_input in responses: 102 | chatbot_print(responses[user_input]) 103 | return False 104 | 105 | # Check for command keywords 106 | for cmd, handler in commands.items(): 107 | if cmd in user_input: 108 | handler() 109 | return False 110 | 111 | # Default response if no match 112 | chatbot_print("I'm not sure I understand.\nCan you ask something else?") 113 | return False 114 | 115 | def encrypt_text(): 116 | """Encrypt the user's text input using AES-CBC.""" 117 | input_text = Prompt.ask("[bold blue]Enter your text to encrypt[/]") 118 | KeySeed = Prompt.ask("[bold blue]Enter your password[/]") 119 | 120 | # Generate a 32-byte key from the password 121 | key = hashlib.sha256(KeySeed.encode()).digest() 122 | 123 | # Add verification string to validate successful decryption 124 | input_text += "EncryptDecryptSigning" 125 | 126 | # Add padding to make text length a multiple of 16 bytes (AES block size) 127 | while len(input_text) % 16 != 0: 128 | input_text += " " 129 | 130 | # Generate IV from the key for AES-CBC mode 131 | # Using CBC instead of ECB for better security with plaintext 132 | iv = hashlib.sha256(key).digest()[:16] 133 | 134 | # Perform encryption 135 | cipher = AES.new(key, AES.MODE_CBC, iv) 136 | encrypted_text = cipher.encrypt(input_text.encode()) 137 | encrypted_text = encrypted_text.hex() 138 | 139 | # Display result 140 | chatbot_print("Here is your encrypted text") 141 | console.print(f"[bold red]{encrypted_text}[/]") # Keep original formatting for encrypted text 142 | 143 | def decrypt_text(): 144 | """Decrypt the user's hex input using AES-CBC.""" 145 | input_text = Prompt.ask("[bold blue]Enter your text to decrypt[/]") 146 | KeySeed = Prompt.ask(" \n[bold blue]Enter your password[/]") 147 | 148 | # Generate key and IV identical to encryption process 149 | key = hashlib.sha256(KeySeed.encode()).digest() 150 | iv = hashlib.sha256(key).digest()[:16] 151 | 152 | cipher = AES.new(key, AES.MODE_CBC, iv) 153 | try: 154 | decrypted_text = cipher.decrypt(bytes.fromhex(input_text)) 155 | decrypted_text = decrypted_text.decode('utf-8') 156 | 157 | # Verify decryption was successful using the verification string 158 | if not decrypted_text.__contains__("EncryptDecryptSigning"): 159 | chatbot_print("Decryption failed. Invalid key or corrupted data.") 160 | return 161 | 162 | # Extract original text by removing verification string 163 | decrypted_text = decrypted_text.split("EncryptDecryptSigning")[0] 164 | chatbot_print(f"Here is your decrypted text \n{decrypted_text}") 165 | 166 | except ValueError: 167 | chatbot_print("Decryption failed. Invalid key/text or corrupted data.") 168 | return 169 | 170 | def generate_fake_info(): 171 | """Generate and display fake information.""" 172 | fake_info = fakefarsi.complete() 173 | chatbot_print(f"Here is your fake information: \n{fake_info}") 174 | 175 | # Entry point 176 | if __name__ == "__main__": 177 | chatbot() --------------------------------------------------------------------------------