upgrade to protobuf 4.21.5, add quiet mode, refactor code, add unit test
- update README.txt
- rename generated code directory
- refactor code:
- extract methods
- make code testable
This commit is contained in:
25
README.md
25
README.md
@@ -13,18 +13,15 @@ Extract two-factor authentication (2FA, TFA) secret keys from export QR codes of
|
||||
|
||||
## Dependencies
|
||||
|
||||
The protobuf package of Google for proto3 is required for running this script. protobuf >= 3.14 is recommended.
|
||||
|
||||
pip install protobuf
|
||||
pip install -r requirements.txt
|
||||
|
||||
Known to work with
|
||||
|
||||
* Python 3.6.12 and protobuf 3.14.0
|
||||
* Python 3.8.5 and protobuf 3.14.0
|
||||
* Python 3.10.6, protobuf 4.21.5, qrcode 7.3.1, and pillow 9.2
|
||||
|
||||
### Optional
|
||||
|
||||
For printing QR codes, the qrcode module is required
|
||||
For printing QR codes, the qrcode module is required, otherwise it can be omitted.
|
||||
|
||||
pip install qrcode[pil]
|
||||
|
||||
@@ -33,9 +30,11 @@ For printing QR codes, the qrcode module is required
|
||||
The export QR code of "Google Authenticator" contains the URL `otpauth-migration://offline?data=...`.
|
||||
The data parameter is a base64 encoded proto3 message (Google Protocol Buffers).
|
||||
|
||||
Command for regeneration of Python code from proto3 message definition file (only necessary in case of changes of the proto3 message definition):
|
||||
Command for regeneration of Python code from proto3 message definition file (only necessary in case of changes of the proto3 message definition or new protobuf versions):
|
||||
|
||||
protoc --python_out=generated_python google_auth.proto
|
||||
protoc --python_out=protobuf_generated_python google_auth.proto
|
||||
|
||||
The generated protobuf Python code was generated by protoc 21.5 (https://github.com/protocolbuffers/protobuf/releases/tag/v21.5).
|
||||
|
||||
## References
|
||||
|
||||
@@ -63,3 +62,13 @@ Install [devbox](https://github.com/jetpack-io/devbox), which is a wrapper for n
|
||||
```
|
||||
devbox shell
|
||||
```
|
||||
|
||||
## Unit Tests
|
||||
|
||||
There are basic unit tests, see `unittest_extract_otp_secret_keys.py`.
|
||||
|
||||
Run unit tests:
|
||||
|
||||
```
|
||||
python -m unittest
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user