题目提供 stego14.tar.gz,提示
Get the image here。需要先看清 tar
内部结构,再从图片里挖出隐藏的密钥与密文,最后用古典密码还原口令。 A
tar.gz is provided; the answer is recovered by unpacking it, carving a
RAR archive out of the JPG, and decrypting a classical cipher with a key
that is itself hidden inside the archive.
Solution
1 2 3
$ tar tzf stego14.tar.gz 6578747261637400.jpg $ tar xzf stego14.tar.gz
defaffine_decrypt(cipher, a=5, b=10, alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"): a_inv = pow(a, -1, len(alphabet)) out = [] for ch in cipher: if ch.upper() in alphabet: x = alphabet.index(ch.upper()) out.append(alphabet[(a_inv * (x - b)) % len(alphabet)]) else: out.append(ch) return"".join(out)
defaffine_encrypt(plain, a=5, b=10, alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"): out = [] for ch in plain: if ch.upper() in alphabet: x = alphabet.index(ch.upper()) out.append(alphabet[(a * x + b) % len(alphabet)]) else: out.append(ch) return"".join(out)