Code Monkey home page Code Monkey logo

passprotectorpy's Introduction

PassProtectorPy

PassProtectorPy is a password manager project written in Python. It allows users to securely store their passwords and other sensitive information in an encrypted format. The project will have the following structure:

PassProtectorPy/
├── docs/
├── passprotector/
│   ├── __init__.py
│   ├── encryption.py
│   ├── file_handling.py
│   ├── user_interface.py
├── tests/
│   ├── test_encryption.py
│   ├── test_file_handling.py
│   ├── test_user_interface.py
├── main.py
├── .gitignore
├── LICENSE
├── README.md
└── setup.py
  1. docs/ folder: This folder will contains the documentation for the project (TBS)
  2. passprotector/ folder: This folder contains the source code (src) for the project.
    • init.py: A blank file to mark this directory as a Python package.
    • encryption.py: Contains functions for encrypting and decrypting data.
    • file_handling.py: Contains functions for reading from and writing to files.
    • user_interface.py: Contains functions for interacting with the user through the command line.
  3. tests/ folder:
    • test_encryption.py: testing the encryption and decryption functionality.
    • test_file_handling.py: testing the file handling functionality.
    • test_user_interface.py: testing the user interface functionality.

The basic functionalities of the project will include:

  • Creating a master password for the user to access the password manager.
  • Adding a new login information such as username, password and website URL to the password manager.
  • Viewing saved login information.
  • Updating login information.
  • Deleting login information.
  • Generating strong passwords for the user.

The project uses the cryptography library for encryption and decryption of user data.

PassProtectorPy is managed using GitHub and has a project board to keep track of tasks and issues.

passprotectorpy's People

Contributors

metroproxyn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

passprotectorpy's Issues

Add main.py file

You should create the main.py file in the root directory of your project that will import and use the functions from the user_interface.py module to run the password manager.

Here's an example of what the main.py file might look like:

from src.user_interface import display_menu, get_user_choice

def main():
    # Display the main menu to the user
    display_menu()

    # Get the user's choice from the menu
    choice = get_user_choice()

    # Handle the user's choice
    if choice == '1':
        # Add a password
        # Call function from file_handling.py and encryption.py
    elif choice == '2':
        # Retrieve a password
        # Call function from file_handling.py and encryption.py
    elif choice == '3':
        # Update a password
        # Call function from file_handling.py and encryption.py
    elif choice == '4':
        # Delete a password
        # Call function from file_handling.py and encryption.py
    elif choice == '5':
        # Quit the program
        quit()
    else:
        # Handle invalid input
        print("Invalid choice. Please try again.")

if __name__ == "__main__":
    main()

This main() function will display the main menu to the user, get their choice, and then call the appropriate functions from the file_handling.py and encryption.py modules to handle the user's request. You can import any additional functions and modules you need in this file.

To run the program, simply run the main.py file from the command line:

python main.py

This is just an example and you can modify it as needed to fit the specific design of your password manager.

Second step – cover the encryption.py module by tests

Testing is an important part of software development as it helps ensure that the code works correctly and prevents issues from occurring in the future.

It generally makes more sense to write tests as you develop each module or feature. This way, you can catch and fix issues early on in the development process, which can save time and effort in the long run.

To use testing properly, you will need to write test cases that cover different scenarios that your code might encounter. For example, for the encryption.py file, you could write test cases to verify that:

  • Data can be encrypted and decrypted successfully.
  • Different encryption and decryption keys work as expected.
  • Invalid inputs to the encryption and decryption functions are handled appropriately (e.g., if an empty string is passed as input).

To write test cases, you'll need to use a testing framework. Python has a built-in testing framework called unittest that you can use to write and run tests.

Add setup.py file

The setup.py file is an important part of a Python project, as it contains information about the project's dependencies, version number, author, and other important metadata. Here's an example setup.py file for the PassProtectorPy project:

from setuptools import setup

setup(
    name='PassProtectorPy',
    version='0.1',
    author='Your Name',
    author_email='[email protected]',
    description='A password manager built with Python',
    url='https://github.com/yourusername/passprotectorpy',
    packages=['src'],
    install_requires=[
        'cryptography',
        'pyperclip'
    ],
    entry_points={
        'console_scripts': [
            'passprotectorpy=src.user_interface:main'
        ]
    }
)

User_Interface.py

Once you have implemented the encryption.py module, the next step is to create a user_interface.py module which will contain the user interface for your password manager. This module will handle the user's input, and display the appropriate messages and prompts to the user. You can start by thinking about the basic functionality of your password manager, and what features you want to include in the user interface.

For example, you might want to include the following features in your password manager:

  • The ability to add new passwords to the manager
  • The ability to retrieve passwords from the manager
  • The ability to update or delete passwords in the manager
  • The ability to list all passwords in the manager
  • The ability to exit the password manager

Once you have a clear idea of the features you want to include, you can start implementing them in the user_interface.py module.

Add File handling file

In file_handling.py, you could implement functions to handle files such as reading and writing data to files. Specifically, you can implement functions for:

  • Reading data from a file and returning it as a string.
  • Writing data to a file, given a file path and data to write.
  • Checking if a file exists.
  • Creating a new file, given a file path.
  • Deleting a file, given a file path.

List the dependencies in a 'requirement.txt'

This file should be located in the root directory of your project.

To add a dependency to the requirements.txt file, you simply need to write the name of the package on a new line:

cryptography

You can also specify the version of the package by adding == followed by the version number:

cryptography==3.4.8

Once you have added all the required dependencies to the requirements.txt file, you can use a tool like pip to install them. To install the dependencies, run the following command:

pip install -r requirements.txt

This will install all the packages listed in the requirements.txt file.

First step – Encrypt and decrypt data –> encryption.py

The most important part of a password manager is the encryption and decryption of the stored passwords. This means that the user's sensitive information is protected from unauthorized access, even if the data is compromised or stolen.

So, the first step would be to implement a secure encryption algorithm to encrypt the passwords. The encryption algorithm should use a strong encryption key and should be resistant to common cryptographic attacks. Once the encryption algorithm is implemented, you can move on to implementing the decryption algorithm to allow the user to retrieve their passwords.

After the encryption and decryption functionality is implemented, you can move on to developing the user interface to allow the user to interact with the password manager. The user interface should be user-friendly and intuitive, allowing the user to add, edit, and delete their passwords easily.

Finally, you should implement the file handling functionality to save the encrypted passwords to a file on disk, and read them back in when the user opens the password manager.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.