Add the ability so provide an image file as the infile. If the file contains a QR code generated by Google Authenticator's "Transfer Accounts" function, it will be decoded directly in a single step. This is meant to help users who need to access their secrets from Google Authenticator but don't have a QR code decoder and don't want to use an online one due to security concerns.

This commit is contained in:
qwertyca 2022-12-21 16:47:31 -08:00 committed by Roland Kurmann
parent 65c52f4d81
commit 915efcf192
10 changed files with 559 additions and 61 deletions

View file

@ -31,14 +31,20 @@ with Capturing() as output:
'''
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
sys.stdout = self._stringio_std = StringIO()
self._stderr = sys.stderr
sys.stderr = self._stringio_err = StringIO()
return self
def __exit__(self, *args):
self.extend(self._stringio.getvalue().splitlines())
del self._stringio # free up some memory
self.extend(self._stringio_std.getvalue().splitlines())
del self._stringio_std # free up some memory
sys.stdout = self._stdout
self.extend(self._stringio_err.getvalue().splitlines())
del self._stringio_err # free up some memory
sys.stderr = self._stderr
def file_exits(file):
return os.path.isfile(file)