1. 개요
redirection 문제
2. 분석
로그인할 때 302 리다이렉션이 걸려있습니다. python requests 모듈에서 allow_redirects=False 옵션을 사용하거나, curl을 사용하거나 등등해서 리다이렉션을 방지합니다.(node.js의 axios는 불가능)
import base64
import requests
import re
base_url = "http://saturn.picoctf.net:65030"
flag = ""
data = {
'username': 'test',
'password': 'test!'
}
first = requests.post(f"{base_url}/login", data=data, allow_redirects=False)
pattern = "to ([a-zA-Z0-9/=-]+)"
next_url = re.findall(re.compile(pattern), first.text)[0]
print('next_url', next_url)
second = requests.get(f"{base_url}{next_url}")
pattern = '= "([a-zA-Z0-9/=-]+)'
next_url = re.findall(re.compile(pattern), second.text)[0]
print('next_url', next_url)
'pico CTF' 카테고리의 다른 글
[picoCTF] SQL Direct (0) | 2023.04.29 |
---|---|
[picoCTF] SOAP (0) | 2023.04.29 |
[picoCTF] caas (0) | 2023.04.28 |
[picoCTF] X marks the spot (0) | 2023.04.28 |
[pico CTF] Transformation (0) | 2023.04.02 |