做题记录
Rank:3

❤️ Signin
题目描述:
| 12
 
 | 听说有人在CNSS招新群的某个地方藏了一个隐秘的flag,到底在哪呢?快来加入招新群431060996
 
 | 
题目:按照要求搜索群聊,群聊介绍中有一段base64,解密得flag:

flag:
cnss{W3Lc0m3_7o_Cn55_5umm3r!}
🔎 侦探 CNSS 娘的秘密
题目描述:
题目附件为一张图片:

十六进制打开,在文件末尾看到flag:

flag:
cnss{W0w!!!Y0u_s4ww_m3!}
🏆 重生之我在 CNSS 当 OIer
题目描述:
| 12
 3
 
 | 题目描述和输入输出格式都找不到了...但是身为超级 OIER 的你一定可以 AC 本题吧
 nc 47.108.140.140 1107
 
 | 
题目:
| 12
 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
 
 | import os
 import sys
 import subprocess
 from secret import flag
 
 SRC = '/home/ctf/temp/code.c'
 BIN = '/home/ctf/temp/temp_bin'
 DATA = '/home/ctf/data'
 
 
 res_map = {
 'CE': 'Compile Error',
 'TLE': 'Time Limit Exceeded',
 'RE': 'Runtime Error',
 'WA': 'Wrong Answer',
 'AC': 'Accepted'
 }
 
 
 def check_excutable(path, input, ans, timeout):
 if not os.path.isfile(path):
 return 'CE'
 
 try:
 p = subprocess.run(
 [f"./{path}"],
 input=input,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT,
 timeout=timeout
 )
 except subprocess.TimeoutExpired:
 return 'TLE'
 
 if p.returncode != 0:
 return 'RE'
 
 try:
 output = p.stdout.decode()
 except UnicodeDecodeError:
 return 'WA'
 
 lines = output.strip().split('\n')
 return 'AC' if lines == ans else 'WA'
 
 
 if __name__ == "__main__":
 
 print("Enter your code (ending with two blank lines):")
 
 code1 = []
 while True:
 try:
 line = input()
 except EOFError:
 break
 code1.append(line)
 
 if len(code1) >= 2 and code1[-1] == '' and code1[-2] == '':
 break
 with open(SRC, "w") as fd1:
 fd1.write('\n'.join(code1))
 
 p = subprocess.run(
 ["gcc", "-w", "-O2", SRC, "-o", BIN],
 stdout=sys.stdout,
 stdin=subprocess.DEVNULL,
 stderr=subprocess.STDOUT
 )
 
 with open(os.path.join(DATA, f'input.in'), 'rb') as f:
 instr = f.read()
 with open(os.path.join(DATA, f'output.out'), 'r') as f:
 ans = f.read().strip().split('\n')
 
 res = check_excutable(BIN, instr, ans, 0.5)
 print('Result: ', res_map[res])
 if res == 'AC':
 print(flag)
 print('\n')
 
 | 
简单翻译一下程序功能:输入一段c语言代码,送至code.c中,进行编译后,将input.in中的内容作为输入执行这段程序,并将程序输出结果与output.out中的内容做对比,如果结果一致,则会输出flag。
问题在于,我们并不知道input.in与output.out的内容是什么,也就无法根据需要写出对应程序。可是其实再仔细想想,题目要求其实仅仅是要求程序内容输出与output.out内容一致而已,而根据题目附件,output.out文件就在DATA目录下,所以其实只需要写一个能打印出output.out内容的c语言程序即可。
exp.c:
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 
 | #include <stdio.h>
 int main() {
 FILE *file;
 char filename[] = "/home/ctf/data/output.out";
 char ch;
 
 file = fopen(filename, "r");
 while ((ch = fgetc(file)) != EOF) {
 putchar(ch);
 }
 
 fclose(file);
 
 return 0;
 }
 
 | 
得到flag:

flag:
cnss{y0u_4re_U1tim34ate_01er!}
❓ 泻药,人在CNSS,刚打完招新
题目描述:
题目的全部信息只有题目标题和题目描述,没有附件、没有靶机,因此基本可以确定为社工题。
直接搜索题目描述,就能在知乎上搜到一个回答,最后就有flag:

flag:
cnss{L3T_U$_$T4RT!}
🔮 東方希缇符
题目描述:
| 12
 
 | 试着找出最新最热(确信)东方新作中的 flag 吧!Hint:flag 在游戏资源包内
 
 | 
