diff options
| author | Louis Burda <quent.burda@gmail.com> | 2024-04-01 20:43:13 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2024-04-01 20:43:13 +0200 |
| commit | 9b76a554e831186e97820fe8cd45ad28b9a38b2c (patch) | |
| tree | b8b801e84caec2689149105c5d33f9071b340ceb /solve | |
| download | cscg2024-for3-master.tar.gz cscg2024-for3-master.zip | |
Diffstat (limited to 'solve')
| -rw-r--r-- | solve/flag | 1 | ||||
| -rw-r--r-- | solve/intro-forensics-3 | bin | 0 -> 754039 bytes | |||
| -rw-r--r-- | solve/out.png | bin | 0 -> 754039 bytes | |||
| -rwxr-xr-x | solve/solve | 26 |
4 files changed, 27 insertions, 0 deletions
diff --git a/solve/flag b/solve/flag new file mode 100644 index 0000000..0f7037b --- /dev/null +++ b/solve/flag @@ -0,0 +1 @@ +CSCG{space_space_spaaaace_space!!!} diff --git a/solve/intro-forensics-3 b/solve/intro-forensics-3 Binary files differnew file mode 100644 index 0000000..0a7a3a4 --- /dev/null +++ b/solve/intro-forensics-3 diff --git a/solve/out.png b/solve/out.png Binary files differnew file mode 100644 index 0000000..57b0e11 --- /dev/null +++ b/solve/out.png diff --git a/solve/solve b/solve/solve new file mode 100755 index 0000000..63e75a5 --- /dev/null +++ b/solve/solve @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import binascii + +header = b"\x89\x50\x4e\x47\x0D\x0A\x1A\x0A" +data = open("./intro-forensics-3", "rb").read() +assert(data[:len(header)] == header) + +pos = len(header) +chunks = {} +while pos < len(data): + start = pos + clen = int.from_bytes(data[pos:pos+4], "big") + pos += 4 + ctype = data[pos:pos+4] + pos += 4 + cdata = data[pos:pos+clen] + pos += clen + index = int.from_bytes(data[pos:pos+4], "big") + pos += 4 + new_crc = int.to_bytes(binascii.crc32(data[start+4:start+8] + cdata), 4, "big") + chunks[index] = data[start:start+8] + cdata + new_crc + +chunks = sorted(chunks.items(), key = lambda x : x[0]) +data = header + b"".join([v for k,v in chunks]) +open("out.png", "wb+").write(data) |
