A Python script for sending OTPs (One-Time Passwords) via email, protected by USB-based authentication and an admin password.
- Multi-factor authentication: Requires both a USB drive with a secret file and an admin password.
- OTP delivery: Sends a randomly generated OTP to any email via Gmail SMTP.
- Credential security: Uses environment variables to store sensitive data safely.
- User-friendly: Clear CLI prompts and helpful error messages.
- Fun denial: Opens a YouTube short if authentication fails (because why not?).
- Python 3.7+
- Gmail account with App Passwords enabled
- A USB drive (default
D:) with a fileotp_auth_key.txtcontaining your secret code
git clone https://github.com/shkmannan/secure-login.git
cd secure-loginNo external libraries are needed — uses only Python's standard library.
If you want to use .env files, install:
pip install python-dotenvCreate a .env file (and never commit it):
GMAIL_USER=your_email@gmail.com
APP_PASSWORD=your_generated_app_password
ADMIN_PASSWORD=your_admin_passwordOr set them directly in your shell environment.
- Insert your USB drive (default
D:— change in script if needed) - On that drive, create a file named:
otp_auth_key.txt - Add your secret code (no spaces or newlines) to that file
-
Enable 2-Step Verification on your Google account: Google 2-Step Verification
-
Generate an App Password: App Passwords Setup
- Choose “Mail” as the app
- Choose “Other” for the device (name it however you want)
- Copy the 16-character password and use it in your
.env
Run the script:
python otp_sender.pyThen follow the prompts for:
- USB authentication
- Admin password
- Recipient email
- Never commit
.envfiles or real credentials. - Change the admin password from the default in the code.
- For more safety, consider encrypting
otp_auth_key.txt.