gogogo!出发咯

描述:黑咖啡品味有多濃~😍😍😍😍我只要汽水的輕鬆😎😎😎😎😜😜😜大熱天做個白日夢☀️😎😎😎⛱️夢見我變成了彩虹🌈🌈🌈🌈🌈🌈🌈

image-20260923220447505

关键逻辑在这个函数,len=8

image-20260923220414373

逐位的异或,异或回来看看

image-20260923220637198

直接提交就行了

澳门新葡京

描述: 呆呆鸟学长被盗版软件的澳门小广告迷了心智,背着小栗子学姐带着全部家当飞向寸土寸金的澳门…………

image-20260923221239967

关键逻辑在draw_prize,跟抽奖一样

flag就在奖池里

image-20260923221558580

糖衣炮弹

描述:套了层…..壳

upx壳,这里也能看见flag了

image-20260923222002913

脱壳

image-20260923222122013

糖衣炮弹2

描述: 又是….一层??

修改特征码脱壳

image-20260923222449050

输入经过某种加密与目标数组比对

image-20260923223058439

image-20260923223042019

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def rol8(x, n):
n &=7
x &=0xff
return ((x << n) | (x >> (8-n))) &0xff

def ror8(x, n):
n &=7
x &=0xff
return ((x >> n) | (x << (8-n))) &0xff


target = bytes([
0x8F,0x4C,0xD1,0xA0,0x26,
0x3F,0x9B,0xC2,0xD6,0xAA,
0xE6,0x42,0x84,0x25,0xA8,
0x84,0x45,0x51,0x72,0x45,
0x3D,0xE8,0x65,0xA4,0xCE
])

res = bytearray()
for i in range(25):
Ti = target[i]
ki = 13*i + 90
si = (i & 3)+1
v2 = (Ti - 9*i - 23) & 0xff
tmp = ror8(v2, si)
ci = (ki ^ tmp) &0xff
res.append(ci)

print("bytes:", res)

sm…………………..c??

描述=程序好像会在运行时改掉一段字节。后面的 key 到底从哪来的?

image-20260923223746396

smc让程序跑起来就行了,tiny243和RC4还挺像呢,魔改了些

image-20260923223850326

下断点调试 ,在生成key的后一条指令或在调用tiny243前一条,毕竟是要传参的

image-20260923225047046

得到了key=BytePatchKey_243!,有密文,魔改下逆

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def rotl8(x, n):
x &= 0xFF
n &= 7
if n == 0:
return x
return ((x << n) | (x >> (8 - n))) & 0xFF

def tiny243_init(key):
S = [(17*i + 31) % 0xF3 for i in range(0xF3)]
v7 = 0
a3 = len(key)
for n2 in range(3):
for i in range(0xF3):
k = key[(5*i + 13*n2) % a3]
v7 = (S[i] + v7 + rotl8((k ^ (i + 29*n2)), (i + n2) & 7) + 19*n2 + 7*i) % 0xF3
S[i], S[v7] = S[v7], S[i]
return S

def tiny243_xcrypt(data, key):
S = tiny243_init(key)
n31 = len(data)
v14, v13 = 0, 0
out = bytearray()
for j in range(n31):
v14 = (v14 + 7) % 0xF3
v13 = (11*j + v13 + S[v14]) % 0xF3
S[v14], S[v13] = S[v13], S[v14]
v10 = S[(S[v14] + S[v13] + j) % 0xF3]
v9 = S[(5*j + (S[v14] ^ S[v13]) + v10) % 243]
v8 = S[(3*j + v14 + v9) % 0xF3]
v7 = rotl8((v8 + v10 + 3*v9 + 23*j), (v10 + v9 + j) & 7)
out.append(v7 ^ data[j])
return bytes(out)

key = b"BytePatchKey_243!"
cipher=bytes([0x20,0x56,0xF,0x3C,0x1F,0x66,0x3,0xAF,0x29,0x72,0xF4,0x4F,0xE5,0x77,0xD9,0x78,0x33,0x56,0xE5,0xB7,0xDF,0x3A,0x48,0xA1,0x14,0xF6,0xFB,0x15,0x81,0x4D,0x70])

plain = tiny243_xcrypt(cipher, key)
print("plain:", plain)

MioCrypt

描述:Ooops, your flag has been encrypted!

发生什么事了喵?

你的 flag 被 Mio 酱暂时收走啦~♡

她说这是一次绝对安全、绝对可靠、绝对不会出错的加密。

那我该怎么办?

当然是亲自检查 MioCrypt 啦。

毕竟,杂鱼也许偶尔能发现天才留下的小破绽?

image-20260925191622459

寻找特征字符串,有读取文件对文件进行加密的行为

image-20260925195027599

跟踪到sub_140001000

image-20261003143734379

1
2
3
4
5
DWORD GetModuleFileNameW(
[in, optional] HMODULE hModule,
[out] LPWSTR lpFilename,
[in] DWORD nSize
);

第一个参数若为 NULL,GetModuleFileName 检索当前进程的可执行文件的路径。

第二个参数指向接收模块完全限定路径的缓冲区的指针。

调用成功后,Filename等于自身exe路径

给v1赋值成’\‘,并返回值指向反斜杠的指针

这里就像char *p = strrchr(path, ‘\‘),找字符串某个字符最后一次出现的位置

sub_140003990截取了exe路径,替换为同一目录下flag路径

再来看sub_1400013B0,传入buf1和buf2

image-20261003153644996

之前可能不知道buf2是什么,看readfile

1
2
3
4
5
6
7
BOOL ReadFile(
[in] HANDLE hFile, 文件句柄
[out] LPVOID lpBuffer, 接受内容的内存地址
[in] DWORD nNumberOfBytesToRead, 读取字节数
[out, optional] LPDWORD lpNumberOfBytesRead,
[in, out, optional] LPOVERLAPPED lpOverlapped
);

那么buf2的结构就应该是文件内容指针和文件长度

sub_140001760检验文件文件头

image-20261003154256880

再就是内存和窗口相关函数,不用在意

看sub_140001BB0

image-20261003155202678

sub_1400013B0打开读取文件,bufa和上面分析的buf2功能一样

sub_1400017C0接收一个八字节数组

image-20261003155337172

