Add FileAnalyzer, remove old image_resize artefacts, update foremost output
This commit is contained in:
@@ -45,6 +45,7 @@ Aperi'Solve is an open-source steganalysis web platform that performs automated
|
||||
- [steghide](https://steghide.sourceforge.net/) (extraction with password)
|
||||
- [strings](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/strings.html)
|
||||
- [zsteg](https://github.com/zed-0xff/zsteg) (LSB text/data extraction)
|
||||
- [file](https://www.darwinsys.com/file/) (MIME type and format detection)
|
||||
- Worker queue architecture for offloading heavy/slow analyzers (Redis + background workers).
|
||||
- Results stored for later browsing and download.
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -146,6 +146,7 @@ And also in `aperisolve.js` in the `TOOL_ORDER` constant:
|
||||
```js
|
||||
const TOOL_ORDER = [
|
||||
"decomposer",
|
||||
"file",
|
||||
"exiftool",
|
||||
"binwalk",
|
||||
"mytool" // My new tool
|
||||
@@ -157,7 +158,6 @@ const TOOL_ORDER = [
|
||||
"openstego",
|
||||
"zsteg",
|
||||
"strings",
|
||||
"image_resize",
|
||||
];
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user