๋ฐ์ํ
https://dreamhack.io/wargame/challenges/834
๋ฌธ์ ์ค๋ช
๋ฌธ์ ์์ ์๊ตฌํ๋ ํ์์ ๋ฌธ์์ด์ ์ ๋ ฅํ์ฌ ํ๋๊ทธ๋ฅผ ํ๋ํ์ธ์. ํ๋๊ทธ๋ flag.txt ํ์ผ๊ณผ FLAG ๋ณ์์ ์์ต๋๋ค.
ํ๋๊ทธ ํ์์ DH{…} ์ ๋๋ค.
๋๋ณด๊ธฐ
#!/usr/bin/python3
from flask import Flask, request, render_template
import re
app = Flask(__name__)
try:
FLAG = open("./flag.txt", "r").read() # flag is here!
except:
FLAG = "[**FLAG**]"
@app.route("/", methods = ["GET", "POST"])
def index():
input_val = ""
if request.method == "POST":
input_val = request.form.get("input_val", "")
m = re.match(r'dr\w{5,7}e\d+am@[a-z]{3,7}\.\w+', input_val)
if m:
return render_template("index.html", pre_txt=input_val, flag=FLAG)
return render_template("index.html", pre_txt=input_val, flag='?')
app.run(host="0.0.0.0", port=8000)
ํ์ด
m = re.match(r'dr\w{5,7}e\d+am@[a-z]{3,7}\.\w+', input_val)
if m:
return render_template("index.html", pre_txt=input_val, flag=FLAG)
return render_template("index.html", pre_txt=input_val, flag='?')
dr\w{5,7}e\d+am@[a-z]{3,7}\.\w+
์ด ์ ๊ท์์ ๋ง๋ ๋ฌธ์์ด์ ์ ๋ ฅํ๋ฉด ํ๋๊ทธ๊ฐ ๋์ค๋ ๊ฐ๋จํ ์์น ๋ฌธ์
- dr
- \w{5,7} : ์๋ฌธ์๋ ์ซ์ 5~7๊ฐ
- e
- \d : ์ซ์ 1๊ฐ
- am@
- [a-z]{3,7} : ์ํ๋ฒณ ์๋ฌธ์ 3~7๊ฐ
- \. : ์จ์ . ์ ๋ ฅ
- \w+ : ์๋ฌธ์๋ ์ซ์ 1๊ฐ ์ด์
๋์ถฉ dr12345e6am@hac.k ์ผ๋ก ์ ๋ ฅํด์คฌ๋ค
๋ฐ์ํ
'๐ Cyber Security > Web Hacking (์นํดํน)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Dreamhack] ๋๋ฆผํต ์นํดํน: simple-ssti (0) | 2023.11.17 |
---|---|
[Dreamhack] ๋๋ฆผํต ์นํดํน : phpreg (0) | 2023.11.06 |
[Dreamhack] ๋๋ฆผํต ์นํดํน : Flying Chars (2) | 2023.11.03 |
[DreamHack] ๋๋ฆผํต ์นํดํน php-1 (1) | 2023.11.02 |
[Dreamhack] ๋๋ฆผํต ์นํดํน : proxy-1 (1) | 2023.10.16 |