This is a copy of a series of githubs and blog posts combined into a single convienant package for getting your qr code values from your authenticator app. I made this so I could easily transfer already made time base codes from one authenticator app into any other without having to turn off 2fa and turn it back on for the purpose of just having it in more than one place.
Important Note: I made this to personally work with Google Authenticator and BitWarden, so I haven't tried any of the others.
- brew install zbar
- if M1 mac:
a. mkdir ~/lib
b. ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib - if windows, this comes pre-installed can skip
- if linux apt-get install zbar
- if M1 mac:
- pip install -r requirements.txt -t "full/path/to/this/dir"
python decode_qr.py
Then open google authenticator (or some other TOTP app) and generate the QR code (normally via export menu). Show the QR code to your camera and it will spit out all the content you need from the QR code to your console. It will also save the content to a barcodes.csv file for you.
If you want to generate the QR code image to scan into another app on your phone (without another phone) then run the following command:
python decode_qr.py --generate qr_code
This will do all the same things as above but will also generate a qr_code.png
file that is the url content
of the qr code.
python decode_qr.py --output my-new-file.csv
This will change the qr code content getting saved from barcodes.csv
to my-new-file.csv
.
The start_webcam.py
file, like the name suggests, will only start your webcam. Does nothing by
itself. I only kept this for learning how to do this yourself.
This is simply extractions and slight modifications from the following places:
https://github.com/scito/extract_otp_secret_keys
https://note.nkmk.me/en/python-pillow-qrcode/
https://pyimagesearch.com/2018/05/21/an-opencv-barcode-and-qr-code-scanner-with-zbar/
https://github.com/meticulousCraftman/QR-Code