Identify
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# flake8: noqa: E203,E501,W503
|
||||
# pylint: disable=C0413,W0718,R0903,R0801
|
||||
# mypy: disable-error-code=unused-awaitable
|
||||
"""Identify Analyzer for Image Submissions."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from .base_analyzer import SubprocessAnalyzer
|
||||
|
||||
|
||||
class IdentifyAnalyzer(SubprocessAnalyzer):
|
||||
"""Analyzer for GraphicMagick identify command."""
|
||||
|
||||
def __init__(self, input_img: Path, output_dir: Path) -> None:
|
||||
super().__init__("identify", input_img, output_dir)
|
||||
self.cmd = ["identify", "-verbose", self.img]
|
||||
|
||||
def process_output(self, stdout: str, stderr: str) -> str | list[str]:
|
||||
"""Process the stdout into a list of lines."""
|
||||
return [line for line in stdout.split("\n") if line.strip()]
|
||||
|
||||
|
||||
def analyze_identify(input_img: Path, output_dir: Path) -> None:
|
||||
"""Analyze an image submission using GraphicMagick identify."""
|
||||
analyzer = IdentifyAnalyzer(input_img, output_dir)
|
||||
analyzer.analyze()
|
||||
@@ -8,6 +8,7 @@ const TOOL_ORDER = [
|
||||
"outguess",
|
||||
"pngcheck",
|
||||
"pcrt",
|
||||
"identify",
|
||||
"steghide",
|
||||
"jpseek",
|
||||
"openstego",
|
||||
|
||||
@@ -19,6 +19,7 @@ from .analyzers.decomposer import analyze_decomposer
|
||||
from .analyzers.exiftool import analyze_exiftool
|
||||
from .analyzers.file import analyze_file
|
||||
from .analyzers.foremost import analyze_foremost
|
||||
from .analyzers.identify import analyze_identify
|
||||
from .analyzers.jpseek import analyze_jpseek
|
||||
from .analyzers.openstego import analyze_openstego
|
||||
from .analyzers.outguess import analyze_outguess
|
||||
@@ -109,6 +110,7 @@ def analyze_image(submission_hash: str) -> None:
|
||||
(analyze_exiftool, img_path, result_path),
|
||||
(analyze_file, img_path, result_path),
|
||||
(analyze_foremost, img_path, result_path),
|
||||
(analyze_identify, img_path, result_path),
|
||||
(analyze_jpseek, img_path, result_path, submission.password),
|
||||
(analyze_openstego, img_path, result_path, submission.password),
|
||||
(analyze_pngcheck, img_path, result_path),
|
||||
|
||||
Reference in New Issue
Block a user