Triggakb24
Newbie
- Mar 19, 2017
- 15
- 1
Code:
import requests
import random
import string
import threadpool
import thread
def gen(size=10, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
class Disqus:
def __init__(self):
print "Disqus Class Initialized"
self.signup = "https://disqus.com/profile/signup/"
self.http = requests.Session()
def createAccount(self,email,username,password):
pdata = {
"email" : email,
"username" : username,
"password" : password
}
signup_headers = {
"referer" : "https://disqus.com/profile/signup/",
"content-type" : "application/x-www-form-urlencoded",
":host" : "disqus.com",
":method" : "POST",
":path" : "/profile/signup/",
":scheme" : "https",
":version" : "HTTP/1.1"
}
r = self.http.post(self.signup, data = pdata, headers = signup_headers)
if r.status_code == 302:
print "Good signup"
else:
print "Bad signup"
#look for this in r.headers
#x-user:loginas:None:108281152
def upvote(self,postid):
pdata = {
"post" : postid,
"vote" : "1",
"api_key" : "E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F"
}
r = self.http.post("http://disqus.com/api/3.0/posts/vote.json",data = pdata)
print r.content
def rape(stack):
dis,u,target = stack
dis.createAccount(u+"@mailinator.com",u,u)
print u
print "Upvoting..."
dis.upvote(target)
if __name__ == "__main__":
target = "1399861984"
pool = threadpool.ThreadPool(100)
queue_arguments = []
for i in range(0,10):
dis = Disqus()
u = gen(10)
queue_arguments.append([dis,u,target])
request = threadpool.makeRequests(rape, queue_arguments)
for req in request:
pool.putRequest(req)
pool.wait()
Im looking for someone to verify that the code that i have works. Its for a disqus upvote bot that upvotes accounts using newly created accounts since disuqs does not allow gues upvoting. The API key may need to be updated because they may have updated their code base. The key can be found on their API website