Add FileAnalyzer, remove old image_resize artefacts, update foremost output
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from pathlib import Path
|
||||
|
||||
from .base_analyzer import SubprocessAnalyzer
|
||||
|
||||
|
||||
class FileAnalyzer(SubprocessAnalyzer):
|
||||
"""Analyzer for the `file` command."""
|
||||
|
||||
def __init__(self, input_img: Path, output_dir: Path) -> None:
|
||||
super().__init__("file", input_img, output_dir)
|
||||
self.cmd = ["file", "-b", self.img]
|
||||
|
||||
def process_output(self, stdout: str, stderr: str) -> str | list[str] | dict[str, str]:
|
||||
"""Process the stdout into a list of lines."""
|
||||
return stdout
|
||||
|
||||
|
||||
def analyze_file(input_img: Path, output_dir: Path) -> None:
|
||||
"""Analyze an image submission using `file`."""
|
||||
analyzer = FileAnalyzer(input_img, output_dir)
|
||||
analyzer.analyze()
|
||||
@@ -22,7 +22,7 @@ class ForemostAnalyzer(SubprocessAnalyzer):
|
||||
def process_output(self, stdout: str, stderr: str) -> str | list[str] | dict[str, str]:
|
||||
"""Process the stdout/stderr."""
|
||||
if "Processing" in stderr and "|*|" in stderr:
|
||||
return stderr.strip().split("\n")
|
||||
return stderr.strip().replace("\n", "")
|
||||
return []
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from os import getenv
|
||||
from pathlib import Path
|
||||
|
||||
IMAGE_EXTENSIONS = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".webp", ".tiff"]
|
||||
WORKER_FILES = ["binwalk", "foremost", "steghide", "zsteg", "image_resize", "openstego", "pcrt"]
|
||||
WORKER_FILES = ["binwalk", "foremost", "steghide", "zsteg", "openstego", "pcrt"]
|
||||
|
||||
RESULT_FOLDER = Path(__file__).parent.resolve() / "results"
|
||||
REMOVED_IMAGES_FOLDER = Path(__file__).parent.resolve() / "removed_images"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const TOOL_ORDER = [
|
||||
"decomposer",
|
||||
"file",
|
||||
"exiftool",
|
||||
"binwalk",
|
||||
"foremost",
|
||||
@@ -9,7 +10,7 @@ const TOOL_ORDER = [
|
||||
"steghide",
|
||||
"openstego",
|
||||
"zsteg",
|
||||
"strings",
|
||||
"strings"
|
||||
];
|
||||
|
||||
function escapeHtml(text) {
|
||||
|
||||
@@ -16,6 +16,7 @@ initialize_sentry()
|
||||
from .analyzers.binwalk import analyze_binwalk # pylint: disable=C0413
|
||||
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.openstego import analyze_openstego
|
||||
from .analyzers.outguess import analyze_outguess
|
||||
@@ -103,6 +104,7 @@ def analyze_image(submission_hash: str) -> None:
|
||||
(analyze_binwalk, img_path, result_path),
|
||||
(analyze_decomposer, img_path, result_path),
|
||||
(analyze_exiftool, img_path, result_path),
|
||||
(analyze_file, img_path, result_path),
|
||||
(analyze_foremost, img_path, result_path),
|
||||
(analyze_openstego, img_path, result_path, submission.password),
|
||||
(analyze_pngcheck, img_path, result_path),
|
||||
|
||||
Reference in New Issue
Block a user