Python微信刷投票源码!用PY实现自动化刷投票

这几天朋友参加比赛需要,就写了个Python微信刷票脚本帮忙.投票
我们首先用Python实现网站投票。来到要投票的网站上来看看。
随便找一个投上一票
Python微信刷票
居然不用登陆,当然是每个IP只能投一票。
打开Chrome dev tools, 看一下
Get请求。
那直接把Request URL复制下来,这个就是用于刷票的URL
按理来说只要把这个URL 发给任何一个人诱惑他点开,就是帮你投票了。
Python微信刷票
Json “Total” 名称 就是当前的票数。“result”为true 显然告诉我们投票成功了。
那的确是这样的。
然后想要微信刷票呢,我们需要找一些开放HTTP代理的IP。我找了半天然后推荐这个网站 可以直接抓取IP到这种格式。
Python微信刷票
然后接下来就是写脚本了。
由于我没有长期接触过Python 网络方面的编程。以前也只是看着用Requests库爬了一些小网站的数据。
#coding=utf-8
import urllib2
import urllib
import re
import threading
import sys
from time import ctime
import time
rlock = threading.RLock()
def vote(proxyIP,i,urls):
try:
#print "voting...%d..." % i
#使用代理IP
proxy_support = urllib2.ProxyHandler(proxyIP)
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
#定义Opener
urllib2.install_opener(opener)
#把opener绑定到全局
sendt = '投票'.decode('utf-8').encode('gb2312')
#设置刷票地址
#post数据bn
values = {}
req = urllib2.urlopen(urls)
#直接打开这个URL
html = req.read()
#读取返回数据
if html.find('true'.decode('utf-8').encode('gb2312')):
print "投票 [%d] 成功" % i
return 1
else:
print "投票 [%d] 失败" % i
return 0;
except Exception:
return False
if __name__ == "__main__":
args = sys.argv
if(len(args) == 3):
ipFile = open(args[1]);
ipList = ipFile.readlines()
ipFile.close()
length = range(len(ipList))
threads = []
for i in length:
ipLine = ipList[i]
ip=ipLine.strip()
proxy_ip = {'http': ip}
t = threading.Thread(target=vote,args=(proxy_ip,i,args[2]))
print "get ",args[2],ip
threads.append(t)
for i in length:
threads[i].start();
if i%100:
time.sleep(5)
#每100个线程等待 5秒
for i in length:
threads[i].join()
else:
print """刷票工具
python brush.py IP文件 Get地址:
"""
刷微信刷票

相关文章
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~