2024 isctf
2026-08-22 20:05:38

老八奇怪自拍照

bandzip解压获得新图片 扫出来一个作者 作为密码

steghide extract -sf /home/kali/Desktop/isctf.jpg -p '1ScTf2024!'

ISCTF{St4gs0lve_Rbg_S4eGh1de_H1de!!!}

第一步修复伪加密

50 4B 03 04 14 00 09``09改成00

50 4B 01 02 1F 00 14 00 09``09改成00

解压缩获得图片 图片放进010获得password:ISCTF2024

题目名叫我们的秘密 使用软件OurSecret

零宽隐写

ISCTF{Nic3_t0_m33t_you}

奇怪的txt

什么是约瑟夫环

一圈人站成一圈,比如有10个人,编号是1,2,3,……10

他们进行淘汰制

从第一个人开始数,每数到第7个人,就把这个人踢出圈。然后从下一个人重新开始数7,再踢掉一个……一直重复,直到所有人都被踢光。踢下来的人按照被踢的顺序站成一排,这个顺序就是约瑟夫环的顺序

核心机制是循环剔除,它是一个递归结构的问题,每淘汰一个人,问题规模从n变为n-1,并且起始位置发生偏移。每次剔除的位置依赖于当前圈的长度和步长k。

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 josephus_circle(num_files, step):
files = list(range(1, num_files + 1)) # 文件编号从1到137
result = [] # 用于存放挑选的文件编号
index = 0 # 起始位置

# 进行约瑟夫环的数数与挑选过程
while files:
index = (index + step - 1) % len(files) # 计算挑选的位置
result.append(files.pop(index)) # 将文件编号加入结果并从列表中移除

return result

# 调用约瑟夫环函数得到文件顺序
selected_files = josephus_circle(137, 7)

# 创建输出文件
with open("flag.txt", "w", encoding="utf-8") as output_file:
for file_number in selected_files:
file_name = f"{file_number}.txt"
try:
# 读取每个文件的内容
with open(file_name, "r", encoding="utf-8") as f:
content = f.read().replace(" ", "") # 删除所有空格
content = "\n".join([line for line in content.splitlines() if line]) # 删除所有空行
# 写入到输出文件中
output_file.write(content + "\n")
except FileNotFoundError:
print(f"Warning: {file_name} not found and will be skipped.")

# 输出文件顺序
print("文件排列顺序:", selected_files)
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
import base64

def recursive_decode(data):
"""尽可能多次 Base64 解码,直到失败"""
current = data.strip() if isinstance(data, str) else data
count = 0

while True:
# 统一转为字符串(去除空白),再尝试解码
if isinstance(current, bytes):
try:
s = current.decode('ascii')
except:
break # 不是文本,停止
else:
s = current

s_clean = s.strip().replace('\n', '').replace('\r', '').replace(' ', '')

if not s_clean:
break

try:
decoded = base64.b64decode(s_clean, validate=True)
count += 1
print(f"[+] 第 {count} 次解码成功")
current = decoded
except Exception:
# 无法解码,退出
break

return current

def main():
try:
with open('flag.txt', 'r') as f:
content = f.read()
except FileNotFoundError:
print("❌ 找不到 flag.txt")
return

print("[*] 开始解码...")
result = recursive_decode(content)

# 尝试输出文本
try:
text = result.decode('utf-8')
print("\n[📄] 结果:")
print(text)

if 'flag{' in text or 'CTF{' in text:
print("\n🎉 找到 flag!")
except:
print("\n[💾] 结果是二进制,保存为 1.bin")

with open('1.bin', 'wb') as f:
f.write(result)

if __name__ == '__main__':
main()

ISCTF{@!98sw-&^si92-2$#334-2024!!}

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