update docs

This commit is contained in:
scito 2023-01-01 10:03:44 +01:00
parent 13fcdcd022
commit 19c8e9df23
5 changed files with 52 additions and 20 deletions

View file

@ -1,5 +1,8 @@
name: tests name: tests
# https://docs.github.com/de/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/using-workflows
on: on:
push: push:
pull_request: pull_request:

View file

@ -1,5 +1,8 @@
name: docker name: docker
# https://docs.github.com/de/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/using-workflows
# How to setup: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions/ # How to setup: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions/
# How to run: https://aschmelyun.com/blog/using-docker-run-inside-of-github-actions/ # How to run: https://aschmelyun.com/blog/using-docker-run-inside-of-github-actions/
@ -8,7 +11,10 @@ on:
push: push:
# branches: [master] # branches: [master]
# run it during pull request # run it during pull request
# pull_request: pull_request:
schedule:
# Run weekly
- cron: '47 3 * * 6'
jobs: jobs:
# define job to build and publish docker image # define job to build and publish docker image

View file

@ -1,5 +1,7 @@
FROM python:3.11-slim-bullseye FROM python:3.11-slim-bullseye
# https://docs.docker.com/engine/reference/builder/
# For debugging # For debugging
# docker build . -t extract_otp_secrets --pull --build-arg RUN_TESTS=false # docker build . -t extract_otp_secrets --pull --build-arg RUN_TESTS=false
# docker run --rm -v "$(pwd)":/files:ro extract_otp_secrets # docker run --rm -v "$(pwd)":/files:ro extract_otp_secrets
@ -12,7 +14,11 @@ COPY . .
ARG RUN_TESTS=true ARG RUN_TESTS=true
RUN apt-get update && apt-get install -y libzbar0 libsm6 python3-opencv nano \ RUN apt-get update && apt-get install -y \
libzbar0 \
libsm6 \
python3-opencv \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir -r requirements.txt \
&& if [ "$RUN_TESTS" = "true" ]; then /extract/run_pytest.sh; else echo "Not running tests..."; fi && if [ "$RUN_TESTS" = "true" ]; then /extract/run_pytest.sh; else echo "Not running tests..."; fi

View file

@ -1,5 +1,7 @@
FROM python:3.11-alpine FROM python:3.11-alpine
# https://docs.docker.com/engine/reference/builder/
# For debugging # For debugging
# docker run --rm -v "$(pwd)":/files:ro extract_otp_secrets_only_txt # docker run --rm -v "$(pwd)":/files:ro extract_otp_secrets_only_txt
# docker build . -t extract_otp_secrets_only_txt -f Dockerfile_only_txt --pull --build-arg RUN_TESTS=false # docker build . -t extract_otp_secrets_only_txt -f Dockerfile_only_txt --pull --build-arg RUN_TESTS=false
@ -12,10 +14,23 @@ COPY . .
ARG RUN_TESTS=true ARG RUN_TESTS=true
RUN apk add --no-cache zlib jpeg \ RUN apk add --no-cache \
zlib \
jpeg \
&& echo "Arch: $(apk --print-arch)" \ && echo "Arch: $(apk --print-arch)" \
&& if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk add --no-cache --virtual .build-deps gcc libc-dev python3-dev py3-setuptools zlib-dev jpeg-dev; fi \ && if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk add --no-cache --virtual .build-deps \
&& pip install --no-cache-dir protobuf qrcode Pillow colorama \ gcc \
libc-dev \
python3-dev \
py3-setuptools \
zlib-dev \
jpeg-dev \
; fi \
&& pip install --no-cache-dir \
protobuf \
qrcode \
Pillow \
colorama \
&& if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk del .build-deps; fi \ && if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk del .build-deps; fi \
&& if [[ "$RUN_TESTS" == "true" ]]; then /extract/run_pytest.sh tests/extract_otp_secrets_test.py -k "not qreader" --relaxed; else echo "Not running tests..."; fi && if [[ "$RUN_TESTS" == "true" ]]; then /extract/run_pytest.sh tests/extract_otp_secrets_test.py -k "not qreader" --relaxed; else echo "Not running tests..."; fi

