Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- 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 = {}
- user_input = "finekonsul:dream0r"
- 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"
- user_input_x = raw_input("Startpos X: ")
- user_input_y = raw_input("Startpos Y: ")
- void_color = 3 # BLACK
- current = [337, 970] # x,y of center of void
- if user_input_x != "" and user_input_y != "":
- current = [int(user_input_x),int(user_input_y)]
- while True:
- # Fill the void
- for session in sessions.keys():
- cookie = sessions[session]
- color = 3
- counter = 0
- xtest = 0
- ytest = 0
- while color == void_color:
- # Find a non-black square
- if counter == 9:
- counter = 0
- current[0] += random.randint(0,2)
- current[1] += random.randint(0,2)
- time.sleep(0.2)
- if counter == 0:
- xtest = current[0]
- ytest = current[1]
- if counter == 1:
- xtest = current[0]+1
- ytest = current[1]-1
- if counter == 2:
- xtest = current[0]+1
- ytest = current[1]
- if counter == 3:
- xtest = current[0]+1
- ytest = current[1]+1
- if counter == 4:
- xtest = current[0]-1
- ytest = current[1]-1
- if counter == 5:
- xtest = current[0]-1
- ytest = current[1]
- if counter == 6:
- xtest = current[0]-1
- ytest = current[1]+1
- if counter == 7:
- xtest = current[0]
- ytest = current[1]+1
- if counter == 8:
- xtest = current[0]
- ytest = current[1]-1
- counter += 1
- 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:
- color = void_color
- print time.asctime( time.localtime(time.time()) )," Found a non-void color at", xtest, ytest
- data = urllib.urlencode({'x': xtest, 'y': ytest, 'color': void_color})
- 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
- time.sleep(random.randint(310,320))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement