add pngcheck
This commit is contained in:
@@ -36,6 +36,7 @@ The platform allow you to:
|
|||||||
- **Visualise `binwalk` informations**
|
- **Visualise `binwalk` informations**
|
||||||
- **Download `binwalk` files** such as zip in png headers
|
- **Download `binwalk` files** such as zip in png headers
|
||||||
- **Download `foremost` files** such as zip in png headers
|
- **Download `foremost` files** such as zip in png headers
|
||||||
|
- **Visualise `pngcheck` output**
|
||||||
- **Visualise `strings` output**
|
- **Visualise `strings` output**
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -93,7 +94,7 @@ GitHub CI will alert in case of failure.
|
|||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
- [ ] PngCheck
|
- [x] PngCheck
|
||||||
- [ ] Zsteg extract / --all --> **Download `zsteg` files** such as mp3 encoded on LSB
|
- [ ] Zsteg extract / --all --> **Download `zsteg` files** such as mp3 encoded on LSB
|
||||||
- [ ] Test on mobile
|
- [ ] Test on mobile
|
||||||
- [ ] i18n
|
- [ ] i18n
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
"""Pngcheck Analyzer for Image Submissions."""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from .utils import MAX_PENDING_TIME, update_data
|
||||||
|
|
||||||
|
|
||||||
|
def analyze_pngcheck(input_img: Path, output_dir: Path) -> None:
|
||||||
|
"""Analyze an image submission using strings."""
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = subprocess.run(
|
||||||
|
["pngcheck", "-v",input_img],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=False,
|
||||||
|
timeout=MAX_PENDING_TIME,
|
||||||
|
)
|
||||||
|
# Error based on https://github.com/pnggroup/pngcheck/issues/59
|
||||||
|
# if data.stderr:
|
||||||
|
# update_data(
|
||||||
|
# output_dir, {"pngcheck": {"status": "error", "error": data.stderr}}
|
||||||
|
# )
|
||||||
|
# return
|
||||||
|
|
||||||
|
data_strings = data.stdout.split("\n") if data else []
|
||||||
|
data_strings = [s for s in data_strings if s]
|
||||||
|
|
||||||
|
update_data(
|
||||||
|
output_dir,
|
||||||
|
{
|
||||||
|
"pngcheck": {
|
||||||
|
"status": "ok",
|
||||||
|
"output": data_strings,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
update_data(output_dir, {"pngcheck": {"status": "error", "error": str(e)}})
|
||||||
@@ -4,6 +4,7 @@ const TOOL_ORDER = [
|
|||||||
"binwalk",
|
"binwalk",
|
||||||
"foremost",
|
"foremost",
|
||||||
"outguess",
|
"outguess",
|
||||||
|
"pngcheck",
|
||||||
"steghide",
|
"steghide",
|
||||||
"zsteg",
|
"zsteg",
|
||||||
"strings",
|
"strings",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ from .analyzers.outguess import analyze_outguess
|
|||||||
from .analyzers.steghide import analyze_steghide
|
from .analyzers.steghide import analyze_steghide
|
||||||
from .analyzers.strings import analyze_strings
|
from .analyzers.strings import analyze_strings
|
||||||
from .analyzers.zsteg import analyze_zsteg
|
from .analyzers.zsteg import analyze_zsteg
|
||||||
|
from .analyzers.pngcheck import analyze_pngcheck
|
||||||
from .app import app, db
|
from .app import app, db
|
||||||
from .config import RESULT_FOLDER
|
from .config import RESULT_FOLDER
|
||||||
from .models import Image, Submission
|
from .models import Image, Submission
|
||||||
@@ -49,6 +50,7 @@ def analyze_image(submission_hash: str) -> None:
|
|||||||
(analyze_exiftool, img_path, result_path),
|
(analyze_exiftool, img_path, result_path),
|
||||||
(analyze_foremost, img_path, result_path),
|
(analyze_foremost, img_path, result_path),
|
||||||
(analyze_strings, img_path, result_path),
|
(analyze_strings, img_path, result_path),
|
||||||
|
(analyze_pngcheck, img_path, result_path),
|
||||||
(analyze_steghide, img_path, result_path, submission.password),
|
(analyze_steghide, img_path, result_path, submission.password),
|
||||||
(analyze_zsteg, img_path, result_path),
|
(analyze_zsteg, img_path, result_path),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user