Advertisement
Guest User

Buildthevoid V5

a guest
Apr 2nd, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.49 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import time
  4. import json
  5. import random
  6.  
  7. print "Build the Void"
  8.  
  9. print "Getting user agent list for anonymity (please wait)"
  10. user_agent_list=list(set([ua for ua in urllib.urlopen("https://raw.githubusercontent.com/sqlmapproject/sqlmap/master/txt/user-agents.txt").read().splitlines() if not ua.startswith("#")]))
  11.  
  12. accounts = []
  13. sessions = {}
  14. print "For each account you want to use, enter it in like username:password"
  15. print "When you're done, type 'done'"
  16. user_input = ""
  17. while (user_input != "done"):
  18.     user_input = raw_input("Account-> ")
  19.     if user_input.lower() != "done":
  20.         accounts.append(user_input)
  21.  
  22. opener = urllib2.build_opener()
  23. opener.addheaders = [('User-Agent', random.choice(user_agent_list))]
  24. for account in accounts:
  25.     username = account.split(":")[0]
  26.     password = account.split(":")[1]
  27.     data = urllib.urlencode({'op': 'login-main', 'user': username, 'passwd': password, 'api_type': 'json'})
  28.     resp = opener.open('https://www.reddit.com/api/login/'+urllib.quote(username), data).read()
  29.     sessions[username] = json.loads(resp)["json"]["data"]["cookie"]
  30.  
  31. print "Running Build the Void"
  32. void_color = 3 # BLACK
  33. center = [905,546] # x,y of center of void
  34. while True:
  35.     # Fill the void
  36.     for session in sessions.keys():
  37.         cookie = sessions[session]
  38.         color = 3
  39.         while color == void_color:
  40.             # Find a non-black square
  41.             xtest = center[0]+random.randint(-50,50)
  42.             ytest = center[1]+random.randint(-50,50)
  43.             resp = opener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  44.             try:
  45.                 color = int(json.loads(resp)["color"])
  46.             except Exception, e:
  47.                 #print "Exception"
  48.                 #print resp
  49.                 color = 3
  50.         print "Found a non-void color at", xtest, ytest
  51.         data = urllib.urlencode({'x': xtest, 'y': ytest, 'color': void_color})
  52.         newopener = urllib2.build_opener()
  53.         newopener.addheaders = [('User-Agent', random.choice(user_agent_list))]
  54.         newopener.addheaders.append(('Cookie', 'reddit_session='+cookie))
  55.         modhash = json.loads(newopener.open("https://reddit.com/api/me.json").read())["data"]["modhash"]
  56.         newopener.addheaders.append(('x-modhash', modhash))
  57.         try:
  58.             next=newopener.open("https://www.reddit.com/api/place/draw.json", data).read()
  59.             print next
  60.             finalresp = newopener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  61.             if session in finalresp:
  62.                 print "Added successfully"
  63.             else:
  64.                 print finalresp
  65.         except Exception, e:
  66.             pass
  67.     time.sleep(305)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement