2023 VNCTF
2026-08-22 20:05:38

[VNCTF2023]验证码

https://digi.bib.uni-mannheim.de/tesseract/

下载了软件tesseract记得去配一下PATH

再运行tesseract --version检查一下

最后运行pip install pytesseract pillow下pytesseract的安装包

1
2
3
4
5
6
7
import pytesseract
from PIL import Image

for i in range(135):
path = str(i) + '.png'
text = pytesseract.image_to_string(Image.open(path), lang="eng")
print(text)

把输出保存到input.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import re

# 输入文件名(改成你的实际文件名)
input_file = "input.txt"
# 输出文件名(可选)
output_file = "digits_only.txt"

# 读取整个文件内容
with open(input_file, "r", encoding="utf-8") as f:
content = f.read()

# 提取所有数字字符(0-9),忽略一切其他字符
all_digits = ''.join(re.findall(r'\d', content))

# 打印到控制台
print(all_digits)

# 同时保存到新文件(可选)
with open(output_file, "w", encoding="utf-8") as f:
f.write(all_digits)

print(f"\n✅ 已保存纯数字到 {output_file}")

这时候其实我已经红温了 为什么我使用了灰度化 二值化 去噪 放大的处理以后 提取的数字还是错误很多???

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
import pytesseract
from PIL import Image, ImageEnhance, ImageFilter
import re
import os

def preprocess_image(image_path):
"""
对图片进行预处理:灰度化 → 二值化 → 去噪 → 放大
"""
img = Image.open(image_path)

# 转为灰度图
img = img.convert('L')

# 二值化(阈值可调,128 是中间值)
threshold = 128
img = img.point(lambda p: 255 if p > threshold else 0, mode='1')

# 可选:放大图片(提升小字体识别率)
img = img.resize((img.width * 2, img.height * 2), Image.Resampling.LANCZOS)

# 可选:轻微去噪(如果仍有孤立噪点)
# img = img.filter(ImageFilter.MedianFilter(size=3))

return img

# 遍历所有图片
for i in range(135):
path = f"{i}.png"
if not os.path.exists(path):
print("")
continue

try:
# 预处理图片
clean_img = preprocess_image(path)

# 使用 Tesseract,只允许数字
config = '--psm 8 -c tessedit_char_whitelist=0123456789'
text = pytesseract.image_to_string(clean_img, config=config, lang='eng')

# 提取所有数字(双重保险)
digits = ''.join(re.findall(r'\d', text))
print(digits)

except Exception as e:
print("")

好吧 我使用了别人的wp 先进行下一步

https://tuppers-formula.ovh/

这个是专门用来演示和操作Tupper自指公式的网址

1594199391770250354455183081054802631580554590456781276981302978243348088576774816981145460077422136047780972200375212293357383685099969525103172039042888918139627966684645793042724447954308373948403404873262837470923601139156304668538304057819343713500158029312192443296076902692735780417298059011568971988619463802818660736654049870484193411780158317168232187100668526865378478661078082009408188033574841574337151898932291631715135266804518790328831268881702387643369637508117317249879868707531954723945940226278368605203277838681081840279552

flag{MISC_COOL!!}

VNCTF 2025

[VNCTF 2025]VN_Lang

strings /home/kali/Desktop/VN_lang_8bdfe1d1a42c87474a301bdfc9937a9f.exe | grep -i -A5 -B5 "VNCTF\|flag\|{\|}"

VNCTF{Z8rW1onJVdZKMpl74trRbVpuoPsVV3cjiAVEW0whIHzFp}

1:尝试用zsteg分析图片

zsteg -a /home/kali/Desktop/1.png

png末尾附加了一个zip文件 但是前面多了一个0x20也就是空格

2:提取zip

dd if=/home/kali/Desktop/1.png of=clean.zip bs=1 skip=6548

3:提取内容

unzip -l clean.zip

unzip -p clean.zip flag.txt > safe_flag.bin

注意这里不要直接cat或者head二进制文件 不要直接输出二进制文件到终端 不然终端可能刷乱码 我这里就刷了一遍菱形问号的乱码 多按几次ctrl+c停下来

这时候理论上该有反应了,,但是没有

00000000: 0000 ac42 0000 9c42 0000 4842 0000 4042 ...B...B..HB..@B

00000010: 0000 4842 0000 5442 0000 8642 0000 a842 ..HB..TB…B…B

00000020: 0000 8c42 0000 ac42 0000 9c42 0000 4842 …B…B…B..HB

00000030: 0000 4042 0000 4842 0000 5442 0000 8642 ..@B..HB..TB…B

00000040: 0000 a842 0000 8c42 0000 ac42 0000 9c42 …B…B…B…B

00000050: 0000 4842 0000 4042 0000 4842 0000 5442 ..HB..@B..HB..TB

00000060: 0000 8642 0000 a842 0000 8c42 0000 ac42 …B…B…B…B

00000070: 0000 9c42 0000 4842 0000 4042 0000 4842 ...B..HB..@B..HB

00000080: 0000 5442 0000 8642 0000 a842 0000 8c42 ..TB…B…B…B

00000090: 0000 ac42 0000 9c42 0000 4842 0000 4042 ...B...B..HB..@B

000000a0: 0000 4842 0000 5442 0000 8642 0000 a842 ..HB..TB…B…B

000000b0: 0000 8c42 0000 ac42 0000 9c42 0000 4842 …B…B…B..HB

000000c0: 0000 4042 0000 4842 0000 5442 0000 8642 ..@B..HB..TB…B

000000d0: 0000 a842 0000 8c42 0000 ac42 0000 9c42 …B…B…B…B

000000e0: 0000 4842 0000 4042 0000 4842 0000 5442 ..HB..@B..HB..TB

000000f0: 0000 8642 0000 a842 0000 8c42 0000 ac42 …B…B…B…B

00000100: 0000 9c42 0000 4842 0000 4042 0000 4842 ...B..HB..@B..HB

00000110: 0000 5442 0000 8642 0000 a842 0000 8c42 ..TB…B…B…B

00000120: 0000 ac42 0000 9c42 0000 4842 0000 4042 ...B...B..HB..@B

00000130: 0000 4842 0000 5442 0000 8642 0000 a842 ..HB..TB…B…B

00000140: 0000 8c42 0000 ac42 0000 9c42 0000 4842 …B…B…B..HB

00000150: 0000 4042 0000 4842 0000 5442 0000 8642 ..@B..HB..TB…B

00000160: 0000 a842 0000 8c42 0000 ac42 0000 9c42 …B…B…B…B

00000170: 0000 4842 0000 4042 0000 4842 0000 5442 ..HB..@B..HB..TB

00000180: 0000 8642 0000 a842 0000 8c42 0000 ac42 …B…B…B…B

00000190: 0000 9c42 0000 4842 0000 4042 0000 4842 ...B..HB..@B..HB

000001a0: 0000 5442 0000 8642 0000 a842 0000 8c42 ..TB…B…B…B

000001b0: 0000 ac42 0000 9c42 0000 4842 0000 4042 ...B...B..HB..@B

000001c0: 0000 4842 0000 5442 0000 8642 0000 aa42 ..HB..TB…B…B

000001d0: 0000 8e42 0000 ae42 0000 9e42 0000 4c42 …B…B…B..LB

分析一下文件头 都是???? ??42的格式

把字节倒过来 比如00 00 ac 42实际上是42 ac 00 00

这其实是IEEE 754单精度浮点数

0x42ac0000 ≈ 86.0

0x429c0000 ≈ 78.0

0x42480000 ≈ 50.0

而86 78 50很可能是ASCII码

86 → 'V'

  • 78 → 'N'
  • 50 → '2'
  • 00 00 ac 42 反转后为 42 ac 00 00,浮点数值约86.0,对应ASCII字符 ‘V’
  • 00 00 9c 42 反转后为 42 9c 00 00,浮点数值约78.0,对应ASCII字符 ‘N’
  • 00 00 48 42 反转后为 42 48 00 00,浮点数值约50.0,对应ASCII字符 ‘2’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import struct

with open('/home/kali/safe_flag.bin', 'rb') as f:
data = f.read()

# 每 4 字节一组,按小端序 float 解析
n = len(data) // 4
chars = []
for i in range(n):
chunk = data[i*4:(i+1)*4]
if len(chunk) < 4:
break
# 按 float 解析
val = struct.unpack('<f', chunk)[0]
# 四舍五入取整
intval = round(val)
# 只保留可打印 ASCII 范围 (32~126)
if 32 <= intval <= 126:
chars.append(chr(intval))
else:
# 非可打印字符用 . 代替(或跳过)
pass

print(''.join(chars)[:200]) # 只看前 200 字符

这时我以为我得到了flag 尝试提交VNCTF{BUGWO3134}但是不对 去搜了一下wp 发现想法和实际背道而驰,,,

这就是misc吗

重来嗯嗯,,,

诡异 一个文件夹里只有一个图片 怎么显示文件:2

bandzip不能解压 换wps解压工具

上一页
2026-08-22 20:05:38
下一页