Jsteg working

This commit is contained in:
Zeecka
2026-01-14 22:34:07 +01:00
parent 1c4b245c86
commit 8f491c683f
4 changed files with 40 additions and 2 deletions
+9 -2
View File
@@ -5,13 +5,19 @@ FROM python:3.14-slim AS builder
# Install wget only to download OpenStego # Install wget only to download OpenStego
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
wget git build-essential \ wget git build-essential golang-go \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Download OpenStego # Download OpenStego
RUN wget https://github.com/syvaidya/openstego/releases/download/openstego-0.8.6/openstego_0.8.6-1_all.deb \ RUN wget https://github.com/syvaidya/openstego/releases/download/openstego-0.8.6/openstego_0.8.6-1_all.deb \
-O /tmp/openstego.deb -O /tmp/openstego.deb
# Clone and build jsteg from source
RUN git clone https://github.com/lukechampine/jsteg.git /tmp/jsteg
RUN cd /tmp/jsteg && \
go build -o /usr/local/bin/jsteg ./cmd/jsteg && \
rm -rf /tmp/jsteg
# Builder stage - add after other tool compilations # Builder stage - add after other tool compilations
RUN git clone https://github.com/h3xx/jphs.git /tmp/jphs RUN git clone https://github.com/h3xx/jphs.git /tmp/jphs
RUN cd /tmp/jphs/jpeg-8a && ./configure && make RUN cd /tmp/jphs/jpeg-8a && ./configure && make
@@ -64,9 +70,10 @@ COPY aperisolve/ /app/aperisolve/
# Install Python dependencies # Install Python dependencies
RUN pip install --no-cache-dir -r /app/aperisolve/requirements.txt RUN pip install --no-cache-dir -r /app/aperisolve/requirements.txt
# Copy jphide binaries # Copy jphide and jsteg binaries
COPY --from=builder /usr/local/bin/jphide /usr/local/bin/jphide COPY --from=builder /usr/local/bin/jphide /usr/local/bin/jphide
COPY --from=builder /usr/local/bin/jpseek /usr/local/bin/jpseek COPY --from=builder /usr/local/bin/jpseek /usr/local/bin/jpseek
COPY --from=builder /usr/local/bin/jsteg /usr/local/bin/jsteg
# Commande de lancement # Commande de lancement
CMD ["gunicorn", "-w", "8", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "--capture-output", "aperisolve.utils.wsgi:application"] CMD ["gunicorn", "-w", "8", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "--capture-output", "aperisolve.utils.wsgi:application"]
+28
View File
@@ -0,0 +1,28 @@
# flake8: noqa: E203,E501,W503
# pylint: disable=C0413,W0718,R0903,R0801
# mypy: disable-error-code=unused-awaitable
"""Jsteg Analyzer for Image Submissions."""
from pathlib import Path
from .base_analyzer import SubprocessAnalyzer
class JstegAnalyzer(SubprocessAnalyzer):
"""Analyzer for jsteg."""
def __init__(self, input_img: Path, output_dir: Path) -> None:
super().__init__("jsteg", input_img, output_dir)
self.cmd = ["jsteg", "reveal", self.img]
def process_output(self, stdout: str, stderr: str) -> str | list[str]:
"""Process the stdout into lines."""
if stdout.strip():
return [line for line in stdout.split("\n") if line.strip()]
return []
def analyze_jsteg(input_img: Path, output_dir: Path) -> None:
"""Analyze an image submission using jsteg."""
analyzer = JstegAnalyzer(input_img, output_dir)
analyzer.analyze()
+1
View File
@@ -11,6 +11,7 @@ const TOOL_ORDER = [
"identify", "identify",
"steghide", "steghide",
"jpseek", "jpseek",
"jsteg",
"openstego", "openstego",
"zsteg", "zsteg",
"strings" "strings"
+2
View File
@@ -21,6 +21,7 @@ from .analyzers.file import analyze_file
from .analyzers.foremost import analyze_foremost from .analyzers.foremost import analyze_foremost
from .analyzers.identify import analyze_identify from .analyzers.identify import analyze_identify
from .analyzers.jpseek import analyze_jpseek from .analyzers.jpseek import analyze_jpseek
from .analyzers.jsteg import analyze_jsteg
from .analyzers.openstego import analyze_openstego from .analyzers.openstego import analyze_openstego
from .analyzers.outguess import analyze_outguess from .analyzers.outguess import analyze_outguess
from .analyzers.pcrt import analyze_pcrt from .analyzers.pcrt import analyze_pcrt
@@ -112,6 +113,7 @@ def analyze_image(submission_hash: str) -> None:
(analyze_foremost, img_path, result_path), (analyze_foremost, img_path, result_path),
(analyze_identify, img_path, result_path), (analyze_identify, img_path, result_path),
(analyze_jpseek, img_path, result_path, submission.password), (analyze_jpseek, img_path, result_path, submission.password),
(analyze_jsteg, img_path, result_path),
(analyze_openstego, img_path, result_path, submission.password), (analyze_openstego, img_path, result_path, submission.password),
(analyze_pngcheck, img_path, result_path), (analyze_pngcheck, img_path, result_path),
(analyze_pcrt, img_path, result_path), (analyze_pcrt, img_path, result_path),