Update configs

This commit is contained in:
Tobias Reisinger 2022-11-13 23:22:21 +01:00
parent 028d3d7760
commit ddcc044ec6
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
8 changed files with 30 additions and 11 deletions
.local/share/qutebrowser/userscripts

View file

@ -81,6 +81,7 @@ import base64
import shlex
import subprocess
import argparse
#from urllib.parse import urlparse
import nacl.utils
import nacl.public
@ -103,6 +104,8 @@ def parse_args():
help='Only insert password')
parser.add_argument('--only-otp', action='store_true',
help='Only insert OTP code')
parser.add_argument('--autotype', action='store_true',
help='Only insert OTP code')
return parser.parse_args()
@ -196,6 +199,13 @@ class KeepassXC:
))
return self.recv_msg()['totp']
def autotype(self, uuid):
self.send_msg(dict(
action = 'request-autotype',
uuid = uuid,
))
return self.recv_msg()['totp']
def send_raw_msg(self, msg):
self.sock.send( json.dumps(msg).encode('utf-8') )
@ -371,13 +381,17 @@ def main():
kp = connect_to_keepassxc(args)
if not kp:
error('Could not connect to KeepassXC')
return
#if args.autotype:
# qute('mode-enter insert')
# kp.autotype(selection['uuid'])
# return
creds = kp.get_logins(args.url)
if not creds:
error('No credentials found')
return
selection = creds[0]
if len(creds) > 1:
login = dmenu(sorted(map(lambda c: c['login'], creds)), args.dmenu_invocation)
@ -402,6 +416,10 @@ def main():
if otp:
fake_key_raw(otp)
return
if args.autotype:
qute('mode-enter insert')
kp.autotype(selection['uuid'])
return
if name and pw:
qute('jseval -q ' + make_js_code(name, pw))
@ -411,4 +429,3 @@ def main():
if __name__ == '__main__':
main()