题目给了th08的游戏包,结合hint知道应该是要对资源包解包得flag。
thxx解包参考:
关于东方project系列正作的魔改教程以及注意事项 - 哔哩哔哩 (bilibili.com)
跟着一步一步做:
1、下载工具
2、选择好文件与对应游戏(th08),进行解包

3、在解包得到的资源中发现flag.txt

flag:
cnss{Y0u_4re_T0uhou_M4st3er_n0w!}
🔑 Shino 的 Crypto 梦想
参考我另一篇文章:
misc趣题(一) | 糖醋小鸡块的blog (tangcuxiaojikuai.xyz)
☁️ Hurrison 的网站
题目描述:
| 12
 3
 4
 
 | Hurrison 刚刚学会搭建网站,听说套了 Cloudflare 之后大黑客 Casio 就找不到服务器 IP 了Hint:flag格式如下:
 cnss{IPv4}
 IPv4 格式为 xxx.xxx.xxx.xxx
 
 | 
题目:
| 1
 | https://cnss2023catchme.hurrison.com/
 | 
根据题目描述,这题是要寻找隐藏在Cloudflare下的服务器ip地址,直接对这个要求进行搜索:

逐个尝试文章中的方法,最后发现这个方法很有效果:

到SecurityTrails: Data Security, Threat Hunting, and Attack Surface Management Solutions for Security Teams搜索对应URL,并不能直接在历史数据里看到结果。开一开脑洞,搜索hurrison.com,就有很多子域名:

逐个查看,并结合Censys逐个搜索域名,如下:

找到一个在给定范围内的ip地址就可以了。
flag:
cnss{103.239.247.22}
💻 cn55Terminal
题目描述:
| 12
 3
 4
 
 | 题目描述又忘了,凑合用吧👇curl -sL https://transfer.sh/VKyC2P8CPw/id.txt | nc 124.221.34.13 50024
 Update: 为避免这行命令可能造成不必要的误解,还是试试手动体验 cn55Terminal 吧~
 如果你访问不了,或者想手动,这里也贴出 id.txt
 
 | 
id.txt:
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 
 | ............................................................................
 ......................................
 .@@...........@@......................
 .@@...........@@......................
 ..............@@......................
 ..............@@......................
 ..............@@......................
 .@@.....@@@@@@@@......................
 .@@....@@@@@@@@@......................
 .@@...@@@@@@@@@@......................
 .@@...@@@....@@@......................
 .@@...@@@....@@@......................
 .@@...@@@.....@@......................
 .@@...@@@....@@@......................
 .@@...@@@....@@@......................
 .@@...@@@@@@@@@@......................
 .@@...@@@@@@@@@@......................
 .@@....@@@@@@@@@......................
 ......................................
 ......................................
 ......................................
 
 | 
xshell打开,缩小界面看到的命令如下:

可以看到,命令行前的内容以字符画的形式展示出来了,合理猜测,这道题的意思是识别字符画形式的指令并执行。这样的话,我们就需要输入字符画形式的linux指令。先试一试将题目给出的id上传,看看返回内容:

可以看出确实和想象的一模一样,终端执行了id指令。那么接下来就是找脚本,将”cat flag”生成为字符画。最后找到了一个脚本,但是他只能将图片转化为字符画,没事,先生成一张图片:

然后用如下脚本转化:
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 
 | from PIL import Image
 img = Image.open('1.png')
 out_img = img.convert('L')
 w, h = out_img.size
 n=600/max(w,h)
 if n<1:
 out_img = out_img.resize((int(w * n), int(h * n*0.5)))
 else:
 out_img = out_img.resize((int(w), int(h )))
 w, h = out_img.size
 
 asciis = "@."
 texts = ''
 for row in range(h):
 for col in range(w):
 gray = out_img.getpixel((col, row))
 texts += asciis[int(gray / 255 * (len(asciis) - 1))]
 texts += '\n'
 with open("1.txt", "w") as file:
 file.write(texts)
 file.close()
 
 | 
得到1.txt文件,打开即是字符画:

上传给Terminal,即得到flag:

flag:
cnss{funny_ascii_ocr_duibudui}
总结
misc的知识面涉及很广,很多知识都是边做题边学,很多工具也是边做题边下的,一点一点积累吧。