mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-05-14 14:55:05 +02:00
pkgs: Correctly render all bitwarden possibilities
This commit is contained in:
parent
f844a99919
commit
bf1c459a79
1 changed files with 15 additions and 9 deletions
|
|
@ -23,12 +23,18 @@ if process.returncode != 0:
|
|||
data = json.loads(data)
|
||||
|
||||
for item in data:
|
||||
print(f"==== {item['name']} ====")
|
||||
print(f" {item['login']['username']}")
|
||||
print(f" {item['login']['password']}")
|
||||
if "totp" in item["login"] and item["login"]["totp"] is not None:
|
||||
totp = pyotp.TOTP(item["login"]["totp"])
|
||||
time_remaining = (
|
||||
totp.interval - datetime.datetime.now().timestamp() % totp.interval
|
||||
)
|
||||
print(f" {totp.now()} ({int(time_remaining)})")
|
||||
if "login" in item:
|
||||
print(f"==== {item['name']} ====")
|
||||
if "username" in item["login"]:
|
||||
print(f" {item['login']['username']}")
|
||||
if "password" in item["login"]:
|
||||
print(f" {item['login']['password']}")
|
||||
if "totp" in item["login"] and item["login"]["totp"] is not None:
|
||||
if item["login"]["totp"].startswith("otpauth://"):
|
||||
totp = pyotp.parse_uri(item["login"]["totp"])
|
||||
else:
|
||||
totp = pyotp.TOTP(item["login"]["totp"])
|
||||
time_remaining = (
|
||||
totp.interval - datetime.datetime.now().timestamp() % totp.interval
|
||||
)
|
||||
print(f" {totp.now()} ({int(time_remaining)})")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue