WeChall - Enlightment

Challenge

"Can you see the light?" — 2-level encoding challenge。页面显示 3 段大二进制数据,分别用 RGB 三种颜色渲染。

Solution

颜色提示了处理方法:三种颜色通道是三个独立的二进制序列,需要做位运算组合。

Level 1 — OR

将三个颜色通道的二进制逐 bit 做 OR(或)运算:只要任意一个颜色在该 bit 为 1,结果就为 1。

1
2
3
4
5
6
7
8
9
10
11
12
13
$ python3
# 三个颜色块的二进制数据(全部拼接)
>>> red = '000000000110000001100000000000000000000001000000...'
>>> green = '010000010110100000100000000000000000000000000001...'
>>> blue = '010000010100000001100001001000010010000000001000...'
# 逐 bit OR
>>> result = ''
>>> for i in range(len(red)):
... result += '1' if int(red[i]) | int(green[i]) | int(blue[i]) else '0'
...
# 按 8-bit 转 ASCII
>>> ''.join(chr(int(result[i:i+8], 2)) for i in range(0, len(result), 8))
'Aha! It seems you got something interesting!\nWell to go to the next stage, go there:\n01001100011...'

OR 的结果是一段提示文本 + 4 行二进制串。将那 4 个二进制串按 8-bit 解码:

1
2
3
4
01001100011010010110011101101000  ->  Ligh
00110111010111110100110001100101 -> 7_Le
01110110011001010110110000110010 -> vel2
00101110011100000110100001110000 -> .php

得到文件名 Ligh7_Level2.php。访问 http://www.wechall.net/challenge/anto/enlightment/Ligh7_Level2.php 进入 Level 2。

Level 2 — XOR

Level 2 页面使用 CMY(Cyan, Magenta, Yellow)三色渲染另一组二进制数据。这次需要用 XOR(异或)运算:

1
2
3
4
5
6
7
8
$ python3
# 逐 bit XOR
>>> result = ''
>>> for i in range(len(cyan)):
... result += '1' if int(cyan[i]) ^ int(magenta[i]) ^ int(yellow[i]) else '0'
...
>>> ''.join(chr(int(result[i:i+8], 2)) for i in range(0, len(result), 8))
'Triple-X-OR, right?\nGreat! Here is what you should be looking for..."Gimme_Da_Light"'

最终答案在消息末尾。

Gimme_Da_Light