adding more features inclided steg analysis, decoding engines, and more
tests
1
tests/artifacts/flag.txt
Normal file
@@ -0,0 +1 @@
|
||||
picoCTF{h1dd3n_1n_1m4g3_5d4cba73}
|
||||
BIN
tests/artifacts/garden.jpg
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
tests/env/mock_comment.gif
vendored
Normal file
|
After Width: | Height: | Size: 28 B |
BIN
tests/env/mock_encoded_comment.jpg
vendored
Normal file
|
After Width: | Height: | Size: 32 B |
BIN
tests/env/mock_iptc.jpg
vendored
Normal file
|
After Width: | Height: | Size: 53 B |
BIN
tests/env/mock_physical.jpg
vendored
Normal file
|
After Width: | Height: | Size: 41 B |
BIN
tests/env/mock_text_chunks.png
vendored
Normal file
|
After Width: | Height: | Size: 85 B |
BIN
tests/env/mock_xmp.jpg
vendored
Normal file
|
After Width: | Height: | Size: 325 B |
BIN
tests/env/mock_xmp_formatting.jpg
vendored
Normal file
|
After Width: | Height: | Size: 436 B |
@@ -610,3 +610,27 @@ def test_adobe_xmp_formatting():
|
||||
assert meta.exif_data.get("exif:EmptyAttr") == "exif:Value"
|
||||
assert "rdf:Description" not in meta.exif_data
|
||||
|
||||
def test_inspect_decoded_hints_cli():
|
||||
"""
|
||||
Verifies that inspect command successfully decodes and prints hex/base64 encoded metadata hints.
|
||||
"""
|
||||
from ctf.main import cli
|
||||
runner = CliRunner()
|
||||
|
||||
# Create a mock JPEG with a base64 encoded comment: "ZmxhZ3tiNjRfbWV0YWRhdGF9" -> "flag{b64_metadata}"
|
||||
import struct
|
||||
comment_text = b"ZmxhZ3tiNjRfbWV0YWRhdGF9"
|
||||
comment_len = len(comment_text) + 2
|
||||
mock_jpeg = b"\xff\xd8\xff\xfe" + struct.pack(">H", comment_len) + comment_text + b"\xff\xd9"
|
||||
|
||||
test_file = TEST_ENV / "mock_encoded_comment.jpg"
|
||||
with open(test_file, "wb") as f:
|
||||
f.write(mock_jpeg)
|
||||
|
||||
result = runner.invoke(cli, ["inspect", str(test_file)])
|
||||
assert result.exit_code == 0
|
||||
assert "Decoded Metadata Hints" in result.output
|
||||
assert "Comment" in result.output
|
||||
assert "base64" in result.output
|
||||
assert "flag{b64_metadata}" in result.output
|
||||
|
||||
|
||||