From 2e602959ce221d627e705b891fdfec06a7eed47f Mon Sep 17 00:00:00 2001 From: Zeecka Date: Fri, 2 Jan 2026 20:51:44 +0100 Subject: [PATCH] mypy --- aperisolve/analyzers/base_analyzer.py | 4 +++- aperisolve/analyzers/binwalk.py | 2 +- aperisolve/analyzers/decomposer.py | 2 +- aperisolve/analyzers/exiftool.py | 3 ++- aperisolve/analyzers/foremost.py | 3 ++- aperisolve/analyzers/image_resize.py | 2 +- aperisolve/analyzers/openstego.py | 2 +- aperisolve/analyzers/outguess.py | 4 ++-- aperisolve/analyzers/pngcheck.py | 3 ++- aperisolve/analyzers/steghide.py | 4 ++-- aperisolve/analyzers/strings.py | 3 ++- aperisolve/analyzers/template_analyzer.py | 4 ++-- aperisolve/analyzers/zsteg.py | 5 +++-- 13 files changed, 24 insertions(+), 17 deletions(-) diff --git a/aperisolve/analyzers/base_analyzer.py b/aperisolve/analyzers/base_analyzer.py index 63b77e2..5f20a05 100644 --- a/aperisolve/analyzers/base_analyzer.py +++ b/aperisolve/analyzers/base_analyzer.py @@ -28,7 +28,9 @@ class SubprocessAnalyzer(ABC): img: str make_folder: bool = True - def __init__(self, name: str, input_img: Path, output_dir: Path, has_archive: bool = False): + def __init__( + self, name: str, input_img: Path, output_dir: Path, has_archive: bool = False + ) -> None: self.name = name self.input_img = input_img self.img = f"../{self.input_img.name}" diff --git a/aperisolve/analyzers/binwalk.py b/aperisolve/analyzers/binwalk.py index eb04845..f26d42a 100644 --- a/aperisolve/analyzers/binwalk.py +++ b/aperisolve/analyzers/binwalk.py @@ -11,7 +11,7 @@ from .base_analyzer import SubprocessAnalyzer class BinwalkAnalyzer(SubprocessAnalyzer): """Analyzer for binwalk.""" - def __init__(self, *args): + def __init__(self, *args) -> None: super().__init__("binwalk", *args, has_archive=True) self.cmd = ["binwalk", "--matryoshka", "-e", self.img, "--run-as=root"] self.make_folder = False # Binwalk already create its own folder diff --git a/aperisolve/analyzers/decomposer.py b/aperisolve/analyzers/decomposer.py index 8cee810..aba4fce 100644 --- a/aperisolve/analyzers/decomposer.py +++ b/aperisolve/analyzers/decomposer.py @@ -15,7 +15,7 @@ from .base_analyzer import SubprocessAnalyzer class DecomposerAnalyzer(SubprocessAnalyzer): """Analyzer for bits decomposer.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("decomposer", *args) def get_results(self, _: Optional[str] = None) -> dict[str, Any]: diff --git a/aperisolve/analyzers/exiftool.py b/aperisolve/analyzers/exiftool.py index ae42bae..b749a8d 100644 --- a/aperisolve/analyzers/exiftool.py +++ b/aperisolve/analyzers/exiftool.py @@ -4,6 +4,7 @@ """Exiftool Analyzer for Image Submissions.""" from pathlib import Path +from typing import Any from .base_analyzer import SubprocessAnalyzer @@ -11,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class ExiftoolAnalyzer(SubprocessAnalyzer): """Analyzer for exiftool.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("exiftool", *args) self.cmd = ["exiftool", "-a", "-u", "-g1", self.img] diff --git a/aperisolve/analyzers/foremost.py b/aperisolve/analyzers/foremost.py index 45f96f6..8900c28 100644 --- a/aperisolve/analyzers/foremost.py +++ b/aperisolve/analyzers/foremost.py @@ -4,6 +4,7 @@ """Foremost Analyzer for Image Submissions.""" from pathlib import Path +from typing import Any from .base_analyzer import SubprocessAnalyzer @@ -11,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class ForemostAnalyzer(SubprocessAnalyzer): """Analyzer for foremost.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("foremost", *args, has_archive=True) self.cmd = ["foremost", "-o", str(self.get_extracted_dir()), "-i", self.img] diff --git a/aperisolve/analyzers/image_resize.py b/aperisolve/analyzers/image_resize.py index 99d8077..f9241b2 100644 --- a/aperisolve/analyzers/image_resize.py +++ b/aperisolve/analyzers/image_resize.py @@ -17,7 +17,7 @@ class ResizeAnalyzer(SubprocessAnalyzer): png: PNG - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("image_resize", *args, has_archive=True) def _lookup_crc(self) -> List[PNG]: diff --git a/aperisolve/analyzers/openstego.py b/aperisolve/analyzers/openstego.py index 66e4316..26f6960 100644 --- a/aperisolve/analyzers/openstego.py +++ b/aperisolve/analyzers/openstego.py @@ -12,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class OpenStegoAnalyzer(SubprocessAnalyzer): """Analyzer for openstego.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("openstego", *args, has_archive=True) self.algo = 0 diff --git a/aperisolve/analyzers/outguess.py b/aperisolve/analyzers/outguess.py index 2557eb0..cb8ec9d 100644 --- a/aperisolve/analyzers/outguess.py +++ b/aperisolve/analyzers/outguess.py @@ -4,7 +4,7 @@ """Outguess Analyzer for Image Submissions.""" from pathlib import Path -from typing import Optional +from typing import Any, Optional from .base_analyzer import SubprocessAnalyzer @@ -12,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class OutguessAnalyzer(SubprocessAnalyzer): """Analyzer for outguess.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("outguess", *args, has_archive=True) def build_cmd(self, password: Optional[str] = None) -> list[str]: diff --git a/aperisolve/analyzers/pngcheck.py b/aperisolve/analyzers/pngcheck.py index 6e04559..03350e1 100644 --- a/aperisolve/analyzers/pngcheck.py +++ b/aperisolve/analyzers/pngcheck.py @@ -4,6 +4,7 @@ """Pngcheck Analyzer for Image Submissions.""" from pathlib import Path +from typing import Any from .base_analyzer import SubprocessAnalyzer @@ -11,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class PngcheckAnalyzer(SubprocessAnalyzer): """Analyzer for pngcheck.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("pngcheck", *args) self.cmd = ["pngcheck", "-v", self.img] diff --git a/aperisolve/analyzers/steghide.py b/aperisolve/analyzers/steghide.py index fec8f5d..fb160fe 100644 --- a/aperisolve/analyzers/steghide.py +++ b/aperisolve/analyzers/steghide.py @@ -5,7 +5,7 @@ import re from pathlib import Path -from typing import Optional +from typing import Any, Optional from .base_analyzer import SubprocessAnalyzer @@ -13,7 +13,7 @@ from .base_analyzer import SubprocessAnalyzer class SteghideAnalyzer(SubprocessAnalyzer): """Analyzer for steghide.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("steghide", *args, has_archive=True) def build_cmd(self, password: Optional[str] = None) -> list[str]: diff --git a/aperisolve/analyzers/strings.py b/aperisolve/analyzers/strings.py index 0363814..2285bbf 100644 --- a/aperisolve/analyzers/strings.py +++ b/aperisolve/analyzers/strings.py @@ -4,6 +4,7 @@ """Strings Analyzer for Image Submissions.""" from pathlib import Path +from typing import Any from .base_analyzer import SubprocessAnalyzer @@ -11,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class StringsAnalyzer(SubprocessAnalyzer): """Analyzer for strings.""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("strings", *args) self.cmd = ["strings", self.img] diff --git a/aperisolve/analyzers/template_analyzer.py b/aperisolve/analyzers/template_analyzer.py index 8f33a34..70a743f 100644 --- a/aperisolve/analyzers/template_analyzer.py +++ b/aperisolve/analyzers/template_analyzer.py @@ -4,7 +4,7 @@ """ Analyzer for Image Submissions.""" from pathlib import Path -from typing import Optional +from typing import Any, Optional from .base_analyzer import SubprocessAnalyzer @@ -12,7 +12,7 @@ from .base_analyzer import SubprocessAnalyzer class TemplateAnalyze(SubprocessAnalyzer): """Analyzer for .""" - def __init__(self, *args): + def __init__(self, *args: Any) -> None: super().__init__("", *args, has_archive=True) def build_cmd(self, password: Optional[str] = None) -> list[str]: diff --git a/aperisolve/analyzers/zsteg.py b/aperisolve/analyzers/zsteg.py index 3546efb..d7de261 100644 --- a/aperisolve/analyzers/zsteg.py +++ b/aperisolve/analyzers/zsteg.py @@ -4,6 +4,7 @@ """Strings Analyzer for Image Submissions.""" from pathlib import Path +from typing import Any from .base_analyzer import SubprocessAnalyzer @@ -11,8 +12,8 @@ from .base_analyzer import SubprocessAnalyzer class ZstegAnalyzer(SubprocessAnalyzer): """Analyzer for zsteg.""" - def __init__(self, *args, **kwargs): - super().__init__("zsteg", *args, **kwargs) + def __init__(self, *args: Any) -> None: + super().__init__("zsteg", *args) self.cmd = ["zsteg", self.img] def is_error(self, returncode: int, stdout: str, stderr: str, zip_exist: bool) -> bool: