Advertisement
Guest User

blew

a guest
Apr 1st, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import time
  4. import json
  5. import random
  6.  
  7. print "Build the Blue"
  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.  
  30. try:
  31. sessions[username] = json.loads(resp)["json"]["data"]["cookie"]
  32. except Exception, e:
  33. print(json.loads(resp))
  34. print "Running Build the Blue"
  35. Blue_color = 13 # BLUE
  36. center = [772, 874] # x,y of center of Blue
  37. while True:
  38. # Fill the Blue
  39. for session in sessions.keys():
  40. cookie = sessions[session]
  41. color = 13
  42. while color == Blue_color:
  43. # Find a non-black square
  44. xtest = center[0]+random.randint(-100,100)
  45. ytest = center[1]+random.randint(-100,100)
  46. resp = opener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  47. try:
  48. color = int(json.loads(resp)["color"])
  49. except Exception, e:
  50. #print "Exception"
  51. #print resp
  52. color = 13
  53. print "Found a non-Blue color at", xtest, ytest
  54. data = urllib.urlencode({'x': xtest, 'y': ytest, 'color': Blue_color})
  55. newopener = urllib2.build_opener()
  56. newopener.addheaders = [('User-Agent', random.choice(user_agent_list))]
  57. newopener.addheaders.append(('Cookie', 'reddit_session='+sessions[session]))
  58. newopener.open("https://www.reddit.com/api/place/draw.json", data).read()
  59. if session in opener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read():
  60. print "Added successfully"
  61. time.sleep(605)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement