mirror of
https://github.com/scito/extract_otp_secrets.git
synced 2025-12-12 17:59:48 +01:00
Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccbcf1f2b9 | ||
|
|
0a0baebaad | ||
|
|
96e92dc295 | ||
|
|
6b163cd377 | ||
|
|
c9d30e8aca | ||
|
|
3aad6677d8 | ||
|
|
957a9d1f8f | ||
|
|
d6677623ec | ||
|
|
5febef269a | ||
|
|
7c3530cf27 | ||
|
|
d9b6211715 | ||
|
|
dab2599d29 | ||
|
|
37738e8990 | ||
|
|
4e968334ca | ||
|
|
d04902e749 | ||
|
|
4ea404f16f | ||
|
|
4d0b5db83f | ||
|
|
7f8e69fe8c | ||
|
|
c8fa3bb6c0 | ||
|
|
93406cfcbb | ||
|
|
c11854e164 | ||
|
|
0094422e9d | ||
|
|
d4d22e692b | ||
|
|
66e166c51c | ||
|
|
c51ac0bdde | ||
|
|
949ee29fa4 | ||
|
|
6e20d73b12 | ||
|
|
f629c7f3e4 | ||
|
|
6c3dbe48e9 | ||
|
|
b5dedda9a8 | ||
|
|
6e32b7b18e | ||
|
|
5fa99a17d7 | ||
|
|
563308700a | ||
|
|
716194da48 | ||
|
|
bb41c737ef | ||
|
|
bb4c3da0bf | ||
|
|
e0dac0fd99 | ||
|
|
3040965d79 | ||
|
|
3899f5f826 | ||
|
|
f82c79aa7d | ||
|
|
68ced0f2ec | ||
|
|
d1ce4c0ba4 | ||
|
|
ed7a9f5143 | ||
|
|
8f7c267153 | ||
|
|
0c68efd06e | ||
|
|
5f01b50635 | ||
|
|
cf618281d8 | ||
|
|
e3a1443b9b | ||
|
|
863f3f3128 | ||
|
|
edee97a54c | ||
|
|
e01c81aca1 | ||
|
|
f713a8ef39 | ||
|
|
bfc2c0d853 | ||
|
|
8a8e92bfef | ||
|
|
d26a521997 | ||
|
|
223f1e4b5b | ||
|
|
5ffa2d9dcc | ||
|
|
5c9c680561 | ||
|
|
c9cdc10a73 | ||
|
|
750ca3e13b | ||
|
|
a2bf1533ae | ||
|
|
7fa0e3f555 | ||
|
|
56e74d5ccb | ||
|
|
10737a91c4 | ||
|
|
d29eab943e | ||
|
|
e17fed8704 | ||
|
|
b09d2c6c1f | ||
|
|
208e6e60fc | ||
|
|
1851664c96 | ||
|
|
ab0cd6717a | ||
|
|
ccb52cc8b5 | ||
|
|
41ed2b62d4 | ||
|
|
b6ab6417cb | ||
|
|
e857912c74 | ||
|
|
ac18fbf020 | ||
|
|
494a9f8446 |
17
.github/copilot-instructions.md
vendored
Normal file
17
.github/copilot-instructions.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copilot Instructions
|
||||
|
||||
This project is a web application that allows users to create and manage tasks. The application is built using Python.
|
||||
|
||||
## Coding Standards
|
||||
|
||||
- Use snakeCase for variable and function names.
|
||||
- Use PascalCase for component names.
|
||||
- Use double quotes for strings.
|
||||
- Use 4 spaces for indentation.
|
||||
|
||||
## Tone
|
||||
|
||||
- If I tell you that you are wrong, think about whether or not you think that's true and respond with facts.
|
||||
- Avoid apologizing or making conciliatory statements.
|
||||
- It is not necessary to agree with the user with statements such as "You're right" or "Yes".
|
||||
- Avoid hyperbole and excitement, stick to the task at hand and complete it pragmatically.
|
||||
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -19,21 +19,23 @@ jobs:
|
||||
build:
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# 3.x is used to run code coverage
|
||||
python-version: ["3.x", "3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm, macos-13]
|
||||
# exclude:
|
||||
python-version: ["3.x", "3.14", "3.13", "3.12", "3.11", "3.10", "3.9"]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm, macos-15-intel]
|
||||
# exclude:
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
check-latest: ${{ github.event_name == 'schedule' }}
|
||||
allow-prereleases: false
|
||||
- name: Install zbar shared lib for QReader (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
|
||||
40
.github/workflows/ci_docker.yml
vendored
40
.github/workflows/ci_docker.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
# steps to perform in job
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# avoid building if there are testing errors
|
||||
- name: Run smoke test
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
|
||||
- name: "Build image (Bookworm/Debian 12) and push to Docker Hub and GitHub Container Registry"
|
||||
id: docker_build_qr_reader_latest
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/${{ matrix.DOCKER_ARCH }}
|
||||
# relative path to the place where source code with Dockerfile is located
|
||||
@@ -95,6 +95,8 @@ jobs:
|
||||
docker.io/scit0/extract_otp_secrets:bookworm-${{ matrix.PLATFORM_ARCH }}
|
||||
ghcr.io/scito/extract_otp_secrets:latest-${{ matrix.PLATFORM_ARCH }}
|
||||
ghcr.io/scito/extract_otp_secrets:bookworm-${{ matrix.PLATFORM_ARCH }}
|
||||
provenance: true
|
||||
sbom: true
|
||||
# build on feature branches, push only on master branch
|
||||
push: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
|
||||
@@ -112,6 +114,7 @@ jobs:
|
||||
|
||||
create-multiarch-debian-manifests:
|
||||
name: Create multiarch manifests for Debian image
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-and-push-docker-debian-image
|
||||
@@ -132,6 +135,7 @@ jobs:
|
||||
password: ${{ secrets.GHCR_IO_TOKEN }}
|
||||
|
||||
- name: Create multiarch manifests
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
shell: bash
|
||||
run: |
|
||||
for tag in \
|
||||
@@ -164,7 +168,7 @@ jobs:
|
||||
# steps to perform in job
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# avoid building if there are testing errors
|
||||
- name: Run smoke test
|
||||
@@ -200,7 +204,7 @@ jobs:
|
||||
|
||||
- name: "only_txt: Build image and push to Docker Hub and GitHub Container Registry"
|
||||
id: docker_build_only_txt
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/${{ matrix.DOCKER_ARCH }}
|
||||
# relative path to the place where source code with Dockerfile is located
|
||||
@@ -214,8 +218,10 @@ jobs:
|
||||
docker.io/scit0/extract_otp_secrets:alpine-${{ matrix.PLATFORM_ARCH }}
|
||||
ghcr.io/scito/extract_otp_secrets:only-txt-${{ matrix.PLATFORM_ARCH }}
|
||||
ghcr.io/scito/extract_otp_secrets:alpine-${{ matrix.PLATFORM_ARCH }}
|
||||
provenance: true
|
||||
sbom: true
|
||||
# build on feature branches, push only on master branch
|
||||
push: true # ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
push: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
build-args: |
|
||||
RUN_TESTS=true
|
||||
|
||||
@@ -234,6 +240,7 @@ jobs:
|
||||
|
||||
create-multiarch-alpine-manifests:
|
||||
name: Create multiarch manifests for Alpine image
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-and-push-docker-alpine-image
|
||||
@@ -257,6 +264,7 @@ jobs:
|
||||
password: ${{ secrets.GHCR_IO_TOKEN }}
|
||||
|
||||
- name: Create multiarch manifests
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
shell: bash
|
||||
run: |
|
||||
for tag in \
|
||||
@@ -288,7 +296,7 @@ jobs:
|
||||
# steps to perform in job
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# avoid building if there are testing errors
|
||||
- name: Run smoke test
|
||||
@@ -325,7 +333,7 @@ jobs:
|
||||
- name: "Build image from Bullseye (Debian 11) and push to GitHub Container Registry"
|
||||
id: docker_build_bullseye
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/${{ matrix.DOCKER_ARCH }}
|
||||
# relative path to the place where source code with Dockerfile is located
|
||||
@@ -339,6 +347,8 @@ jobs:
|
||||
tags: |
|
||||
docker.io/scit0/extract_otp_secrets:bullseye-${{ matrix.PLATFORM_ARCH }}
|
||||
ghcr.io/scito/extract_otp_secrets:bullseye-${{ matrix.PLATFORM_ARCH }}
|
||||
provenance: true
|
||||
sbom: true
|
||||
push: ${{ github.secret_source == 'Actions' }}
|
||||
|
||||
- name: Image digest
|
||||
@@ -356,6 +366,7 @@ jobs:
|
||||
create-multiarch-bullseye-manifests:
|
||||
name: Create multiarch manifests for Bullseye image
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
needs:
|
||||
- build-and-push-docker-bullseye-image
|
||||
steps:
|
||||
@@ -374,7 +385,8 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GHCR_IO_TOKEN }}
|
||||
|
||||
- name: Create multiarch manifests
|
||||
- name:
|
||||
if: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}}
|
||||
shell: bash
|
||||
run: |
|
||||
for tag in \
|
||||
@@ -386,3 +398,15 @@ jobs:
|
||||
$tag-arm64
|
||||
done
|
||||
|
||||
container-images-clean-up:
|
||||
name: Cleanup old container images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Delete Container Packages
|
||||
uses: actions/delete-package-versions@v5
|
||||
if: ${{ github.secret_source == 'Actions'}}
|
||||
with:
|
||||
package-name: 'extract_otp_secrets'
|
||||
package-type: 'container'
|
||||
min-versions-to-keep: 1
|
||||
delete-only-untagged-versions: 'true'
|
||||
|
||||
19
.github/workflows/ci_release.yml
vendored
19
.github/workflows/ci_release.yml
vendored
@@ -57,7 +57,7 @@ jobs:
|
||||
tag_message: ${{ steps.meta.outputs.tag_message }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: Set meta data
|
||||
id: meta
|
||||
# Writing to env with >> $GITHUB_ENV is an alternative
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
# steps to perform in job
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# avoid building if there are testing errors
|
||||
- name: Run smoke test
|
||||
@@ -196,7 +196,7 @@ jobs:
|
||||
docker run --pull always --entrypoint /bin/bash --rm -v "$(pwd)":/files -w /files docker.io/scit0/extract_otp_secrets -c 'dist/${{ matrix.EXE }} -V && dist/${{ matrix.EXE }} -h && dist/${{ matrix.EXE }} example_export.png && dist/${{ matrix.EXE }} - < example_export.txt && dist/${{ matrix.EXE }} --qr ZBAR example_export.png && dist/${{ matrix.EXE }} --qr QREADER example_export.png && dist/${{ matrix.EXE }} --qr QREADER_DEEP example_export.png && dist/${{ matrix.EXE }} --qr CV2 example_export.png && dist/${{ matrix.EXE }} --qr CV2_WECHAT example_export.png'
|
||||
- name: Load Release URL File from release job
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: release_url
|
||||
- name: Display structure of files
|
||||
@@ -226,6 +226,7 @@ jobs:
|
||||
needs: create-release
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
|
||||
include:
|
||||
@@ -257,7 +258,7 @@ jobs:
|
||||
UPLOAD: false
|
||||
CMD_BUILD: |
|
||||
pyinstaller -y --add-data $pythonLocation/__yolo_v3_qr_detector/:__yolo_v3_qr_detector/ --onefile --name extract_otp_secrets_ubuntu_arm64 src/extract_otp_secrets.py
|
||||
- os: macos-13
|
||||
- os: macos-15-intel
|
||||
TARGET: macos
|
||||
# https://pyinstaller.org/en/stable/spec-files.html#spec-file-options-for-a-macos-bundle
|
||||
EXE: extract_otp_secrets
|
||||
@@ -291,12 +292,12 @@ jobs:
|
||||
- name: List Windir
|
||||
if: runner.os == 'Windows'
|
||||
run: ls "$($Env:WinDir)\system32"
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set macos macos_python_path
|
||||
# TODO use variable for Python version
|
||||
run: echo "macos_python_path=/Library/Frameworks/Python.framework/Versions/3.13" >> $GITHUB_ENV
|
||||
- name: Set up Python 3.13
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: 3.13
|
||||
check-latest: true
|
||||
@@ -341,12 +342,12 @@ jobs:
|
||||
dist/${{ matrix.EXE }} - < example_export.txt
|
||||
- name: Load Release URL File from release job
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: release_url
|
||||
- name: Load Release Id File from release job
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: release_id
|
||||
- name: Display structure of files
|
||||
@@ -389,7 +390,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Load Release Id File from release job
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: release_id
|
||||
- name: Set meta data
|
||||
|
||||
4
Pipfile
4
Pipfile
@@ -4,14 +4,14 @@ verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
colorama = ">=0.4.6"
|
||||
colorama = "0.4.6"
|
||||
opencv-contrib-python = "*"
|
||||
# for macOS: opencv-contrib-python = "<=4.7.0"
|
||||
pillow = "*"
|
||||
pyzbar = "*"
|
||||
protobuf = "*"
|
||||
qrcode = "*"
|
||||
qreader = "<2.0.0"
|
||||
qreader = "1.3.2"
|
||||
|
||||
[dev-packages]
|
||||
build = "*"
|
||||
|
||||
990
Pipfile.lock
generated
990
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
10
README.md
10
README.md
@@ -5,7 +5,7 @@
|
||||

|
||||
[](https://github.com/scito/extract_otp_secrets/blob/master/LICENSE)
|
||||
[](https://github.com/scito/extract_otp_secrets/releases/latest)
|
||||

|
||||

|
||||
[](https://hub.docker.com/repository/docker/scit0/extract_otp_secrets/general)
|
||||
[](https://github.com/scito/extract_otp_secrets/releases/latest)
|
||||
[](https://github.com/scito/extract_otp_secrets/releases/latest)
|
||||
@@ -14,7 +14,7 @@
|
||||
[](https://stand-with-ukraine.pp.ua)
|
||||
<!-- 
|
||||
[](https://github.com/scito/extract_otp_secrets/blob/master/Pipfile.lock)
|
||||
-->
|
||||
-->
|
||||
|
||||
<!-- [](https://GitHub.com/scito/extract_otp_secrets/releases/) -->
|
||||
|
||||
@@ -366,7 +366,7 @@ python extract_otp_secrets.py = < example_export.png</pre>
|
||||
* extract_otp_secrets_macos_x86_64 (optional [libzbar](#installation-of-optional-shared-system-libraries-recommended) needs to be installed manually if needed)
|
||||
* extract_otp_secrets_macos_x86_64.dmg N/A, see [why](#macos)
|
||||
* extract_otp_secrets_macos_x86_64.pkg N/A, see [why](#macos)
|
||||
* Prebuilt Docker images provided for amd64 and arm64 (🆕 since v2.0)
|
||||
* Prebuilt Docker images provided for amd64 and arm64 on [Docker Hub](https://hub.docker.com/repository/docker/scit0/extract_otp_secrets) and [GitHub Packages](https://github.com/users/scito/packages/container/package/extract_otp_secrets) (🆕 since v2.0)
|
||||
* Many ways to run the script:
|
||||
* Native Python
|
||||
* pipenv
|
||||
@@ -380,7 +380,7 @@ python extract_otp_secrets.py = < example_export.png</pre>
|
||||
* macOS
|
||||
* Windows
|
||||
* Uses UTF-8 on all platforms
|
||||
* Supports Python >= 3.8
|
||||
* Supports Python >= 3.9
|
||||
* Installation of shared system libraries is optional (🆕 since v2.3)
|
||||
* Provides a debug mode (-d) for analyzing import problems
|
||||
* Written in modern Python using type hints and following best practices
|
||||
@@ -729,7 +729,7 @@ Command for regeneration of Python code from proto3 message definition file (onl
|
||||
|
||||
protoc --plugin=protoc-gen-mypy=path/to/protoc-gen-mypy --python_out=src/protobuf_generated_python --mypy_out=src/protobuf_generated_python src/google_auth.proto
|
||||
|
||||
The generated protobuf Python code was generated by protoc 29.3 (https://github.com/protocolbuffers/protobuf/releases/tag/v29.3).
|
||||
The generated protobuf Python code was generated by protoc 32.1 (https://github.com/protocolbuffers/protobuf/releases/tag/v32.1).
|
||||
|
||||
For Python type hint generation the [mypy-protobuf](https://github.com/nipunn1313/mypy-protobuf) package is used.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ requires = [
|
||||
"pip",
|
||||
"nuitka",
|
||||
# https://setuptools-git-versioning.readthedocs.io/en/latest/differences.html
|
||||
"setuptools>=64.0.0",
|
||||
"setuptools>=80.0.0",
|
||||
"setuptools-git-versioning",
|
||||
"wheel>=0.37.0",
|
||||
]
|
||||
@@ -21,12 +21,12 @@ classifiers = [
|
||||
"Topic :: Utilities",
|
||||
"Topic :: Security",
|
||||
"Topic :: Multimedia :: Graphics :: Capture :: Digital Camera",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: 3.14",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: System Administrators",
|
||||
@@ -55,7 +55,7 @@ license = {text = "GNU General Public License v3 (GPLv3)"}
|
||||
readme = "README.md"
|
||||
authors = [{name = "scito", email = "info@scito.ch"}]
|
||||
maintainers = [{name = "scito", email = "info@scito.ch"}]
|
||||
requires-python = ">=3.8, <4"
|
||||
requires-python = ">=3.9, <4"
|
||||
scripts = {extract_otp_secrets = "extract_otp_secrets:sys_main"}
|
||||
urls = {Project-URL = "https://github.com/scito/extract_otp_secrets", Bug-Reports = "https://github.com/scito/extract_otp_secrets/issues", Source = "https://github.com/scito/extract_otp_secrets"}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = extract_otp_secrets
|
||||
|
||||
[options]
|
||||
python_requires = >=3.8, <4
|
||||
python_requires = >=3.9, <4
|
||||
py_modules = extract_otp_secrets, protobuf_generated_python.google_auth_pb2
|
||||
package_dir =
|
||||
=src
|
||||
|
||||
@@ -380,14 +380,22 @@ def extract_otps_from_camera(args: Args) -> Otps:
|
||||
qr_mode = next_qr_mode(qr_mode)
|
||||
continue
|
||||
|
||||
cv2_print_text(img, f"Mode: {qr_mode.name} (Hit SPACE to change)", 0, TextPosition.LEFT, FONT_COLOR, 20)
|
||||
cv2_print_text(img, "Press ESC to quit", 1, TextPosition.LEFT, FONT_COLOR, 17)
|
||||
cv2_print_text(img, "Press c,j,k,t,u to save as csv/json/keepass/txt/urls file", 2, TextPosition.LEFT, FONT_COLOR, None)
|
||||
try:
|
||||
cv2_print_text(img, f"Mode: {qr_mode.name} (Hit SPACE to change)", 0, TextPosition.LEFT, FONT_COLOR, 20)
|
||||
cv2_print_text(img, "Press ESC to quit", 1, TextPosition.LEFT, FONT_COLOR, 17)
|
||||
cv2_print_text(img, "Press c,j,k,t,u to save as csv/json/keepass/txt/urls file", 2, TextPosition.LEFT, FONT_COLOR, None)
|
||||
|
||||
cv2_print_text(img, f"{len(otp_urls)} QR code{'s'[:len(otp_urls) != 1]} captured", 0, TextPosition.RIGHT, FONT_COLOR)
|
||||
cv2_print_text(img, f"{len(otps)} otp{'s'[:len(otps) != 1]} extracted", 1, TextPosition.RIGHT, FONT_COLOR)
|
||||
cv2_print_text(img, f"{len(otp_urls)} QR code{'s'[:len(otp_urls) != 1]} captured", 0, TextPosition.RIGHT, FONT_COLOR)
|
||||
cv2_print_text(img, f"{len(otps)} otp{'s'[:len(otps) != 1]} extracted", 1, TextPosition.RIGHT, FONT_COLOR)
|
||||
|
||||
cv2.imshow(WINDOW_NAME, img)
|
||||
cv2.imshow(WINDOW_NAME, img)
|
||||
except cv2.error as e:
|
||||
# Workaround due to Gtk2/3 problem, see #444
|
||||
if e.code == cv2.Error.StsNullPtr:
|
||||
# Window closed
|
||||
break
|
||||
else:
|
||||
raise e
|
||||
|
||||
quit, qr_mode = cv2_handle_pressed_keys(qr_mode, otps)
|
||||
if quit:
|
||||
@@ -449,7 +457,7 @@ def cv2_handle_pressed_keys(qr_mode: QRMode, otps: Otps) -> Tuple[bool, QRMode]:
|
||||
defaultextension='.csv',
|
||||
filetypes=[('CSV', '*.csv'), ('All', '*.*')]
|
||||
)
|
||||
tk_root.update()
|
||||
tk_root.update() # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
if len(file_name) > 0:
|
||||
write_csv(file_name, otps)
|
||||
elif (key == ord('j') or key == ord('J')) and is_not_headless():
|
||||
@@ -461,7 +469,7 @@ def cv2_handle_pressed_keys(qr_mode: QRMode, otps: Otps) -> Tuple[bool, QRMode]:
|
||||
defaultextension='.json',
|
||||
filetypes=[('JSON', '*.json'), ('All', '*.*')]
|
||||
)
|
||||
tk_root.update()
|
||||
tk_root.update() # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
if len(file_name) > 0:
|
||||
write_json(file_name, otps)
|
||||
elif (key == ord('k') or key == ord('K')) and is_not_headless():
|
||||
@@ -473,7 +481,7 @@ def cv2_handle_pressed_keys(qr_mode: QRMode, otps: Otps) -> Tuple[bool, QRMode]:
|
||||
defaultextension='.csv',
|
||||
filetypes=[('CSV', '*.csv'), ('All', '*.*')]
|
||||
)
|
||||
tk_root.update()
|
||||
tk_root.update() # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
if len(file_name) > 0:
|
||||
write_keepass_csv(file_name, otps)
|
||||
elif (key == ord('t') or key == ord('T')) and is_not_headless():
|
||||
@@ -485,7 +493,7 @@ def cv2_handle_pressed_keys(qr_mode: QRMode, otps: Otps) -> Tuple[bool, QRMode]:
|
||||
defaultextension='.txt',
|
||||
filetypes=[('Text', '*.txt'), ('All', '*.*')]
|
||||
)
|
||||
tk_root.update()
|
||||
tk_root.update() # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
if len(file_name) > 0:
|
||||
write_txt(file_name, otps, True)
|
||||
elif (key == ord('u') or key == ord('U')) and is_not_headless():
|
||||
@@ -497,15 +505,13 @@ def cv2_handle_pressed_keys(qr_mode: QRMode, otps: Otps) -> Tuple[bool, QRMode]:
|
||||
defaultextension='.txt',
|
||||
filetypes=[('Text', '*.txt'), ('All', '*.*')]
|
||||
)
|
||||
tk_root.update()
|
||||
tk_root.update() # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
if len(file_name) > 0:
|
||||
write_urls(file_name, otps)
|
||||
elif key == 32:
|
||||
qr_mode = next_valid_qr_mode(qr_mode, zbar_available)
|
||||
if verbose >= LogLevel.MORE_VERBOSE: print(f"QR reading mode: {qr_mode}")
|
||||
if cv2.getWindowProperty(WINDOW_NAME, cv2.WND_PROP_VISIBLE) < 1:
|
||||
# Window close clicked
|
||||
quit = True
|
||||
# Do not check for invisible window due to Gtk2/3 problem, see #444
|
||||
return quit, qr_mode
|
||||
|
||||
|
||||
@@ -837,7 +843,7 @@ def check_file_exists(filename: str) -> None:
|
||||
def has_no_otps_show_warning(otps: Otps) -> bool:
|
||||
if len(otps) == 0:
|
||||
tkinter.messagebox.showinfo(title="No data", message="There are no otp secrets to write")
|
||||
tk_root.update() # dispose dialog
|
||||
tk_root.update() # dispose dialog # noqa: F821 # workaround flake8 false positive, tk_root is defined globally
|
||||
return len(otps) == 0
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# NO CHECKED-IN PROTOBUF GENCODE
|
||||
# source: google_auth.proto
|
||||
# Protobuf Python Version: 5.29.3
|
||||
# Protobuf Python Version: 6.32.1
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
@@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||
_runtime_version.Domain.PUBLIC,
|
||||
5,
|
||||
29,
|
||||
3,
|
||||
6,
|
||||
32,
|
||||
1,
|
||||
'',
|
||||
'google_auth.proto'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user