Advertisement
Guest User

rick's foot

a guest
Apr 2nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import time
  4. import json
  5. import random
  6. import math
  7.  
  8. # COORDINATES TO ATTACK
  9. center = [175,720]
  10. radius = 20
  11.  
  12. # COLOR TO PLACE - 3 IS BLACK MOTHERFUCKERS
  13. void_color = 3
  14.  
  15. # ------------------------------------------------------------------------
  16.  
  17. print "Build the Void"
  18.  
  19. print "For each account you want to use, enter it in like username:password"
  20. print "When you're done, type 'done'"
  21.  
  22. accounts = []
  23. while True:
  24. user_input = raw_input("Account-> ")
  25. if user_input.lower() != 'done' and user_input!= '':
  26. accounts.append(user_input)
  27. else:
  28. break
  29.  
  30. # ------------------------------------------------------------------------
  31.  
  32. def main( accounts ):
  33.  
  34. print "Getting user agent list for anonymity (please wait)"
  35. 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("#")]))
  36.  
  37. sessions = {}
  38.  
  39. opener = urllib2.build_opener()
  40. opener.addheaders = [('User-Agent', random.choice(user_agent_list))]
  41. for account in accounts:
  42. username = account.split(":")[0]
  43. password = ':'.join(account.split(":")[1:])
  44. data = urllib.urlencode({'op': 'login-main', 'user': username, 'passwd': password, 'api_type': 'json'})
  45. rawresp = opener.open('https://www.reddit.com/api/login/'+urllib.quote(username), data).read()
  46. response = json.loads(rawresp)
  47. if not response['json'].get('errors'):
  48. sessions[username] = response['json']['data']['cookie']
  49. else:
  50. print 'Error: connection problem for account: '+username
  51. print response
  52. continue
  53.  
  54. print "Running Build the Void"
  55.  
  56. while True:
  57. # Fill the void
  58. for session in sessions.keys():
  59. cookie = sessions[session]
  60. color = 3
  61. while color == void_color:
  62. # Find a non-black square
  63. xtest = center[0]+random.randint(-radius,radius)
  64. ytest = center[1]+random.randint(-radius,radius)
  65. if math.sqrt((center[0] - xtest)**2 + (center[1] - ytest)**2) > radius:
  66. continue
  67. else:
  68. resp = opener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  69. try:
  70. color = int(json.loads(resp)["color"])
  71. except Exception, e:
  72. color = 3
  73. print "Found a non-void color at", xtest, ytest
  74. data = urllib.urlencode({'x': xtest, 'y': ytest, 'color': void_color})
  75. newopener = urllib2.build_opener()
  76. newopener.addheaders = [('User-Agent', random.choice(user_agent_list))]
  77. newopener.addheaders.append(('Cookie', 'reddit_session='+cookie))
  78. modhash = json.loads(newopener.open("https://reddit.com/api/me.json").read())["data"]["modhash"]
  79. newopener.addheaders.append(('x-modhash', modhash))
  80. next=newopener.open("https://www.reddit.com/api/place/draw.json", data).read()
  81. print next
  82. finalresp = newopener.open("https://www.reddit.com/api/place/pixel.json?x="+str(xtest)+"&y="+str(ytest)).read()
  83. if session in finalresp:
  84. print "Added successfully"
  85. else:
  86. print finalresp
  87. time.sleep(305)
  88.  
  89.  
  90. # ------------------------------------------------------------------------
  91.  
  92. # If any problem occurs, keep retrying forever. All hail the void.
  93. while True:
  94. try:
  95. main( accounts )
  96. except Exception as e:
  97. print 'Error: ' + str(e) + '\n'
  98. print 'A 429 Error means the account may be under cooldown'
  99. print 'Retrying ... in 30s'
  100. time.sleep(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement