new version
This commit is contained in:
170
v1.0/.gitignore
vendored
Normal file
170
v1.0/.gitignore
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# UV
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
#uv.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
111
v1.0/OtpViewer.py
Normal file
111
v1.0/OtpViewer.py
Normal file
@@ -0,0 +1,111 @@
|
||||
import pyotp, time
|
||||
import tkinter as tk
|
||||
from tkinter import simpledialog, messagebox
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
import os
|
||||
load_dotenv()
|
||||
|
||||
email = os.getenv("ACCOUND")
|
||||
seed = os.getenv("OTP_SEED")
|
||||
|
||||
def resource_path(filename):
|
||||
if hasattr(sys, 'frozen'): # PyInstaller-EXE
|
||||
return os.path.join(sys._MEIPASS, filename)
|
||||
return os.path.join(os.path.dirname(__file__), filename)
|
||||
|
||||
def set_env_value(key, value, path=".env"):
|
||||
lines = []
|
||||
found = False
|
||||
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
for line in f:
|
||||
if line.startswith(f"{key}="):
|
||||
lines.append(f"{key}={value}\n")
|
||||
found = True
|
||||
else:
|
||||
lines.append(line)
|
||||
except FileNotFoundError:
|
||||
pass # Falls Datei noch nicht existiert
|
||||
|
||||
if not found:
|
||||
lines.append(f"{key}={value}\n")
|
||||
|
||||
with open(path, "w") as f:
|
||||
f.writelines(lines)
|
||||
|
||||
otp = pyotp.TOTP(seed)
|
||||
INTERVAL = otp.interval # Standard = 30s
|
||||
|
||||
def seconds_left():
|
||||
# Differenz bis zum nächsten 30-Sekunden-Zyklus
|
||||
return INTERVAL - int(time.time()) % INTERVAL
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("OTP-Code")
|
||||
|
||||
|
||||
label_email = tk.Label(
|
||||
root,
|
||||
text=f"Account: {email}",
|
||||
font=("Arial", 20, "bold"),
|
||||
fg='Black', # Textfarbe
|
||||
)
|
||||
label_email.pack(padx=20, pady=20)
|
||||
label = tk.Label(
|
||||
root,
|
||||
text=f"Lade ...",
|
||||
font=("Arial", 20, "bold"),
|
||||
fg='Black', # Textfarbe
|
||||
)
|
||||
label.pack(padx=20, pady=20)
|
||||
|
||||
def update():
|
||||
remaining = seconds_left()
|
||||
global seed
|
||||
if seed == 'Standard':
|
||||
label.config(text=f"Gibt deinen Otp Seed ein",fg='black',)
|
||||
root.after(250, update)
|
||||
|
||||
else:
|
||||
if remaining > 10:
|
||||
color = 'green'
|
||||
elif remaining > 5:
|
||||
color = "#e9ab00"
|
||||
else:
|
||||
color = 'red'
|
||||
|
||||
label.config(text=f"Code: {otp.now()} - Läuft ab in: {remaining:02d}s",fg=color,)
|
||||
|
||||
root.after(250, update)
|
||||
|
||||
def set_seed():
|
||||
global email, seed, otp
|
||||
new_account = simpledialog.askstring("Accountname eingeben", "Gib deinen Accountnamen ein:")
|
||||
new_seed = simpledialog.askstring("Seed eingeben", "Gib den neuen OTP-Seed ein:")
|
||||
if new_seed and new_account:
|
||||
try:
|
||||
otp = pyotp.TOTP(new_seed)
|
||||
seed = new_seed
|
||||
set_env_value("OTP_SEED", new_seed)
|
||||
set_env_value("ACCOUND", new_account)
|
||||
email = new_account
|
||||
label_email.config(text=f"Account: {email}")
|
||||
messagebox.showinfo("Erfolg", "Seed wurde erfolgreich geändert!")
|
||||
except Exception as e:
|
||||
messagebox.showerror("Fehler", f"Ungültiger Seed:\n{e}")
|
||||
|
||||
menubar = tk.Menu(root)
|
||||
root.config(menu=menubar)
|
||||
|
||||
otp_menu = tk.Menu(menubar, tearoff=0)
|
||||
otp_menu.add_command(label="Seed ändern", command=set_seed)
|
||||
otp_menu.add_separator()
|
||||
otp_menu.add_command(label="Beenden", command=root.destroy)
|
||||
menubar.add_cascade(label="Optionen", menu=otp_menu)
|
||||
|
||||
|
||||
root.iconbitmap(resource_path("otp-icon.ico"))
|
||||
update()
|
||||
root.mainloop()
|
||||
11
v1.0/README.md
Normal file
11
v1.0/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# OTP-Viewer
|
||||
|
||||
Software die für ein OPT-Token die Code Generiert
|
||||
|
||||
|
||||
### exe Exportieren
|
||||
|
||||
`pip install pyinstaller`
|
||||
|
||||
`pyinstaller --onefile --windowed --icon=otp-icon.ico --add-data "otp-icon.ico;." OtpViewer.py`
|
||||
|
||||
BIN
v1.0/otp-icon.ico
Normal file
BIN
v1.0/otp-icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
v1.0/otp-icon.png
Normal file
BIN
v1.0/otp-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
3
v1.0/png2icon.py
Normal file
3
v1.0/png2icon.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from PIL import Image
|
||||
img = Image.open("otp-icon.png")
|
||||
img.save("otp-icon.ico")
|
||||
2
v1.0/requirments.txt
Normal file
2
v1.0/requirments.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
pyotp
|
||||
python-dotenv
|
||||
Reference in New Issue
Block a user