Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- import urllib2
- import time
- import json
- import random
- import math
- # COORDINATES TO ATTACK
- center = [175,720]
- radius = 20
- # COLOR TO PLACE - 3 IS BLACK MOTHERFUCKERS
- void_color = 3
- # ------------------------------------------------------------------------
- print "Build the Void"
- print "For each account you want to use, enter it in like username:password"
- print "When you're done, type 'done'"
- accounts = []
- while True:
- user_input = raw_input("Account-> ")
- if user_input.lower() != 'done' and user_input!= '':
- accounts.append(user_input)
- else:
- break
- # ------------------------------------------------------------------------
- def main( accounts ):
- 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("#")]))
- sessions = {}
- opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent', random.choice(user_agent_list))]
- for account in accounts:
- username = account.split(":")[0]
- password = ':'.join(account.split(":")[1:])
- data = urllib.urlencode({'op': 'login-main', 'user': username, 'passwd': password, 'api_type': 'json'})
- rawresp = opener.open('https://www.reddit.com/api/login/'+urllib.quote(username), data).read()
- response = json.loads(rawresp)
- if not response['json'].get('errors'):
- sessions[username] = response['json']['data']['cookie']
- else:
- print 'Error: connection problem for account: '+username
- print response
- continue
- print "Running Build the Void"
- while True:
- # Fill the void
- for session in sessions.keys():
- cookie = sessions[session]
- color = 3
- while color == void_color:
- # Find a non-black square
- xtest = center[0]+random.randint(-radius,radius)
- ytest = center[1]+random.randint(-radius,radius)
- if math.sqrt((center[0] - xtest)**2 + (center[1] - ytest)**2) > radius:
- continue
- else:
- 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 = 3
- print "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
- 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)
- # ------------------------------------------------------------------------
- # If any problem occurs, keep retrying forever. All hail the void.
- while True:
- try:
- main( accounts )
- except Exception as e:
- print 'Error: ' + str(e) + '\n'
- print 'A 429 Error means the account may be under cooldown'
- print 'Retrying ... in 30s'
- time.sleep(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement