728x90
@app.route('/')
def index():
    username = request.cookies.get('username', None)
    if username:
        return render_template('index.html', text=f'Hello {username}, {"flag is " + FLAG if username == "admin" else "you are not admin"}')
    return render_template('index.html')

app.py 코드 중 핵심 부분이다.

/(루트) 페이지 즉, 첫 페이지에 접속하면 index 함수가 실행된다.

index 함수는 username 이름의 쿠키 값이 admin이면 "flag is FLAG값" 형태로 출력한다.

개발자 옵션(f12)을 이용해 cookie를 추가한다.

웹 페이지를 새로고침 하면 flag가 나온다.

 

 

728x90

'dreamhack > Web Hacking' 카테고리의 다른 글

pathtraversal  (0) 2023.02.11
session-basic  (0) 2023.02.09
file-download-1  (0) 2023.02.09
XSS-1  (0) 2023.02.07
simple_sqli  (0) 2023.02.07

+ Recent posts