From 24b609214f95e9a4f11c38f11c4bde82ba0699a4 Mon Sep 17 00:00:00 2001 From: Marco Raber Date: Mon, 24 Aug 2020 16:37:18 +0200 Subject: [PATCH] First commit --- .gitignore | 1 + pythonTOTP-dmenu | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100755 pythonTOTP-dmenu diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bdfd49 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +keys diff --git a/pythonTOTP-dmenu b/pythonTOTP-dmenu new file mode 100755 index 0000000..f6bdeb4 --- /dev/null +++ b/pythonTOTP-dmenu @@ -0,0 +1,27 @@ +#!/bin/python3 +import dmenu +import pyotp +import clipboard + +keysfile=open('keys', 'r') +keys=[] +names=[] +alllines=keysfile.readlines() +for i in range(0, len(alllines)): + if i%2==0: + # thisname=alllines[i] + # thisname=thisname[:-2] + names.append(alllines[i][:-1]) + # names.append(thisname) + else: + keys.append(alllines[i][:-1]) +print(names) +chose=dmenu.show(names,case_insensitive=True, prompt='Search:') +print(chose) +for i in range(0,len(keys)): + if chose==names[i]: + totp = pyotp.TOTP(keys[i]) + print(totp.now()) + clipboard.copy(totp.now()) + else: + continue