生成八字节随机密钥并写入传入的缓冲区:优先使用 CPU 的 RDRAND,最多尝试 10 次;失败时使用 BCryptGenRandom

sub_1400018E0接收上一步生成的八字节随机密钥,和用来记录加密后的密文指针,长度

image-20261003160013000

用内置的 RSA-2048 公钥,采用 OAEP / SHA-256 填充,输出 256 字节密文,并保存其指针和长度(存在buf里),

这一步只是加密了传入的八字节随机密钥,还没对flag文件进行加密

回到外函数,看sub_140001B20,传入文件内存指针,密钥

image-20261003160523225

对文件每一字节循环异或

后面便是拼接和生成文件了,重新注释了一下,sub_14006E8F0可以看作类似memcpy

image-20261003161842950

最后再是保存拼接后的文件,即加密后的flag文件

对应的格式是

内容 占用字节数 文件偏移
MIOCRYPT 文件头 8 0~7
RSA 加密后的密钥 256 8~263
异或后的正文 35 264~298

按题目逻辑来,我们应该先解这个RSA得到原始八字节密钥,再去异或加密后的正文得到flag

但我们其中知道flag头,即PKWCTF{,这就已经有七位了

那我们直接拿这七位去异或加密后的正文,不就能得到7位的key,剩下一位直接爆破找合理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from pathlib import Path

data = Path("flag").read_bytes()
cipher = data[0x108:]
known = b"PKWCTF{"
key = bytearray(8)

for i in range(len(known)):
key[i] = cipher[i] ^ known[i]

print("[+] partial key:", key[:7].hex(" "))

for k7 in range(256):
key[7] = k7

plain = bytes(
cipher[i] ^ key[i % 8]
for i in range(len(cipher))
)

if plain.startswith(b"PKWCTF{") and plain.endswith(b"}"):
try:
text = plain.decode("ascii")
except UnicodeDecodeError:
continue

if all(32 <= b <= 126 for b in plain):
print("[+] flag:", text)

暗号断点

描述: 静态看起来像普通校验逻辑

image-20260924144047441

加密似乎有点复杂,先下断点远程调试看看,输入64个字符

snapshot处有flag

image-20260924144613602

大鱼吃小鱼

描述: 摸鱼神器

image-20260924151503806

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
(module
(memory \(memory (;0;) (export &quot;memory&quot;) 1)</span><br><span class="line"> (func\)func0 (param \(var0 i32) (param\)var1 i32) (result i32)
(local \(var2 i32)</span><br><span class="line"> local.get\)var0
i32.const 255
i32.and
local.set \(var2</span><br><span class="line"> local.get\)var2
local.get \(var1</span><br><span class="line"> i32.shl</span><br><span class="line"> local.get\)var2
i32.const 8
local.get \(var1</span><br><span class="line"> i32.sub</span><br><span class="line"> i32.shr_u</span><br><span class="line"> i32.or</span><br><span class="line"> i32.const 255</span><br><span class="line"> i32.and</span><br><span class="line"> )</span><br><span class="line"> (func\)check_key (;1;) (export "check_key") (param \(var0 i32) (result i32)</span><br><span class="line"> (local\)var1 i32)
(local \(var2 i32)</span><br><span class="line"> (local\)var3 i32)
i32.const 0
local.set \(var1</span><br><span class="line"> i32.const 0</span><br><span class="line"> local.set\)var3
block \(label0</span><br><span class="line"> loop\)label1
local.get \(var1</span><br><span class="line"> i32.const 18</span><br><span class="line"> i32.ge_u</span><br><span class="line"> br_if\)label0
local.get \(var0</span><br><span class="line"> local.get\)var1
i32.add
i32.load8_u
i32.const 55
local.get \(var1</span><br><span class="line"> i32.const 11</span><br><span class="line"> i32.mul</span><br><span class="line"> i32.add</span><br><span class="line"> i32.xor</span><br><span class="line"> local.get\)var1
i32.const 7
i32.rem_u
i32.const 1
i32.add
call \(func0</span><br><span class="line"> i32.const 19</span><br><span class="line"> i32.add</span><br><span class="line"> local.get\)var1
i32.const 3
i32.mul
i32.add
i32.const 255
i32.and
local.set \(var2</span><br><span class="line"> local.get\)var3
local.get \(var2</span><br><span class="line"> i32.const 256</span><br><span class="line"> local.get\)var1
i32.add
i32.load8_u
i32.xor
i32.or
local.set \(var3</span><br><span class="line"> local.get\)var1
i32.const 1
i32.add
local.set \(var1</span><br><span class="line"> br\)label1
end \(label1</span><br><span class="line"> end\)label0
local.get $var3
i32.eqz
)
(data (i32.const 240) "AQUAKEY!\00\00\00\00\00\00\00\001\da\f4\de)l\c3\b3\82\9c\fd\b0+\85>\fa\e7\cf")
)

这有一段wat,看不懂交给ai了

翻译成c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
unsigned char rotl(unsigned char x, int n) {
return (x << n) | (x >> (8 - n));
}

int check_key(unsigned char *key) {
int bad = 0; // \(var3,初始 0</span></span><br><span class="line"> <span class="keyword">for</span> (<span class="type">int</span> i = <span class="number">0</span>; i &lt; <span class="number">18</span>; i++) &#123; <span class="comment">//\)var1 = i
unsigned char v = key[i] ^ (55 + 11 * i); // 先异或
v = rotl(v, (i % 7) + 1); // 再循环左移
v = (v + 19 + 3 * i) & 0xFF; // 再加
if (v != mem[256 + i]) bad = 1; // 和固定表比较
}
return bad == 0; // 18 个全对才返回 1(真)
}

1
(data (i32.const 240) "AQUAKEY!\00\00\00\00\00\00\00\001\da\f4\de)l\c3\b3\82\9c\fd\b0+\85>\fa\e7\cf")

从内存地址 240 开始放数据,前 16 字节是 "AQUAKEY!"(8 个字符)+ 8 个 \0,这只是占位,让校验表恰好落在地址 256,从 256 开始的 18 个字节 B5 6A 7A 1C ... 就是上面 C 代码里的 mem[256+i],也就是target

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
TABLE = bytes([


])

def rotl(x: int, n: int) -> int:
return ((x << n) | (x >> (8 - n))) & 0xFF

def rotr(x: int, n: int) -> int:
return rotl(x, (8 - n) % 8)

def decrypt_key() -> bytes:
key = bytearray()
for i in range(18):
t = (TABLE[i] - 19 - 3 * i) & 0xFF
t = rotr(t, (i % 7) + 1)
key.append(t ^ (55 + 11 * i))
return bytes(key)

if __name__ == "__main__":
key = decrypt_key()
print(key.decode("latin1"))

小栗子的保险箱

描述:“深夜的 C3-103 实验室里,呆呆鸟学长发现了传说中的“栗子保险箱”。

据说里面藏着小栗子的秘密发财基金。”

这是什么驱动写的呢?

GODOT写的

GDRETools/gdsdecomp: Godot reverse engineering tools

image-20260923232446082

1
2
3
4
5
6
7
8
9
encrypted_flag = [60, 34, 45, 42, 11, 53, 26, 63, 42, 53, 38, 35, 38, 33, 52, 0, 11, 12, 2, 14, 37, 61, 110, 30, 4, 71, 68, 17]
key = b"lizi_safe"

result = []
for i, c in enumerate(encrypted_flag):
result.append(c ^ key[i % len(key)])

print(bytes(result).decode('utf-8'))

S级任务!追击!呆呆鸟!

描述:呆呆鸟梦到自己成了John Wick!!!打醒他(自杀是用来干嘛的呢)

C#写的,dnspy看看

image-20260924153648729

有个zip,下下来

在DodoExtraction_Data/Managed有Assembly-CSharp.dll

GameManager/DecryptFlag

image-20260924154311060

这是key数组

image-20260924154359880

把固定字符串DODO‑EXFIL‑v2和KeyFragments数组里 8 个碎片用|拼接成一段文本,对拼接后的文本做 SHA256,结果直接当做 AES‑256 密钥

IV 是硬编码 base64 解码出来的

使用 AES‑256‑CBC(PKCS7) 解密硬编码的 base64 密文

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import base64
import hashlib
from Crypto.Cipher import AES

key_fragments = ["K9Q2", "7M4X", "P8VA", "2N6C", "R5TJ", "W3HL", "F7ZD", "B1YS"]
text_raw = "DODO-EXFIL-v2|" + "|".join(key_fragments)

# SHA256 得到AES 256bit key
key = hashlib.sha256(text_raw.encode("utf-8")).digest()

iv_b64 = "aW52LWRvZG8tMjAyNiEhIQ=="
iv = base64.b64decode(iv_b64)

cipher_b64 = "fEoFX9UwUuJyvBmccIHNVj6K8he+O47LrLHbJF4WYFQ="
cipher_data = base64.b64decode(cipher_b64)

# AES‑256‑CBC PKCS7
cipher = AES.new(key, AES.MODE_CBC, iv)
plain = cipher.decrypt(cipher_data)
flag = plain.decode("utf‑8")

print(f"raw key material: {text_raw}")
print(f"key(hex): {key.hex()}")
print(f"iv: {iv}")
print("Flag =>", flag)

玉面手雷王

描述: 不 ! ! ! ! 要!!!!!!!!😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭

pyinstall打包的exe,用pyinstcxtractor.py再找个pyc在线

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#!/usr/bin/env python
# visit http://tool.lu/pyc/ for more information
from __future__ import annotations
import os
import math
import sys
import tkinter as tk
from pathlib import Path
import tk_runtime
SPAWN_DURATION_MS = 60000
WINDOW_LIFETIME_MS = 60000
SPAWN_INTERVAL_MS = 22
BURST_SIZE = 8
MAX_ACTIVE_WINDOWS = 720
IMAGE_SUBSAMPLE = 2
GRID_X_STEP_RATIO = 0.46
GRID_Y_STEP_RATIO = 0.42
HEART_MARGIN = 28
HEART_LAYERS = (1, 0.88, 0.76)
HEART_LAYER_COUNTS = (96, 72, 48)
WIGGLE_EVERY_N = 5
WIGGLE_DURATION_MS = 1800
WIGGLE_INTERVAL_MS = 75
WIGGLE_AMPLITUDE = 14
GLITCH_TITLES = ('玉面手雷王', '你不听', '别关', 'X1X1', '喜欢你')
HEART_HOLE_WIDTH_RATIO = 0.4
HEART_HOLE_HEIGHT_RATIO = 0.52
HEART_HOLE_Y_OFFSET_RATIO = 0.03
TASKBAR_GAP = 40
TITLE = '玉面手雷王'
MESSAGE = '让你不要运行你不听'
IMAGE_PATH = ('assets', 'popup_image.png')
BGM_PATH = ('assets', 'bgm.wav')

def _recover_flag():
'''Return the flag by calling the native extension module.'''
return tk_runtime.recover_flag()


def _self_check():
'''作者自检入口:只返回成功/失败,不把 flag 打到弹窗或正常输出里。'''
flag = _recover_flag()
expected_prefix = (lambda .0: pass# WARNING: Decompyle incomplete
)((80, 75, 87, 67, 84, 70, 123)())
if flag.startswith(expected_prefix) and flag.endswith('}') and sum(map(ord, flag)) % 65521 == 2412:
return 0
return 1


def _resource_path(*parts):
'''兼容源码运行和 PyInstaller onefile 解包后的资源路径。'''
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
base_path = Path(sys._MEIPASS)
else:
base_path = Path(__file__).resolve().parent
# WARNING: Decompyle incomplete


def _load_popup_image(root = None):
'''加载弹窗图片;失败时返回 None,让程序退回纯文字弹窗。'''
pass
# WARNING: Decompyle incomplete


def _start_background_music():
'''如果 assets/bgm.wav 存在,就用 winsound 异步循环播放。'''
pass
# WARNING: Decompyle incomplete


def _stop_background_music():
'''停止 winsound 异步播放,确保程序退出时音乐一起停。'''
import winsound
winsound.PlaySound(None, winsound.SND_PURGE)
return None
# WARNING: Decompyle incomplete


def _axis_positions(limit = None, size = None, step = None):
'''生成覆盖单个坐标轴的铺屏网格点,并强制补上最后一列/行。'''
max_position = max(0, limit - size)
positions = list(range(0, max_position + 1, max(1, step)))
if positions or positions[-1] != max_position:
positions.append(max_position)
return positions


