diff --git a/forensics/corrupted_file/file b/forensics/corrupted_file/file new file mode 100644 index 0000000..78c4f54 Binary files /dev/null and b/forensics/corrupted_file/file differ diff --git a/forensics/corrupted_file/flag.txt b/forensics/corrupted_file/flag.txt new file mode 100644 index 0000000..310e41e --- /dev/null +++ b/forensics/corrupted_file/flag.txt @@ -0,0 +1 @@ +picoCTF{r3st0r1ng_th3_by73s_efd8c6c0} diff --git a/forensics/corrupted_file/solve.py b/forensics/corrupted_file/solve.py new file mode 100755 index 0000000..e71debf --- /dev/null +++ b/forensics/corrupted_file/solve.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +from pathlib import Path + +def main(): + with (Path(__file__).parent / "file").open('rb') as file: + content = file.read() + + JFIF_MAGIC_BYTES = b"\xFF\xD8" + new_content = JFIF_MAGIC_BYTES + content[2:] + + with (Path(__file__).parent / "file.jpg").open('wb') as file: + file.write(new_content) + +if __name__ == '__main__': + main()