From cff1baf19e2023a4ab115ef3dfc1a346eb9319f6 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Wed, 7 Jun 2023 16:58:23 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eotp=5Fconv.py=E2=80=9C=20hinzuf=C3=BCg?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otp_conv.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 otp_conv.py diff --git a/otp_conv.py b/otp_conv.py new file mode 100644 index 0000000..3992284 --- /dev/null +++ b/otp_conv.py @@ -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']))