[SDCTF 2022]lots of logs

网站主要是一个记录了很多日志的博客
image

这里主要给出了三篇,访问其中一篇,路径显示了该日志的时间等
image

没有记录日志的界面
image

也就是说logs目录下都是记录的日志文件,使用脚本爬取记录了日志的界面
脚本:

点击查看代码
import requests
import datetime
import os

os.makedirs("log", exist_ok=True)

for y in range(2016, 2023):
    for m in range(1, 13):
        for d in range(1, 32):
            try:
                date_obj = datetime.date(y, m, d)
                week = date_obj.strftime("%a")
                url = f"http://node5.anna.nssctf.cn:25035/logs/{y}/{m}/{d}/{week}.log"
                response = requests.get(url, timeout=5)
                if response.status_code == 200:
                    req_text = response.text
                    if "Cannot GET" not in req_text:
                        filename = f"log/{y}-{m}-{d}-{week}.log"
                        with open(filename, "w", encoding="utf-8") as f:
                            f.write(req_text)
                    else:
                        pass
                else:
                    pass
            except ValueError:
                continue
            except requests.exceptions.RequestException as e:
                print(f"[网络错误] {y}-{m}-{d}: {e}")
                continue
            except Exception as e:
                print(f"[未知错误] {y}-{m}-{d}: {e}")
                continue

这里用kali分析下载的日志
image

这里在2018-6-13-Wed.log发现了敏感信息
image

通过grep -iRl "pass" ./log | xargs cat分析文件
这里主要是利用nc连接了题目给的另外一个链接的端口
image
直接nc连接输入Pass得到flag
image

posted @ 2026-03-25 18:00  Morphoko  阅读(18)  评论(0)    收藏  举报