View file

@ -108,6 +108,8 @@ For a detailed installation documentation of [pyzbar](https://github.com/Natural
The zbar DLLs are included with the Windows Python wheels. On other operating systems, you will need to install the zbar shared library. The zbar DLLs are included with the Windows Python wheels. On other operating systems, you will need to install the zbar shared library.
TODO Write installation, not error message
##### Windows error message ##### Windows error message
If you see an ugly ImportError when importing [pyzbar](https://pypi.org/project/pyzbar/) on Windows you will most likely need the [Visual C++ Redistributable Packages for Visual Studio 2013](https://www.microsoft.com/en-US/download/details.aspx?id=40784). Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python. If you see an ugly ImportError when importing [pyzbar](https://pypi.org/project/pyzbar/) on Windows you will most likely need the [Visual C++ Redistributable Packages for Visual Studio 2013](https://www.microsoft.com/en-US/download/details.aspx?id=40784). Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.
@ -196,8 +198,8 @@ FileNotFoundError: Could not find module 'libiconv.dll' (or one of its dependenc
* JSON * JSON
* Dedicated CSV for KeePass * Dedicated CSV for KeePass
* QR code images * QR code images
* Supports reading from stdin and writing to stdout * Supports reading from stdin and writing to stdout, thus pipes can be used
* Reads QR codes images: (See [OpenCV docu](https://docs.opencv.org/3.4/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56)) * Reads QR codes images: (See [OpenCV docu](https://docs.opencv.org/4.x/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56))
* Portable Network Graphics - *.png * Portable Network Graphics - *.png
* WebP - *.webp * WebP - *.webp
* JPEG files - *.jpeg, *.jpg, *.jpe * JPEG files - *.jpeg, *.jpg, *.jpe
@ -205,11 +207,7 @@ FileNotFoundError: Could not find module 'libiconv.dll' (or one of its dependenc
* Windows bitmaps - *.bmp, *.dib * Windows bitmaps - *.bmp, *.dib
* JPEG 2000 files - *.jp2 * JPEG 2000 files - *.jp2
* Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm * Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm
* Sun rasters - *.sr, *.ras * Errors and warnings are written to stderr and these are printed in red color on all platforms
* OpenEXR Image files - *.exr
* Radiance HDR - *.hdr, *.pic
* Raster and Vector geospatial data supported by GDAL
* Errors and warnings are written to stderr
* Many ways to run the script: * Many ways to run the script:
* Native Python * Native Python
* pipenv * pipenv
@ -224,6 +222,7 @@ FileNotFoundError: Could not find module 'libiconv.dll' (or one of its dependenc
* Windows * Windows
* Uses UTF-8 on all platforms * Uses UTF-8 on all platforms
* Supports Python >= 3.7 * Supports Python >= 3.7
* Written in modern Python using type hints and following best practices
* All these features are backed by tests ran nightly * All these features are backed by tests ran nightly
* All functionality in one Python script: extract_otp_secrets.py (except protobuf generated code in protobuf_generated_python) * All functionality in one Python script: extract_otp_secrets.py (except protobuf generated code in protobuf_generated_python)
@ -297,14 +296,14 @@ https://github.com/nipunn1313/mypy-protobuf
### pip ### pip
``` ```
pip install git+https://github.com/scito/extract_otp_secret_keys pip install -U git+https://github.com/scito/extract_otp_secret_keys
python -m extract_otp_secrets python -m extract_otp_secrets
``` ```
#### For development #### For development
``` ```
pip install git+https://github.com/scito/extract_otp_secret_keys@support_img_read pip install -U git+https://github.com/scito/extract_otp_secret_keys.git@support_img_read
python -m extract_otp_secrets python -m extract_otp_secrets
``` ```
@ -312,9 +311,9 @@ python -m extract_otp_secrets
https://stackoverflow.com/questions/13685920/install-specific-git-commit-with-pip https://stackoverflow.com/questions/13685920/install-specific-git-commit-with-pip
-e for egg -e for egg
pip install -e git+<https://github.com/myrepo.git#egg=packagename> pip install -U -e git+<https://github.com/myrepo.git#egg=packagename>
# pip install -e git+https://github.com/scito/extract_otp_secret_keys@$(git ls-remote git@github.com:scito/extract_otp_secret_keys@support_img_read.git | head -1 | awk '{print $1;}')#egg=extract_otp_secrets # pip install -U -e git+https://github.com/scito/extract_otp_secret_keys@$(git ls-remote git@github.com:scito/extract_otp_secret_keys@support_img_read.git | head -1 | awk '{print $1;}')#egg=extract_otp_secrets
pip3.11 install -e git+https://github.com/scito/extract_otp_secret_keys.git@$(git ls-remote git@github.com:scito/extract_otp_secret_keys.git | grep support_img_read | head -1 | awk '{print $1;}')#egg=extract_otp_secrets pip3.11 install -e git+https://github.com/scito/extract_otp_secret_keys.git@$(git ls-remote git@github.com:scito/extract_otp_secret_keys.git | grep support_img_read | head -1 | awk '{print $1;}')#egg=extract_otp_secrets
python -m extract_otp_secrets python -m extract_otp_secrets
``` ```
@ -329,7 +328,7 @@ python -m extract_otp_secrets example_export.txt
### local pip ### local pip
``` ```
pip install -e . pip install -U -e .
``` ```
### pipenv ### pipenv
@ -362,8 +361,8 @@ Alternatively, you can use a python virtual env for the dependencies:
python -m venv venv python -m venv venv
. venv/bin/activate . venv/bin/activate
pip install -r requirements-dev.txt pip install -U -r requirements-dev.txt
pip install -r requirements.txt pip install -U -r requirements.txt
The requirements\*.txt files contain all the dependencies (also the optional ones). The requirements\*.txt files contain all the dependencies (also the optional ones).
To leave the python virtual env just call `deactivate`. To leave the python virtual env just call `deactivate`.
@ -444,6 +443,8 @@ Run tests:
python -m unittest python -m unittest
``` ```
Note the `pytest`s are preferred and more complete. For each unittest there is also a test in `pytest`.
### VSCode Setup ### VSCode Setup
Setup for running the tests in VSCode. Setup for running the tests in VSCode.
@ -458,7 +459,7 @@ Setup for running the tests in VSCode.
### Build ### Build
``` ```
pip install -e . pip install -U -e .
python src/extract_otp_secrets.py python src/extract_otp_secrets.py
pip wheel . pip wheel .
@ -483,6 +484,7 @@ pip install -U -r requirements.txt
* [Android OTP Extractor](https://github.com/puddly/android-otp-extractor) can extract your tokens from popular Android OTP apps and export them in a standard format or just display them as QR codes for easy importing. [Requires a _rooted_ Android phone.] * [Android OTP Extractor](https://github.com/puddly/android-otp-extractor) can extract your tokens from popular Android OTP apps and export them in a standard format or just display them as QR codes for easy importing. [Requires a _rooted_ Android phone.]
* [Python QReader](https://github.com/Eric-Canas/QReader) * [Python QReader](https://github.com/Eric-Canas/QReader)
* [pyzbar](https://github.com/NaturalHistoryMuseum/pyzbar) * [pyzbar](https://github.com/NaturalHistoryMuseum/pyzbar)
* [OpenCV](https://docs.opencv.org/4.x/) (CV2) Open Source Computer Vision library with [opencv-python](https://github.com/opencv/opencv-python)
*** ***