Advertisement
Guest User

build the void V4

a guest
Apr 1st, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import time
  4. import json
  5. import random
  6. a=1
  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. label1
  31. print "Running Build the Void"
  32. void_color = 0 # BLACK
  33. center = [409, 580] # 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 = 0
  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 = 0
  50.  
  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. next=newopener.open("https://www.reddit.com/api/place/draw.json", data).read()
  58. print next
  59. finalresp = newopener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  60. if session in finalresp:
  61. print "Added successfully"
  62. else:
  63. print finalresp
  64. time.sleep(305)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement