fix copilot reviews
This commit is contained in:
@@ -20,7 +20,7 @@ class BinwalkAnalyzer(SubprocessAnalyzer):
|
|||||||
return self.output_dir / f"_{self.input_img.name}.extracted"
|
return self.output_dir / f"_{self.input_img.name}.extracted"
|
||||||
|
|
||||||
def is_error(self, returncode: int, stdout: str, stderr: str, zip_exist: bool) -> bool:
|
def is_error(self, returncode: int, stdout: str, stderr: str, zip_exist: bool) -> bool:
|
||||||
return len(stderr) > 0 and not zip_exist and False
|
return len(stderr) > 0 and not zip_exist
|
||||||
|
|
||||||
|
|
||||||
def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
|
def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class ResizeAnalyzer(SubprocessAnalyzer):
|
|||||||
found, it recovers and saves PNG images with the matched dimensions.
|
found, it recovers and saves PNG images with the matched dimensions.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
None
|
dict[str, Any]: A dictionary containing the analysis status, any error message,
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
Handles exceptions gracefully by updating output data with error status.
|
Handles exceptions gracefully by updating output data with error status.
|
||||||
@@ -165,6 +165,6 @@ class ResizeAnalyzer(SubprocessAnalyzer):
|
|||||||
|
|
||||||
|
|
||||||
def analyze_image_resize(input_img: Path, output_dir: Path) -> None:
|
def analyze_image_resize(input_img: Path, output_dir: Path) -> None:
|
||||||
"""Analyze an image submission using outguess."""
|
"""Analyze an image submission using ResizeAnalyzer."""
|
||||||
analyzer = ResizeAnalyzer(input_img, output_dir)
|
analyzer = ResizeAnalyzer(input_img, output_dir)
|
||||||
analyzer.analyze()
|
analyzer.analyze()
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ class SteghideAnalyzer(SubprocessAnalyzer):
|
|||||||
match = re.search(r'embedded file "([^"]+)"', data.stdout)
|
match = re.search(r'embedded file "([^"]+)"', data.stdout)
|
||||||
assert match is not None
|
assert match is not None
|
||||||
hidden_file = match.group(1)
|
hidden_file = match.group(1)
|
||||||
outfile = str(self.get_extracted_dir() / hidden_file)
|
safe_hidden_file = Path(hidden_file).name
|
||||||
|
outfile = str(self.get_extracted_dir() / safe_hidden_file)
|
||||||
cmd = ["steghide", "extract", "-sf", self.img, "-xf", outfile, "-p", password]
|
cmd = ["steghide", "extract", "-sf", self.img, "-xf", outfile, "-p", password]
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from typing import Optional
|
|||||||
from .base_analyzer import SubprocessAnalyzer
|
from .base_analyzer import SubprocessAnalyzer
|
||||||
|
|
||||||
|
|
||||||
class TemplateAnalyze(SubprocessAnalyzer):
|
class TemplateAnalyzer(SubprocessAnalyzer):
|
||||||
"""Analyzer for <toolname>."""
|
"""Analyzer for <toolname>."""
|
||||||
|
|
||||||
def __init__(self, input_img: Path, output_dir: Path) -> None:
|
def __init__(self, input_img: Path, output_dir: Path) -> None:
|
||||||
@@ -23,7 +23,7 @@ class TemplateAnalyze(SubprocessAnalyzer):
|
|||||||
|
|
||||||
def analyze_template(input_img: Path, output_dir: Path, password: Optional[str] = None) -> None:
|
def analyze_template(input_img: Path, output_dir: Path, password: Optional[str] = None) -> None:
|
||||||
"""Analyze an image submission using <toolname>."""
|
"""Analyze an image submission using <toolname>."""
|
||||||
analyzer = TemplateAnalyze(input_img, output_dir)
|
analyzer = TemplateAnalyzer(input_img, output_dir)
|
||||||
if password:
|
if password:
|
||||||
analyzer.analyze(password)
|
analyzer.analyze(password)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# flake8: noqa: E203,E501,W503
|
# flake8: noqa: E203,E501,W503
|
||||||
# pylint: disable=C0413,W0718,R0903,R0801
|
# pylint: disable=C0413,W0718,R0903,R0801
|
||||||
# mypy: disable-error-code=unused-awaitable
|
# mypy: disable-error-code=unused-awaitable
|
||||||
"""Strings Analyzer for Image Submissions."""
|
"""Zsteg Analyzer for Image Submissions."""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user