1
0
Fork 0

„otp_conv.py“ hinzufügen

This commit is contained in:
gpkvt 2023-06-07 16:58:23 +02:00
parent 371143c7e2
commit cff1baf19e
1 changed files with 19 additions and 0 deletions

19
otp_conv.py Normal file
View File

@ -0,0 +1,19 @@
#! /usr/bin/python3
"""
Convert Bitwarden Vault JSON exports OTP tokens into otpauth-Links
"""
import json
f = open("bitwarden_export.json", "r", encoding="utf-8")
data = json.load(f)
for item in data['items']:
if 'login' in item:
if 'totp' in item['login']:
if item['login']['totp']:
if item['login']['totp'].startswith('otpauth'):
print(item['login']['totp'])
else:
print('otpauth://totp/'+str(item['login']['username'])+'?secret='+str(item['login']['totp'].replace(' ',''))+'&issuer='+str(item['name']))