Skip to content

Turn your USB into a secure key to automate typing your master password using face recognition

Notifications You must be signed in to change notification settings

zmn-hamid/USB-Master-Password

Repository files navigation

USB Master Password

I created this project so I can use a USB drive to automatically type in my master password in my password manager.

Security & Features

  • Your password is encrypted and saved into the flash drive. unless someone doesn't have access to your pc, it can't be decrypted. even by copy pasting the files to different devices.
  • To enhance your password even more, the app also does some face recognition using Open-CV to verify it's you who's using this app and flash drive. You can turn this option off.

Getting Started

Prerequisites

  • python 3.8 or higher idk

Installation

  • Installing prerequisities

    1. pip install -r requirements.txt Note: If you are on windows, you most probably won't be able to install dlib library like this. To solve the problem, follow this tutorial or search up the internet, then run the command above again untill every library is installed
  • Create encrypted password and key

    1. run python CreatePassword.py, enter your master password and press enter. two files would be created: enc_salt.bin and enc_mp.bin.
    2. Move enc_mp.bin To the flash drive (in the directory you specified in the config.py file. default: root) Note: Don't copy it. You want to seperate these two so your security would increase.
  • Training the AI This section is not needed if you don't want to do face recognition.. Just set DO_FACE_RECOGNITION to False (in config)

    1. Change your name in the config file, using the FACE_RECOGNITION_USER variable. The name must be folder-name-friendly.
    2. Take multiple images of your face, put them all in a folder under trainting (the more pictures the better). The name of the folder must be the same string you specified for FACE_RECOGNITION_USER. The structure would look like this:
    USB-Master-Password
    ├── training
    │   └── hamid
    │       ├── img1.jpg
    │       ├── img2.jpg
    │       ├   ...
    

    Note: If you want to reset the training module, just delete the file encodings.pkl (or by the variable in config: DEFAULT_ENCODINGS_PATH)

    1. In th root directory, run python train.py
    2. Once trained, you can validate it using python validate.py. It should print out your name and the location of your face in the picture it took.
  • Make executable file In the root directory make detect.bat file, open it with your editor, and type this:

    cd "/path/to/USB-Master-Password/"
    start pythonw detect.pyw
    

    (change that path accordingly)

  • Add Scheduled Task

    1. Enable the Operational Log and create your custom view. You can use this tutorial (you can only use 2003 as the ID since we only need to detect when a USB is plugged in)
    2. Create an scheduled task. There is this tutorial for it. For the action, just copy the path to the bat file and paste it in the Program/Script field.

Usage

  1. Open your password manager
  2. Plug in your USB while you're in front of the camera
  3. Instantly click on the password field so it will paste it there for you. If you failed to do it on time, you can manually paste it from the clipboard.

IMPORTANT NOTES

  1. If you have multiple webcams, you can increase CAM_PORT in config, to reach the webcam you want
  2. Each password encrypted file is unique to the device you used to create that password, therefore even if you copy paste this folder to another pc and use the same usb and encrypted file, you don't get to see the password. If you want to use your password on multiple devices, simply make a new password as explained in Create encrypted password and key in the new device, then change the name of the enc_mp.bin (both the file and the config) and use these new files alongside.

License

MIT License

This project is free and open-source. You can use, modify, and distribute it without any restrictions. Any credits is appreciated doe

Contact

About

Turn your USB into a secure key to automate typing your master password using face recognition

Topics

Resources

Stars

Watchers

Forks

Languages