A secure, local TOTP (Time-based One-Time Password) authenticator with GUI interface built in Python. This application allows you to manage all your 2FA codes from a single, secure desktop application.
- Secure Local Storage: All secrets are stored locally in encrypted format
- GUI Interface: Clean, dark-themed interface with auto-refresh
- One-Click Copy: Click any code to copy to clipboard instantly
- Auto-Refresh: Codes refresh automatically every 30 seconds
- Scrollable Interface: Handles large numbers of accounts
- Portable: Can be compiled to standalone executable
- Python 3.7 or higher
- pip package manager
-
Clone the repository:
git clone https://github.com/OnlyXianzo/Private-2FA.git cd Private-2FA -
Install required dependencies:
pip install -r requirements.txt
-
Set up your environment file:
cp code.env.example code.env
-
Add your TOTP secrets to
code.env:Gmail=YOUR_SECRET_KEY_HERE Discord=YOUR_SECRET_KEY_HERE GitHub=YOUR_SECRET_KEY_HERE -
Run the application:
python 2FA.pyw
Create a requirements.txt file with these dependencies:
pyotp==2.8.0
pyperclip==1.8.2
python-dotenv==1.0.0
protobuf==4.25.1
Install using: pip install -r requirements.txt
-
Export from Google Authenticator:
- Open Google Authenticator
- Tap the three dots menu โ "Transfer accounts" โ "Export accounts"
- Select accounts and generate QR code
-
Extract secrets using the provided script:
- Use
google code .pyto extract secrets from the migration URL - Scan the QR code with any QR scanner to get the migration URL
- Replace
YOUR_MIGRATION_URL_HEREin the script with your actual URL - Run the script to get your secret keys
- Use
When setting up 2FA on any service, they usually show a QR code and a manual entry key. Use that key directly in your code.env file.
- Never share your
code.envfile - it's automatically ignored by git - Keep backups of your
code.envfile in a secure location - Use strong system-level encryption on your device
- Regularly update dependencies for security patches
To create a standalone executable using PyInstaller:
pip install pyinstaller# Basic build
pyinstaller --onefile --windowed 2FA.pyw
# Advanced build with icon and optimizations
pyinstaller --onefile --windowed --icon=icon.ico --name="Private-2FA" 2FA.pyw--onefile: Creates a single executable file--windowed: Hides console window (for GUI apps)--icon=icon.ico: Sets custom icon (optional)--name="Private-2FA": Sets executable name
-
Copy required files to the dist folder:
cp code.env dist/
-
The executable will look for
code.envin the same directory -
Distribute the folder containing:
Private-2FA.exe(or2FA.exe)code.env(with your secrets)
Private-2FA/
โโโ 2FA.pyw # Main GUI application
โโโ google code .py # Secret extraction utility
โโโ code.env.example # Template file for your secrets
โโโ requirements.txt # Python dependencies
โโโ .gitignore # Git ignore file
โโโ LICENSE # MIT license
โโโ README.md # This documentation
Note: You'll need to create your own code.env file using the template provided.
-
"No such file or directory" error:
- Ensure
code.envexists in the same directory as the script - Check file permissions
- Ensure
-
"Invalid secret" or "Error" codes:
- Verify TOTP secrets are correct (no spaces, correct length)
- Some secrets might need padding with
=characters
-
GUI doesn't appear:
- Install tkinter:
sudo apt-get install python3-tk(Linux) - Use
python 2FA.pywinstead ofpythonw
- Install tkinter:
-
PyInstaller executable doesn't work:
- Ensure
code.envis in the same folder as the executable - Try running from command line to see error messages
- Ensure
Add this line to the beginning of 2FA.pyw for debugging:
print("Debug: Starting application...")- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This software is provided "as is" without warranty. Users are responsible for:
- Securing their TOTP secrets
- Creating appropriate backups
- Following security best practices
OnlyXianzo
- GitHub: @OnlyXianzo
- Email: https://github.com/OnlyXianzo
โญ Don't forget to star this repository if you found it useful!