def _heart_mask_value(point_x = None, point_y = None, screen_w = None, screen_h = ('point_x', 'float', 'point_y', 'float', 'screen_w', 'int', 'screen_h', 'int', 'return', 'float')):
'''返回爱心隐式方程值;小于等于 0 表示点在中心爱心空洞内。'''
heart_center_x = screen_w / 2
heart_center_y = screen_h / 2 + screen_h * HEART_HOLE_Y_OFFSET_RATIO
heart_half_w = max(1, screen_w * HEART_HOLE_WIDTH_RATIO / 2.3)
heart_half_h = max(1, screen_h * HEART_HOLE_HEIGHT_RATIO / 2.2)
normalized_x = (point_x - heart_center_x) / heart_half_w
normalized_y = (heart_center_y - point_y) / heart_half_h
return (normalized_x * normalized_x + normalized_y * normalized_y - 1) ** 3 - normalized_x * normalized_x * normalized_y ** 3


def _heart_point(angle = None):
'''经典参数方程爱心点,返回数学坐标系里的 x/y。'''
sin_t = math.sin(angle)
x = 16 * sin_t * sin_t * sin_t
y = 13 * math.cos(angle) - 5 * math.cos(2 * angle) - 2 * math.cos(3 * angle) - math.cos(4 * angle)
return (x, y)


