From 83d71da40f403b083e806a898b11a431f5e4e072 Mon Sep 17 00:00:00 2001 From: akarshghildyal <129004417+akarshghildyal@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:01:01 +0000 Subject: [PATCH 1/2] feat : password generator --- .../Password-Generator/passwordGenerator.py | 47 +++++++++++++++++++ .../Password-Generator/requirements.txt | 2 + 2 files changed, 49 insertions(+) create mode 100644 Beginner_Projects/Password-Generator/passwordGenerator.py create mode 100644 Beginner_Projects/Password-Generator/requirements.txt diff --git a/Beginner_Projects/Password-Generator/passwordGenerator.py b/Beginner_Projects/Password-Generator/passwordGenerator.py new file mode 100644 index 0000000000..728b5f033a --- /dev/null +++ b/Beginner_Projects/Password-Generator/passwordGenerator.py @@ -0,0 +1,47 @@ +import streamlit as st +import random +import string +import pyperclip + +def passwordGenerator(): + def generate_password(length, use_upper, use_lower, use_digits, use_special): + characters = '' + if use_upper: + characters += string.ascii_uppercase + if use_lower: + characters += string.ascii_lowercase + if use_digits: + characters += string.digits + if use_special: + characters += string.punctuation + + if characters == '': + st.error("Please select at least one character type!") + return "" + + password = ''.join(random.choice(characters) for _ in range(length)) + return password + + # app + st.title("Password Generator") + + with st.form("password_generator_form"): + length = st.slider("Password length", min_value=4, max_value=30, value=8) + use_upper = st.checkbox("Include A-Z", value=True) + use_lower = st.checkbox("Include a-z", value=True) + use_digits = st.checkbox("Include 0-9", value=True) + use_special = st.checkbox("Include special characters", value=True) + + submitted = st.form_submit_button("Generate Password") + + if submitted: + password = generate_password(length, use_upper, use_lower, use_digits, use_special) + st.session_state.generated_password = password + + if "generated_password" in st.session_state and st.session_state.generated_password: + st.write("Generated Password:") + st.code(st.session_state.generated_password, language="text") + if st.button("Copy to Clipboard"): + pyperclip.copy(st.session_state.generated_password) + st.success("Password copied to clipboard!") +passwordGenerator() \ No newline at end of file diff --git a/Beginner_Projects/Password-Generator/requirements.txt b/Beginner_Projects/Password-Generator/requirements.txt new file mode 100644 index 0000000000..600cb57461 --- /dev/null +++ b/Beginner_Projects/Password-Generator/requirements.txt @@ -0,0 +1,2 @@ +streamlit==1.24.0 +pyperclip==1.8.2 \ No newline at end of file From a6393abfd27322ad4840921e5c216d6f044fb216 Mon Sep 17 00:00:00 2001 From: akarshghildyal <129004417+akarshghildyal@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:18:02 +0000 Subject: [PATCH 2/2] add readme.md --- .../Password-Generator/README.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Beginner_Projects/Password-Generator/README.md diff --git a/Beginner_Projects/Password-Generator/README.md b/Beginner_Projects/Password-Generator/README.md new file mode 100644 index 0000000000..ebf7c56119 --- /dev/null +++ b/Beginner_Projects/Password-Generator/README.md @@ -0,0 +1,46 @@ +## **Password Generator** + +### ๐ŸŽฏ **Goal** + +The goal of this project is to create a secure and customizable password generator using Streamlit. The application allows users to generate passwords based on specified criteria, such as length and character types (uppercase, lowercase, digits, and special characters), and provides the ability to copy the generated password to the clipboard. + +### ๐Ÿงต **Dataset** + +No dataset is required for this project as it is focused on password generation. + +### ๐Ÿงพ **Description** + +This project is a password generator built with Streamlit, offering a user-friendly interface to create passwords based on user-defined parameters. Users can adjust the password length, and choose whether to include uppercase letters, lowercase letters, digits, and special characters in the generated password. Once generated, the password is displayed and can be copied to the clipboard for easy use. + +### ๐Ÿงฎ **What I had done!** + +1. Built a simple Streamlit interface for users to generate passwords. +2. Created options for users to customize password length and character types (uppercase, lowercase, digits, special characters). +3. Displayed the generated password to the user. +4. Added functionality to copy the password to the clipboard with a single click. + +### ๐Ÿš€ **Models Implemented** + +No machine learning models or algorithms were used in this project since the focus is on password generation logic using basic Python libraries. + +### ๐Ÿ“š **Libraries Needed** + +1. `Streamlit` - For building the user interface. +2. `random` - To randomly select characters for password generation. +3. `string` - To provide character sets (uppercase, lowercase, digits, punctuation). +4. `pyperclip` - To copy the generated password to the clipboard. + +### ๐Ÿ“Š **Exploratory Data Analysis Results** + +N/A. This project doesn't involve datasets or EDA as it's focused on password generation. + +### ๐Ÿ“ˆ **Performance of the Models based on the Accuracy Scores** + +N/A. This project does not involve models or algorithms that require accuracy evaluation. + +### ๐Ÿ“ข **Conclusion** + +The password generator provides a simple and effective way for users to generate secure passwords based on their preferences. With adjustable length and customizable character types, this tool can help users create passwords that are both secure and easy to use. + +**Akarsh Ghildyal** +[GitHub](https://github.com/AkarshGhildyal) | [LinkedIn](https://www.linkedin.com/in/akarsh-ghildyal/)