Folder Lock is a simple command-line tool that allows you to lock and unlock a folder using two-factor authentication (2FA) provided by Google Authenticator or a similar app. The tool uses the Time-based One-Time Password (TOTP) algorithm to generate temporary codes for authentication.
- Python 3.x
- pyotp package (can be installed using
pip install pyotp
) - qrcode package (can be installed using
pip install qrcode
) - cryptography package (can be installed using
pip install cryptography
)
- When you run
LockFolder.bat
, it checks ifkey.py
exists in the current directory. - If
key.py
exists, it means the folder is not locked yet, and it prompts you to register the folder. - During the registration process, the tool generates a secret key for 2FA and creates a QR code containing the provisioning URI. You can scan this QR code using Google Authenticator or a similar app on your mobile device.
- After successful registration,
key.py
andlocker.py
are deleted for security purposes. - If
key.py
does not exist (i.e., the folder is already registered), the tool runslocker.py
. - If the folder is not locked yet,
locker.py
gives you the option to lock the folder. - If you choose to lock the folder, it encrypts and renames the folder to
Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
and hides it by setting the attributes to +h (hidden) and +s (system). - If the folder is already locked,
locker.py
prompts you to enter the 2FA code generated by your authentication app. - If the code is correct, the folder is unlocked, and the attributes are reset to show the folder again.
- Clone or download this repository to your local machine.
- Install the required packages by running:
pip install pyotp qrcode cryptography pyarmor
- Run
LockFolder.bat
to lock/unlock the folder. - Follow the on-screen instructions to register the folder for the first time or lock/unlock the folder using 2FA.
- The tool is intended for personal use and is not a substitute for robust encryption methods for highly sensitive data.
Contributions to the Folder Lock project are welcome! If you find a bug, have a suggestion, or want to add a new feature, please feel free to open an issue or submit a pull request.
This project is for educational and demonstrational purposes only. Use it at your own risk.
This project is licensed under the MIT License - see the LICENSE file for details.