HackThisSite - Realistic Mission 6

Challenge

Decrypt the XECryption document and send the recovered text to ToxiCo_Watch through the HTS message center.

Solution

1. 理解格式

页面中的密文由数字组成,每三个数字代表一个字符。三数之和等于:

1
ASCII(明文字符) + key

加密页面 encryption.php 也显示这是自定义算法,而不是标准密码。

2. 计算分组和

1
2
3
4
5
6
import re
from collections import Counter

cipher_text = open("cipher.txt").read()
nums = [int(x) for x in re.findall(r"\d+", cipher_text)]
sums = [sum(nums[i:i+3]) for i in range(0, len(nums) - 2, 3)]

当前页面有 1098 个数字,即 366 个字符分组。频率最高的和为 794。英文文本中最常见的字符通常是空格(ASCII 32),所以:

1
2
3
4
key = 794 - 32
# key == 762
plaintext = "".join(chr(value - key) for value in sums)
print(plaintext)

3. 解密结果

1
2
3
4
5
6
7
8
Samuel Smith

Thank you for looking the other way on the increased levels of toxic chemicals in the river running alongside our industrial facilities. You can pick up your payment of $20,000 in the mailbox at the mansion on the corner of 53 and St. Charles tomorrow between the hours of 3:00am and 5:00am.

Thank you,

John Sculley
ToxiCo Industrial Chemicals

4. 完成任务

在 HTS Messages Center 的 Send 页面,将完整解密文本发送给 ToxiCo_Watch。当前服务器返回:

1
Congratulations, you have successfully completed realistic 6!