From 50ff7529d28acfcabc9a9df7f3e9064480f01627 Mon Sep 17 00:00:00 2001 From: terrtia Date: Tue, 30 Apr 2024 10:17:04 +0200 Subject: [PATCH 1/4] fix: [ocr] catch OSError on MP4 files --- bin/modules/OcrExtractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/modules/OcrExtractor.py b/bin/modules/OcrExtractor.py index 03b03724..cc9ea8db 100755 --- a/bin/modules/OcrExtractor.py +++ b/bin/modules/OcrExtractor.py @@ -103,7 +103,7 @@ class OcrExtractor(AbstractModule): print(image.id, languages) try: texts = Ocrs.extract_text(path, languages) - except ValueError as e: + except (OSError, ValueError) as e: self.logger.warning(e) self.obj.add_tag('infoleak:confirmed="false-positive"') texts = None From e21257a3fe82d8490672b9314ac8ab038c8cd10e Mon Sep 17 00:00:00 2001 From: terrtia Date: Tue, 30 Apr 2024 11:57:21 +0200 Subject: [PATCH 2/4] fix: [pgpdump] fix installer, new pgpdump version require to launch autoreconf --- installing_deps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installing_deps.sh b/installing_deps.sh index c681249b..996d0dfb 100755 --- a/installing_deps.sh +++ b/installing_deps.sh @@ -72,6 +72,7 @@ popd # pgpdump test ! -d pgpdump && git clone https://github.com/kazu-yamamoto/pgpdump.git pushd pgpdump/ +autoreconf -fiW all ./configure make sudo make install From adbce241285be975b868bf4c446b76e2e5f8ceac Mon Sep 17 00:00:00 2001 From: terrtia Date: Thu, 2 May 2024 10:36:20 +0200 Subject: [PATCH 3/4] fix: [ocr] catch cv2 errors --- bin/modules/OcrExtractor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/modules/OcrExtractor.py b/bin/modules/OcrExtractor.py index cc9ea8db..b96c030e 100755 --- a/bin/modules/OcrExtractor.py +++ b/bin/modules/OcrExtractor.py @@ -9,6 +9,7 @@ The OcrExtractor Module ################################## # Import External packages ################################## +import cv2 import os import sys @@ -103,7 +104,7 @@ class OcrExtractor(AbstractModule): print(image.id, languages) try: texts = Ocrs.extract_text(path, languages) - except (OSError, ValueError) as e: + except (OSError, ValueError, cv2.error) as e: self.logger.warning(e) self.obj.add_tag('infoleak:confirmed="false-positive"') texts = None From 0c28b3863862a12b8c922cfceb8cf44538291632 Mon Sep 17 00:00:00 2001 From: terrtia Date: Mon, 6 May 2024 11:31:37 +0200 Subject: [PATCH 4/4] fix: [language detector] fix exception if the libretranslate url is not specified --- bin/lib/Language.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/lib/Language.py b/bin/lib/Language.py index a53391d8..87a2db31 100755 --- a/bin/lib/Language.py +++ b/bin/lib/Language.py @@ -440,7 +440,11 @@ def delete_obj_translation(obj_global_id, language, field=''): class LanguagesDetector: def __init__(self, nb_langs=3, min_proportion=0.2, min_probability=-1, min_len=0): - self.lt = LibreTranslateAPI(get_translator_instance()) + lt_url = get_translator_instance() + if not lt_url: + self.lt = None + else: + self.lt = LibreTranslateAPI(get_translator_instance()) try: self.lt.languages() except Exception: