diff --git a/Dockerfile b/Dockerfile
index 41e4c21..1c0ce92 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,17 +26,20 @@ RUN wget https://github.com/syvaidya/openstego/releases/download/openstego-0.8.6
dpkg -i /tmp/openstego.deb && \
rm /tmp/openstego.deb
-# Clean up apt cache and remove useless packages
-RUN apt-get remove -y wget && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists/*
-
+# Copy application
COPY aperisolve/ /aperisolve/
RUN mkdir -p /data
+# Install Python dependencies
RUN pip install --no-cache-dir -r /aperisolve/requirements.txt
ENV PYTHONUNBUFFERED=1
+# Auto clean after build
+RUN apt-get remove -y wget && \
+ apt-get autoremove -y && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "--capture-output", "aperisolve.wsgi:application"]
diff --git a/aperisolve/analyzers/binwalk.py b/aperisolve/analyzers/binwalk.py
index 69920e7..6c05b9a 100644
--- a/aperisolve/analyzers/binwalk.py
+++ b/aperisolve/analyzers/binwalk.py
@@ -3,6 +3,7 @@
import shutil
import subprocess
from pathlib import Path
+from typing import Any
from .utils import MAX_PENDING_TIME, update_data
@@ -17,7 +18,7 @@ def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
stderr = ""
# Run binwalk
data = subprocess.run(
- ["binwalk", "-e", "../" + str(image_name), "--run-as=root"],
+ ["binwalk", "--matryoshka", "-e", "../" + str(image_name), "--run-as=root"],
cwd=output_dir,
capture_output=True,
text=True,
@@ -47,16 +48,17 @@ def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
# Only report error if stderr exists AND extraction failed.
# If zip_exist is True, binwalk worked (despite warnings), so we proceed.
if len(stderr) > 0 and not zip_exist:
- err = {
+ err: dict[str, dict[str, Any]] = {
"binwalk": {
"status": "error",
+ "output": data.stdout.split("\n") if data else [],
"error": stderr,
}
}
update_data(output_dir, err)
return None
- output_data = {
+ output_data: dict[str, dict[str, Any]] = {
"binwalk": {
"status": "ok",
"output": data.stdout.split("\n") if data else [],
diff --git a/aperisolve/static/js/aperisolve.js b/aperisolve/static/js/aperisolve.js
index 54ecf94..0090c17 100644
--- a/aperisolve/static/js/aperisolve.js
+++ b/aperisolve/static/js/aperisolve.js
@@ -252,6 +252,38 @@ function parseResult(result) {
analyzer.innerHTML += `
${capitalize(tool.replace("_"," "))}
`;
+ // Parse text output
+ if (typeof result[tool]["output"] === "string") {
+ analyzer.innerHTML += `${escapeHtml(
+ result[tool]["output"]
+ )}`;
+ } else if (Array.isArray(result[tool]["output"])) {
+ if (result[tool]["output"].length > 0) {
+ var texarea_content = ``;
+ texarea_content += ``;
+ texarea_content += ``;
+ texarea_content += `
`;
+ analyzer.innerHTML += texarea_content;
+ }
+ } else if (typeof result[tool]["output"] === "object") {
+ var table_content = ``;
+ table_content += `
`;
+ for (const key in result[tool]["output"]) {
+ table_content += `| ${escapeHtml(key)} | `;
+ table_content += `${escapeHtml(
+ result[tool]["output"][key]
+ )} |
`;
+ }
+ table_content += `
`;
+ table_content += ``;
+ analyzer.innerHTML += table_content;
+ }
+
+ // Parse images, downloads, ...
if (result[tool]["status"] === "ok") {
if ("images" in result[tool]) {
// Parse image output
@@ -286,41 +318,6 @@ function parseResult(result) {
}
}
- // Parse text output
-
-
- if (typeof result[tool]["output"] === "string") {
- analyzer.innerHTML += `
${escapeHtml(
- result[tool]["output"]
- )}`;
- } else if (Array.isArray(result[tool]["output"])) {
- if (result[tool]["output"].length > 0) {
- var texarea_content = `
`;
- texarea_content += ``;
- texarea_content += ``;
- texarea_content += `
`;
- analyzer.innerHTML += texarea_content;
- }
- } else if (typeof result[tool]["output"] === "object") {
- var table_content = `
`;
- table_content += `
`;
- for (const key in result[tool]["output"]) {
- table_content += `| ${escapeHtml(key)} | `;
- table_content += `${escapeHtml(
- result[tool]["output"][key]
- )} |
`;
- }
- table_content += `
`;
- table_content += ``;
- analyzer.innerHTML += table_content;
- } else {
- // analyzer.innerHTML += `
${result[tool]["output"]}`;
- }
-
if ("download" in result[tool]) {
// Parse download link
analyzer.innerHTML += `