Skip to content

Instantly share code, notes, and snippets.

@infra-0-0
Last active January 31, 2016 21:58
Show Gist options
  • Save infra-0-0/33c14a72bab1343f269f to your computer and use it in GitHub Desktop.
Save infra-0-0/33c14a72bab1343f269f to your computer and use it in GitHub Desktop.
pastebin.py
import sys
from urllib import urlopen, 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 = {
'api_dev_key': '',
'api_paste_code': sys.stdin.read(),
'api_paste_expiry_date': "1H",
'api_paste_format': "text",
'api_user_key': "",
'api_paste_private': "1",
'api_option': 'paste',
'api_paste_name': str(int(100*time())%255)
}
while True:
old_keys = copy(keys)
update = False
if len(keys) < 5:
kp = "https://github.com/search?langOverride=\&q=api_dev_key+http%3A%2F%2Fpastebin.com%2Fapi%2Fapi_post.php&type=Code&p="+str(choice(range(50)))
kp = findall('[a-f0-9]{32}', urlopen(kp).read())
kp = list(set(kp))
for k in kp:
keys.append(k)
update = True
pastebin_data['api_dev_key'] = choice(keys)
res = urlopen(PASTEBIN_URL, urlencode(pastebin_data)).read().replace('http', 'https').replace('.com/','.com/raw/')
if 'http' in res:
print res
break
else:
if 'invalid' in res:
keys.remove(pastebin_data['api_dev_key'])
update = True
else:
print res
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