mirror of
https://github.com/scito/extract_otp_secret_keys.git
synced 2025-12-06 14:54:57 +01:00
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:
parent
65c52f4d81
commit
915efcf192
10 changed files with 559 additions and 61 deletions
12
utils.py
12
utils.py
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue