https://github.com/atomjoy/py2fa
Desktop Python 2FA Authenticator Tkinter GUI app and script. The script generates two factor authentication codes for secret keys from json file.
https://github.com/atomjoy/py2fa
2fa desktop-2fa desktop-google-authenticator desktop-two-factor-authenticator google-authenticator google-authenticator-python py2fa python-2fa python-2fa-authenticator python-two-factor-authenticator
Last synced: 4 months ago
JSON representation
Desktop Python 2FA Authenticator Tkinter GUI app and script. The script generates two factor authentication codes for secret keys from json file.
- Host: GitHub
- URL: https://github.com/atomjoy/py2fa
- Owner: atomjoy
- Created: 2024-02-23T09:51:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-25T13:53:08.000Z (over 2 years ago)
- Last Synced: 2025-06-17T10:07:50.017Z (about 1 year ago)
- Topics: 2fa, desktop-2fa, desktop-google-authenticator, desktop-two-factor-authenticator, google-authenticator, google-authenticator-python, py2fa, python-2fa, python-2fa-authenticator, python-two-factor-authenticator
- Language: Tcl
- Homepage: https://github.com/atomjoy/py2fa
- Size: 288 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Py2FA Google Authenticator in Python
Google Authenticator desktop GUI and script application in Python with JSON secrets.
## How to
Install python3 and modules
```sh
# Check
which python3
# Install
sudo apt install python3 python3-pyotp python3-tk -y
```
### Add secrets
First add your 2FA secrets to the **secrets.json** file (when enabling github two factor auth get secret key).
```json
{
"atomjoy_github": "JBSWY3DPEHPK3PXP",
"moovspace_github": "JBSWY3DPEHPK3PXD"
}
```
### Run script
The script generates 2fa codes for secrets.
```sh
# Gui desktop app tkinter
python3 main.py
# Console script
python3 auth.py
# Console script (30 seconds loop)
python3 2fa.py
```
### Output
```sh
Label atomjoy_github Secret JBSWY3DPEHPK3PXP Code 280070
Label moovspace_github Secret JBSWY3DPEHPK3PXD Code 304997
```
## Random secret base32
```py
#!/usr/bin/python3
import pyotp
import time
# Base32 secret
secret = pyotp.random_base32()
# Code from secret
x = pyotp.TOTP(secret)
code = x.now()
# Show
print(secret)
print(code)
# Code verified for current time
print(x.verify(code)) # True
# time.sleep(35)
# print(x.verify(code))
```
## Edit and copy PyF2A activator
For Linux Debian 12 Gnome 43+
```sh
# Edit this line change main.py file location
Exec=/bin/python3 /home/username/Dokumenty/github/py2fa-gui/main.py %u
# And copy app activator file to
cp py2fa.desktop /home/username/.local/share/applications
```
## Links
-
-
-
-
-
-