def _build_heart_outline_positions(root = None, width = None, height = None):
'''生成空心爱心路径:先外轮廓,再按缩小轮廓往里补两圈。'''
screen_w = max(root.winfo_screenwidth(), width)
screen_h = max(root.winfo_screenheight(), height)
usable_w = max(width, screen_w - width - HEART_MARGIN * 2)
usable_h = max(height, screen_h - height - HEART_MARGIN * 2 - TASKBAR_GAP)
scale = max(1, min(usable_w / 32, usable_h / 29))
center_x = screen_w / 2
center_y = screen_h / 2 + screen_h * HEART_HOLE_Y_OFFSET_RATIO
positions = []
seen = set()
for layer_scale, count in zip(HEART_LAYERS, HEART_LAYER_COUNTS):
for step in range(count):
angle = math.tau * step / count
(heart_x, heart_y) = _heart_point(angle)
x = round(center_x + heart_x * scale * layer_scale - width / 2)
y = round(center_y - heart_y * scale * layer_scale - height / 2)
x = min(max(0, x), max(0, screen_w - width))
y = min(max(0, y), max(0, screen_h - height - TASKBAR_GAP))
key = (x // 6, y // 6)
if not key not in seen:
continue
positions.append((x, y))
seen.add(key)
return positions


def _window_touches_heart(x, y, width = None, height = None, screen_w = None, screen_h = ('x', 'int', 'y', 'int', 'width', 'int', 'height', 'int', 'screen_w', 'int', 'screen_h', 'int', 'return', 'bool')):
'''采样窗口中心、四角和边缘中点,判断窗口是否贴近中心爱心区域。'''
pass
# WARNING: Decompyle incomplete


def _position_distance_from_center(position, width = None, height = None, center_x = None, center_y = ('position', 'tuple[int, int]', 'width', 'int', 'height', 'int', 'center_x', 'float', 'center_y', 'float', 'return', 'float')):
'''计算窗口中心点到扩散中心的距离。'''
return math.hypot(position[0] + width / 2 - center_x, position[1] + height / 2 - center_y)


def _build_fill_positions(root = None, width = None, height = None):
'''生成窗口坐标:先画空心爱心路径,再从爱心外侧向屏幕四周扩散。'''
pass
# WARNING: Decompyle incomplete


def _clamp_window_position(root, width = None, height = None, x = None, y = ('root', 'tk.Tk', 'width', 'int', 'height', 'int', 'x', 'int', 'y', 'int', 'return', 'tuple[int, int]')):
'''把抖动后的窗口坐标限制在屏幕内,避免跑到不可见区域。'''
screen_w = max(root.winfo_screenwidth(), width)
screen_h = max(root.winfo_screenheight(), height)
max_x = max(0, screen_w - width)
max_y = max(0, screen_h - height - TASKBAR_GAP)
return (min(max(0, x), max_x), min(max(0, y), max_y))


def _place_window(win = None, width = None, height = None, position = ('win', 'tk.Toplevel', 'width', 'int', 'height', 'int', 'position', 'tuple[int, int]', 'return', 'None')):
'''把弹窗放到铺屏队列指定的位置。'''
(x, y) = position
win.geometry(f'''{width}x{height}+{x}+{y}''')


def _wiggle_popup(root, popup, width, height, base_position = None, spawn_index = None, step = None, max_steps = ('root', 'tk.Tk', 'popup', 'tk.Toplevel', 'width', 'int', 'height', 'int', 'base_position', 'tuple[int, int]', 'spawn_index', 'int', 'step', 'int', 'max_steps', 'int', 'return', 'None')):
'''让少量弹窗在原坐标附近鬼畜抖动一小段时间。'''
if step >= max_steps:
return None
if not root.winfo_exists() or popup.winfo_exists():
return None
phase = spawn_index * 0.73 + step * 1.95
dx = round(math.sin(phase) * WIGGLE_AMPLITUDE)
dy = round(math.cos(phase * 1.31) * WIGGLE_AMPLITUDE)
(x, y) = _clamp_window_position(root, width, height, base_position[0] + dx, base_position[1] + dy)
popup.geometry(f'''{width}x{height}+{x}+{y}''')
if step % 4 == 0:
popup.title(GLITCH_TITLES[(spawn_index + step) % len(GLITCH_TITLES)])
popup.attributes('-topmost', True)
popup.lift()
popup.after(WIGGLE_INTERVAL_MS, _wiggle_popup, root, popup, width, height, base_position, spawn_index, step + 1, max_steps)
return None
# WARNING: Decompyle incomplete


def _start_fun_motion(root, popup, width = None, height = None, base_position = None, spawn_index = ('root', 'tk.Tk', 'popup', 'tk.Toplevel', 'width', 'int', 'height', 'int', 'base_position', 'tuple[int, int]', 'spawn_index', 'int', 'return', 'None')):
'''按固定间隔挑一部分窗口抖动,制造鬼畜感。'''
if spawn_index % WIGGLE_EVERY_N != 0:
return None
max_steps = max(1, WIGGLE_DURATION_MS // WIGGLE_INTERVAL_MS)
popup.after(WIGGLE_INTERVAL_MS, _wiggle_popup, root, popup, width, height, base_position, spawn_index, 0, max_steps)


def _close_popup(popup = None, active_windows = None):
'''关闭单个弹窗,并从活跃窗口集合里移除。'''
active_windows.discard(popup)
if popup.winfo_exists():
popup.destroy()
return None
return None
# WARNING: Decompyle incomplete


def _ignore_popup_close(popup = None):
'''1 分钟内忽略标题栏关闭按钮和 Alt+F4,只把窗口重新置顶。'''
if popup.winfo_exists():
popup.attributes('-topmost', True)
popup.lift()
return None
return None
# WARNING: Decompyle incomplete


def _spawn_popup(root, active_windows = None, popup_image = None, heart_positions = None, next_position = ('root', 'tk.Tk', 'active_windows', 'set[tk.Toplevel]', 'popup_image', 'tk.PhotoImage | None', 'heart_positions', 'list[tuple[int, int]]', 'next_position', 'list[int]', 'return', 'None')):
'''创建一个轻量的置顶图片窗口,并在指定时间后自动销毁。'''
pass
# WARNING: Decompyle incomplete


def _spawn_burst(root, active_windows = None, popup_image = None, heart_positions = None, next_position = ('root', 'tk.Tk', 'active_windows', 'set[tk.Toplevel]', 'popup_image', 'tk.PhotoImage | None', 'heart_positions', 'list[tuple[int, int]]', 'next_position', 'list[int]', 'return', 'None')):
'''一次性创建一小串弹窗,形成更密集的连串效果。'''
for _ in range(BURST_SIZE):
_spawn_popup(root, active_windows, popup_image, heart_positions, next_position)


def _spawn_tick(root, started_at_ms, active_windows = None, popup_image = None, heart_positions = None, next_position = ('root', 'tk.Tk', 'started_at_ms', 'int', 'active_windows', 'set[tk.Toplevel]', 'popup_image', 'tk.PhotoImage | None', 'heart_positions', 'list[tuple[int, int]]', 'next_position', 'list[int]', 'return', 'None')):
'''逐 tick 生成弹窗,避免一次性排入大量 after 任务导致图片绘制阻塞。'''
elapsed_ms = int(root.tk.call('clock', 'milliseconds')) - started_at_ms
if root.winfo_exists():
if elapsed_ms < SPAWN_DURATION_MS:
_spawn_burst(root, active_windows, popup_image, heart_positions, next_position)
root.after(SPAWN_INTERVAL_MS, _spawn_tick, root, started_at_ms, active_windows, popup_image, heart_positions, next_position)
return None
return None


def _run_popup_burst():
'''按间隔连续生成弹窗;Esc 可作为测试时的快速退出键。'''
pass
# WARNING: Decompyle incomplete


def main():
if '--self-check' in sys.argv:
return _self_check()
if None in sys.argv or os.environ.get('PKWCTF_SAFE_MODE') == '1':
return 0
_run_popup_burst()
return 0

if __name__ == '__main__':
raise SystemExit(main())

1
2
3
def _recover_flag():
'''Return the flag by calling the native extension module.'''
return tk_runtime.recover_flag()

重点关注tk_runtime.pyd(即c写的pyhton扩展),

定义扩展模块 — Python 3.14.0 文档 - Python 文档

找到tk_runtime.cp312-win_amd64.pyd进IDA

用 C 写代码,调用CPython 提供的一套 C‑API,编译成动态库 (dll)。 Python 运行时import xxx的时候,会加载这个 dll,导出一个特殊函数: PyInit_tk_runtime(注意命名规则,PyInit_模块名)

我们函数列表找PyInit_tk_runtime

image-20260930213135504

在单阶段初始化中,初始化函数(PyInit_modulename) 应创建、填充并返回一个模块对象。这通常使用 PyModule_Create()和诸如 PyModule_AddObjectRef()等函数来完成。

image-20260930213610775

对于第一个参数type PyModuleDef

模块定义结构体,它包含创建模块对象所需的所有信息。此结构体必须静态分配(或以其他方式保证在任何从它创建的模块存在期间都有效)。通常,每个扩展模块只有一个此类型的变量。

image-20260930215154598

即

1
2
3
4
5
6
7
8
9
10
11
12
typedef struct PyModuleDef {
PyModuleDef_Base m_base;
const char *m_name;
const char *m_doc;
Py_ssize_t m_size;
PyMethodDef *m_methods;
PyModuleDef_Slot *m_slots;
inquiry m_reload; //3.5之前
traverseproc m_traverse;
inquiry m_clear;
freefunc m_free;
} PyModuleDef;

那我们再来看看这块地址

image-20260930215123791

其实对应的就是

1
2
3
4
5
6
7
8
9
10
11
12
13
14
1800051A0  +00 ┐
1800051A8 +08 │
1800051B0 +10 │ PyModuleDef_Base m_base
1800051B8 +18 │
1800051C0 +20 ┘

1800051C8 +28 m_name -> "tk_runtime"
1800051D0 +30 m_doc -> "Native runtime helper for PopupReverse."
1800051D8 +38 m_size -> -1
1800051E0 +40 m_methods -> off_180005000
1800051E8 +48 m_slots -> NULL
1800051F0 +50 m_traverse -> NULL
1800051F8 +58 m_clear -> NULL
180005200 +60 m_free -> NULL

我们优先关注m_methods,它直接指向PyMethodDef *,也就是模块导出的python函数表

我们跟踪

image-20260930221406936

off_180005000 就是一个 PyMethodDef 数组

1
2
3
4
5
6
typedef struct PyMethodDef {
const char *ml_name;
PyCFunction ml_meth;
int ml_flags;
const char *ml_doc;
} PyMethodDef;

我们关注函数实现,先看recover_flag

image-20260930221742044

image-20260930221747938

rc4_box240_init_state相当于 RC4 的 KSA,但不是标准的RC4,这里是S[240],其中key是”YMSLW:rc4-box-240:v2”

rc4_box240_next_byte相比于标注的RC4的PRGA,额外加入了当前字符位置,每一轮状态跟新依赖这个位置输出

再来看check_flag

image-20260930222232180

读取我们输入v6,与解密出来的flagv7比对

最后一个函数不用看了

也可以为了更美观点,我们自己定义结构体让IDA识别

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
typedef struct PyModuleDef_Base {
long long ob_refcnt;
void *ob_type;
void *m_init;
long long m_index;
void *m_copy;
} PyModuleDef_Base;

typedef struct PyModuleDef {
PyModuleDef_Base m_base;
const char *m_name;
const char *m_doc;
long long m_size;
void *m_methods;
void *m_slots;
void *m_traverse;
void *m_clear;
void *m_free;
} PyModuleDef;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def rc4_box240_ksa(key):
S = list(range(240))
v2 = 0
for i in range(240):
idx_key = (7*i +5) % 20
kb = key[idx_key]
term = (13*i +57) % 240
v2 = ( S[i] + v2 + term + kb ) % 240
S[i], S[v2] = S[v2], S[i]
return S

def rc4_box240_prga(S, n_bytes):
j = 0
i = 0
stream = []
for loop_idx in range(n_bytes):
j = (j + 1) % 240
i = ( loop_idx + S[j] + i ) % 240
S[i], S[j] = S[j], S[i]
xor_ij = (i ^ j) % 240
t_idx = ( S[xor_ij] + S[i] + S[j] ) % 240
t = S[t_idx]
out = ((29 * loop_idx + 109) ^ t) & 0xFF
stream.append(out)
return bytes(stream)

def main():
key = b"YMSLW:rc4-box-240:v2"
cipher = bytes([
0x52,0x5A,0x71,0x48,0x61,0x5D,0xF1,
0xFF,0x93,0xAE,0xD9,0xCB,0x90,0x9B,
0x5F,0xE9,0x4C,0xAD,0x1B,0xBD,0xBC,
0xCA,0xE6,0xB2,0xDD,0x4A
])
S = rc4_box240_ksa(key)
keystream = rc4_box240_prga(S,26)
plain = bytes( [ ks ^ c for ks,c in zip(keystream,cipher) ] )
flag = plain.decode('ascii')
print("keystream:", keystream.hex())
print("plain bytes:", plain.hex())
print("flag:", flag)


if __name__ == "__main__":
main()

Moon!

描述: 中秋佳节,月圆之时。感谢各位选手参与本次比赛,祝各位师傅以及老师同学们中秋快乐,学习之路一帆风顺。

PKWCTF{The_mo0n_1s_be3ut1ful_tOnigh7!!!}

空城计

很有意思的一道题

image-20260930232432578

空空如也,看一下PE信息,有一个VEH

image-20260930232931444

还有ASLR,关掉方便我们调试

image-20260930233111195

改成8400即可

image-20260930233222796

同时在402024处有TLS的地址

image-20261001101228916

image-20261001101308918

地址为00403000,我们跟进

进dbg,果然断在了4030000,一路往下执行

image-20261001103822396

40301E处注册了VEH接着执行

image-20261001102956614

4030C8有个除0异常

image-20261001103120768

运行到403103

image-20261001114016803

观察栈,由低到高,第一个参数是旧EBP,再是返回地址,再是EBP+8,即EXCEPTION_POINTERS结构体指针,

1
2
3
4
typedef struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord; // 指向异常信息
PCONTEXT ContextRecord; // 指向出错时的寄存器状态
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;

我们去内存中看,1AF4E8即为异常信息的地址

image-20261001114718947

image-20261001114829534

对应的C0000094除0异常

403103取参数指针,403110判断异常是不是除0异常,

在403118处将结构体第二个成员赋值给EDX,指向 CONTEXT

1
2
3
4
5
0040311F         | E8 00000000                         | call 空城计.403124                                   
00403124 | 58 | pop eax
00403125 | 2D 24010000 | sub eax,124
0040312A | 8D88 C8000000 | lea ecx,dword ptr ds:[eax+C8]
00403130 | 398A B8000000 | cmp dword ptr ds:[edx+B8],ecx

call+pop,那么eax = 00403124,减去124,eax=403100,加上C8,那么ecx=4030C8

判断保存的 EIP 是否指向那条除零指令

之后

1
2
3
4
5
00403138         | 05 00020000                         | add eax,200                                         
0040313D | 8982 B8000000 | mov dword ptr ds:[edx+B8],eax
00403143 | B8 FFFFFFFF | mov eax,FFFFFFFF
00403148 | 5D | pop ebp
00403149 | C2 0400 | ret 4

现在EAX = 403000 + 200 = 403200,将保存的EIP修改[001AF5F0]:4030C8 → 403200(CONTEXT.Eip)

对应的c应该是

1
2
3
4
5
6
7
8
9
10
11
12
13
14
LONG handler(EXCEPTION_POINTERS *p)
{
if (!p || !p->ExceptionRecord || !p->ContextRecord)
return EXCEPTION_CONTINUE_SEARCH;

if (p->ExceptionRecord->ExceptionCode != 0xC0000094)
return EXCEPTION_CONTINUE_SEARCH;

if (p->ContextRecord->Eip != 0x4030C8)
return EXCEPTION_CONTINUE_SEARCH;

p->ContextRecord->Eip = 0x403200;
return EXCEPTION_CONTINUE_EXECUTION;
}

那我们取403200看看

image-20261001121718182
执行完sub, ESI = 403000

一路运行

image-20261001122654575

此处解密出了flag字符串,后面调试一直退出.直接往下看了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
00403373                       | 8B1F                                  | mov ebx,dword ptr ds:[edi]         
00403375 | 8B57 04 | mov edx,dword ptr ds:[edi+4]
00403378 | 31ED | xor ebp,ebp
0040337A | 89D0 | mov eax,edx
0040337C | C1E0 04 | shl eax,4
0040337F | 89D1 | mov ecx,edx
00403381 | C1E9 05 | shr ecx,5
00403384 | 31C8 | xor eax,ecx
00403386 | 01D0 | add eax,edx
00403388 | 89E9 | mov ecx,ebp
0040338A | 83E1 03 | and ecx,3
0040338D | 8B8C8E 00080000 | mov ecx,dword ptr ds:[esi+ecx*4+800]
00403394 | 01E9 | add ecx,ebp
00403396 | 31C8 | xor eax,ecx
00403398 | 01C3 | add ebx,eax
0040339A | 81C5 B979379E | add ebp,9E3779B9

这里很像xtea,有个与3,左右移,对应v0 += (((v1 << 4) ^ (v1 >> 5)) + v1)^ (sum + key[sum & 3]);

那么[esi+ecx*4+800]指向的就是key,位于0x403800

image-20261001123615540

密文就在旁边,403810

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import struct

MASK = 0xFFFFFFFF
DELTA = 0x9E3779B9

key = (0xA17C9E43, 0x6D20B8F5, 0xC3E4719A, 0x58BF026D)

ciphertext = bytes.fromhex(
"66bee337eaab0987"
"189e29c22143ba35"
"f849c1b5f54e1185"
"30627b083145724a"
"20308447e6d06b86"
"75309dedf9bb5137"
"36d7e0785ce12fbd"
)

def mix(v):
return (((v << 4) ^ (v >> 5)) + v) & MASK

def decrypt_block(block):
v0, v1 = struct.unpack("<2I", block)
total = (DELTA * 32) & MASK

for _ in range(32):
v1 = (v1 - (
mix(v0) ^ ((total + key[(total >> 11) & 3]) & MASK)
)) & MASK

total = (total - DELTA) & MASK

v0 = (v0 - (
mix(v1) ^ ((total + key[total & 3]) & MASK)
)) & MASK

return struct.pack("<2I", v0, v1)

plain = b"".join(
decrypt_block(ciphertext[i:i + 8])
for i in range(0, len(ciphertext), 8)
)

assert plain[-7:] == b"\x07" * 7
print(plain[:-7].decode("ascii")

小虎鲸贴纸Show

image-20261001134846179

xtea

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import struct

MASK = 0xffffffff
DELTA = 0x9e3779b9

cipher = bytes([
201, 230, 247, 219, 120, 52, 13, 141,
17, 7, 4, 59, 227, 32, 75, 39
])
key = struct.unpack(">4I", b"sticker_xtea_key")

def mix(v, total, k):
return (((((v << 4) ^ (v >> 5)) + v) & MASK)
^ ((total + k) & MASK))

plain = bytearray()

for offset in range(0, len(cipher), 8):
v0, v1 = struct.unpack_from(">2I", cipher, offset)
total = (DELTA * 32) & MASK

for _ in range(32):
v1 = (v1 - mix(v0, total, key[(total >> 11) & 3])) & MASK
total = (total - DELTA) & MASK
v0 = (v0 - mix(v1, total, key[total & 3])) & MASK

plain.extend(struct.pack(">2I", v0, v1))

print(bytes(plain))


解出trail_2026},后面的我没找到,交给ai了

从资源恢复其余片段

strings.xml:Base64

在 JADX 的资源树中查看 resources.arsc/res/values/strings.xml:

1
<string name="album_preview_seed">UEtXQ1RGe0QwbnRf</string>

进行 Base64 解码:

1
base64.b64decode("UEtXQ1RGe0QwbnRf")

得到前缀:

1
PKWCTF{D0nt_

activity_main.xml:Base32

打开 resources.arsc/res/layout/activity_main.xml,发现 ImageView 的 android:tag:

1
android:tag="ORZHK43UL5RXK5DFL5ZXI2LDNNSXE427"

字符串只包含大写字母和 Base32 字符集中的数字,尝试 Base32 解码:

1
base64.b32decode("ORZHK43UL5RXK5DFL5ZXI2LDNNSXE427")

得到:

1
trust_cute_stickers_

colors.xml:RGB 转 ASCII

在 resources.arsc/res/values/colors.xml 中,有六个按编号排列的颜色:

1
2
3
4
5
6
<color name="album_tone_01">#616c62</color>
<color name="album_tone_02">#756d5f</color>
<color name="album_tone_03">#746170</color>
<color name="album_tone_04">#735f72</color>
<color name="album_tone_05">#657665</color>
<color name="album_tone_06">#616c5f</color>

将每个颜色的 RGB 字节解释为 ASCII:

1
2
3
4
5
6
61 6c 62 → alb
75 6d 5f → um_
74 61 70 → tap
73 5f 72 → s_r
65 76 65 → eve
61 6c 5f → al_

按编号拼接,得到:

1
album_taps_reveal_

如果工具显示的是八位颜色 #ffRRGGBB,只取后面的 RGB 三个字节,忽略 alpha。

sticker_notes.txt:ROT47

打开 资源文件/res/raw/sticker_notes.txt:

1
2
3
cache.version=12
cache.note=9:556?0C6D@FC460
cache.owner=album

对 cache.note 使用 ROT47 解码。ROT47 对 ASCII 33~126 范围内的字符循环移位 47:

1
chr(33 + (ord(c) - 33 + 47) % 94)

得到:

1
hidden_resource_

PKWCTF{D0nt_trust_cute_stickers_album_taps_reveal_hidden_resource_trail_2026}

01-1990-冬天

我们用Doxbox-x调试

1
2
mount d path
d:

image-20261001140646419

还以为是输入46,格式错误,照着输也没啥有用的信息

我们俺ALT+PAUSE弹出调试窗口

image-20261001140956494

可以看到CS是FS00,DS是0813

image-20261001141123503

此窗口输入BP 0813 014C,下个断点,此窗口再F5继续运行,回到主程序输入

image-20261001141329793

跟踪我们的输入来到0813 0544,输入D 0813 0544可以看对应内存

地址0536被放进si,si指向输入的第一个字符,34F是跳过空格(可以跟进去分析)

0D是回车,1C4是exit,我们略过

一路F10,到这个call1F7

image-20261001142310470

F11进去看看

image-20261001142508763

读取输入,放在al,会与0D(回车)比较,代表输入结束,往下看还有比较

image-20261001145159258

比较了44和49,后面再运行就会退出1F7,我们尝试修改al值看见完整逻辑

输入SR AL 44

image-20261001145822873

后面同理

图太多了,最后调试出来是依次和44 49 41 52 59 0D比较,对应就是DIARY回车

image-20261001151302851

02-1998-春天

image-20261001151721210

Win16NE格式,可以用otvdm打开https://github.com/otya128/winevdm

image-20261001152742892

看着好像就是个钟点了没啥反应,IDA也分析不明白,然后不会了TT,交给ai了

入口 1104h 完成初始化后调用 sub_494。其中包含 REGISTERCLASS、CREATEWINDOW 和消息循环,可确定它是应用主流程。

注册窗口类时,将窗口过程设置为 cseg01:01DC。该过程在 0292h 比较消息值 0203h,也就是左键双击消息,匹配后进入 02FFh。

双击处理依次检查:

条件 代码依据
点击位置 sub_1B2 在正常坐标范围内检查 (x−140)² + (y−140)² ≤ 225
时间允许状态 定时器调用 sub_122,时间命中后设置窗口附加字段
双击间隔 sub_A4 按间隔除以 250 查表,只接受所取 16 位间隔至少约 3000 ms
双击计数 0371h 与 3 比较,达到后调用 sub_B54

时间条件是 07:24:42,三个数分散在不同位置:

  • 小时:strlen("ClockWnd") − 1 = 7。
  • 分钟:菜单项 ID 66h − 4Eh = 18h = 24。
  • 秒:直接与 2Ah = 42 比较。

这不是已验证的手动触发教程。 定时器可能在时间不匹配时清零非零计数,而双击间隔又要求至少约 3 秒,因此不能认定“调好时间后连双击三次”即可触发。本 WP 通过原文件静态解密复现。

定位资源和解密算法

sub_B54 的流程是:

1
2
3
4
5
sub_CC6 构造密钥
→ 加载 PRVT 类型、ID 为 1 的资源
→ 复制资源到缓冲区
→ sub_F84 解密
→ 用对话框显示文本

sub_F84 使用 AND SI,7 计算密钥索引,再逐字节 XOR,因此算法为:

1
plaintext[i] = ciphertext[i] ^ key[i % 8]

原文件的密文位于 文件偏移 1D8Eh,长度 168h,共 360 字节。这些是文件位置,与前面的代码段偏移不同。

3 还原 8 字节密钥

sub_CC6 从字符串资源和自身 NE 结构中拼接密钥:

来源 数值 密钥字节
ID 为 5 的字符串资源,取前 4 字节 Read 52 65 61 64
第三个段的标志,小端 word 0D41h 41 0D
模块引用中 USER 的出现次数,小端 word 1 01 00

完整密钥:

1
52 65 61 64 41 0D 01 00

结构解析时注意:

  • 文件 3Ch 处给出 NE 头位置,本文件为 80h。
  • 第三个段标志位于 NE + 段表偏移 + 2×8 + 4,不要误读成 NE 头的入口字段。
  • 字符串资源块 1 包含 ID 0~15,要从 ID 0 开始计数。
  • 资源条目的偏移和长度需按资源对齐移位值转换;本文件左移 1 位。
1
2
3
4
5
6
7
8
9
10
from pathlib import Path

src = Path(r".exe")
data = src.read_bytes()
key = bytes.fromhex("52 65 61 64 41 0D 01 00")
ciphertext = data[0x1D8E:0x1EF6]
plaintext = bytes(c ^ key[i % 8] for i, c in enumerate(ciphertext))
text = plaintext.decode("gbk")
Path("note.txt").write_text(text, encoding="utf-8")
print(text[text.index("PKWCTF{"):].strip())

03-2006-夏天

略

后日谈:秋天

压缩包的密码正确。

里面没有第四个可执行文件。

只有一个很小的文本文件。

你打开了它。

这一次,打开文件的人不只是 Rain。

也是你。


如果你能看到这里,说明前面三个程序,你都已经认真看过了。

其实我一直不知道,将来会是谁打开它们。

也许根本不会有人打开。

1990 年冬天,我刚开始写程序。那个计算器没什么用,公司里的前辈也确实这么说。

但那是我第一次发现,只要肯花时间把一件事情看明白,机器就会真的按照我的想法工作。

1998 年春天,我已经会写 Windows 程序了。

窗口、消息、资源、菜单……那时候我觉得,只要程序终于有了一个像样的窗口,大概就已经很了不起。

后来我才知道,人学会的东西越多,就越喜欢把简单的事情弄复杂。

所以到了 2006 年夏天,我写了第三个程序。

如果你真的把它看完了——辛苦你了。

我承认,那个时候的我确实有一点过分。

但我很开心。

不是因为那些技巧有多厉害。

只是因为十六年过去以后,我发现自己还是会为了弄懂一件别人觉得“没什么用”的东西,在电脑前坐到很晚。

这三份程序,我后来一直没有删。

不是因为它们写得好。

恰恰相反,现在回头看,里面有不少东西都很幼稚,也有不少东西完全可以写得更简单。

可代码和照片有一点像。

它留下来的不只是结果。

它还会留下那个时候的你,是怎么思考的。

冬天是我刚刚开始的时候。

春天是我第一次觉得,自己真的会写程序了。

夏天是我最喜欢折腾机器的那几年。

至于秋天,我没有再留一个程序。

因为一个人的四季,不应该全部由同一个人写完。

如果现在读到这里的人,是你——

那剩下的,就该轮到你自己写了。

如果你恰好是在 2026 年的秋天看到这些话,那就更好。

前三个季节属于我。

这个秋天,属于你。

别急着证明它有什么用。

先去做你真正想弄明白的东西。

——爷爷


Rain 把文件看完以后,在电脑前坐了一会儿。

然后他终于走出储藏室,来到客厅。

爷爷还坐在沙发上看电视。

Rain 问:

“第三个程序是不是有点太过分了?”

爷爷盯着电视看了两秒。

“哦。”

“你做到第三个了啊。”

Rain:“……”

爷爷笑了一下。

“年轻的时候比较闲。”

然后他把茶杯往旁边挪了挪。

“所以,你看懂了吗?”

Rain 没有马上回答。

他只是也笑了。


故事到这里,Rain 已经没有新的文件可以打开了。

你也没有。

接下来要写什么,已经不在这个压缩包里。

1
PKWCTF{autumn_is_yours}

封面来自あんよ