Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- import urllib2
- import time
- import json
- import random
- print "Build the Void"
- print "Getting user agent list for anonymity (please wait)"
- 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("#")]))
- accounts = []
- sessions = {}
- print "For each account you want to use, enter it in like username:password"
- print "When you're done, type 'done'"
- user_input = ""
- while (user_input != "done"):
- user_input = raw_input("Account-> ")
- if user_input.lower() != "done":
- accounts.append(user_input)
- opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent', random.choice(user_agent_list))]
- for account in accounts:
- username = account.split(":")[0]
- password = account.split(":")[1]
- data = urllib.urlencode({'op': 'login-main', 'user': username, 'passwd': password, 'api_type': 'json'})
- resp = opener.open('https://www.reddit.com/api/login/'+urllib.quote(username), data).read()
- sessions[username] = json.loads(resp)["json"]["data"]["cookie"]
- print "Running Build the Void"
- void_color = 3 # BLACK
- center = [409, 580] # x,y of center of void
- while True:
- # Fill the void
- for session in sessions.keys():
- cookie = sessions[session]
- color = 0
- while color != void_color:
- # Find a non-black square
- xtest = center[0]+random.randint(-50,50)
- ytest = center[1]+random.randint(-50,50)
- resp = opener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
- try:
- color = int(json.loads(resp)["color"])
- except Exception, e:
- #print "Exception"
- #print resp
- color = 0
- print "Found a void color at", xtest, ytest
- data = urllib.urlencode({'x': xtest, 'y': ytest, 'color': random.randint(0,15)})
- newopener = urllib2.build_opener()
- newopener.addheaders = [('User-Agent', random.choice(user_agent_list))]
- newopener.addheaders.append(('Cookie', 'reddit_session='+cookie))
- modhash = json.loads(newopener.open("https://reddit.com/api/me.json").read())["data"]["modhash"]
- newopener.addheaders.append(('x-modhash', modhash))
- next=newopener.open("https://www.reddit.com/api/place/draw.json", data).read()
- print next
- finalresp = newopener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
- if session in finalresp:
- print "Added successfully"
- else:
- print finalresp
- time.sleep(305)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement