在朋友圈看到一个朋友的母亲最近在参选一个活动,需要投票。和这位朋友交情不错,闲来无事帮他写个小程序刷票。就是这个页面http://m.fangxinbao.com/wx/voteDetail-161181.html? (已做处理)点击那个”给TA投一票”就可以投票。经过测验,服务器端是通过ip检测来防止刷票的,那么通过挂代理就可以绕过检测了。查看一下源码<div id=”pollbtn” class=”toupiao-btn flex-box flex-center” οnclick=”toPolls(‘38354’)” style=”background-image: url(‘http://m.fangxinbao.com/img/represent/btn-bg.png’);”> 给TA投一票</div>onlick=”topolls(‘xxxx’)”是重点function toPolls(obj){$.ajax({ type: “POST”, url: “http://m.fangxinbao.com/wx/repersentVote.html”, dataType: “html”, data: “userId=”+obj, success: function (jsonStr) { if(jsonStr==’1′){//已投票 alert(“今天您已经投过票了!”); }else if(jsonStr==’2′){//投票成功 alert(“投票成功!”); window.location.reload(); }else {//异常 alert(“投票失败,有问题请联系微信公众号!”); } } });加载出来js,如何构造包一目了然package crawler;import java.io.BufferedInputStream;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.ByteArrayInputStream;import java.io.DataOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.RandomAccessFile;import java.io.UnsupportedEncodingException;import java.net.HttpURLConnection;import java.net.URL;import java.net.URLEncoder;import java.util.ArrayList;import java.util.List;public class shuapiao {public static void main(String[] args) throws Exception{ URL postUrl = new URL(“http://m.fangxinbao.com/wx/repersentVote.html”); HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod(“POST”); connection.setUseCaches(false); connection.setInstanceFollowRedirects(true); connection.setRequestProperty(“Content-Type”,”application/x-www-form-urlencoded”); try { connection.connect();} catch (Exception e) {// TODO: handle exceptione.printStackTrace();connection.disconnect(); } DataOutputStream out = new DataOutputStream(connection.getOutputStream()); String formdata = “userId=xxxx”; out.writeBytes(formdata); out.flush(); out.close(); String linetoreturn = “”; BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),”utf-8″)); String line; while ((line = reader.readLine()) != null){ System.out.println(line + “”); } reader.close(); connection.disconnect();} catch (Exception e) {// TODO: handle exception e.printStackTrace(); if(reader!=null) reader.close(); connection.disconnect(); System.out.println(“Got an http Error!”); }}}之后只需要不断切换vpn就可以愉快的刷票了–第一次更新–又发现服务器端对ip的检测只是检测http请求头中的ip,这样的话我们只需要伪造http header中的ip就可以了,实现面代理全自动刷票package test;import java.io.IOException;import java.util.Random;import org.apache.commons.httpclient.Header;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpException;import org.apache.commons.httpclient.HttpStatus;import org.apache.commons.httpclient.NameValuePair;import org.apache.commons.httpclient.methods.PostMethod;public class Shuapiaole {public static void main(String[] args) throws InterruptedException {// TODO Auto-generated method stubwhile(true){HttpClient httpClient = new HttpClient();String url = “http://m.fangxinbao.com/wx/repersentVote.html”;PostMethod postMethod = new PostMethod(url);// 填入各个表单域的值NameValuePair[] data = {new NameValuePair(“userId”, “xxxx”),};// 将表单的值放入postMethod中postMethod.setRequestBody(data);// 执行postMethodString s = getRandomIp();postMethod.setRequestHeader(“x-forwarded-for”,s);System.out.println(s);int statusCode = 0;try {statusCode = httpClient.executeMethod(postMethod);System.out.println(postMethod.getRequestBodyAsString());} catch (HttpException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}// HttpClient对于要求接受后继服务的请求,象POST和PUT等不能自动处理转发// 301或者302if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY){// 从头中取出转向的地址Header locationHeader = postMethod.getResponseHeader(“location”);String location = null;if (locationHeader != null) {location = locationHeader.getValue();System.out.println(“The page was redirected to:” + location);}else {System.err.println(“Location field value is null.”);}return;}else{System.out.println(postMethod.getStatusLine());String str = “”;str = postMethod.getResponseBodyAsString(); System.out.println(str);}postMethod.releaseConnection();int waitTime = (int)(Math.random()*4);for(int j = 0; j < waitTime; j++){System.out.print(“. “);Thread.sleep(1000);}System.out.println(“”);}}public static String getRandomIp(){ //ip范围 int[][] range = {{607649792,608174079},//36.56.0.0-36.63.255.255 {1038614528,1039007743},//61.232.0.0-61.237.255.255 {1783627776,1784676351},//106.80.0.0-106.95.255.255 {2035023872,2035154943},//121.76.0.0-121.77.255.255 {2078801920,2079064063},//123.232.0.0-123.235.255.255 {-1950089216,-1948778497},//139.196.0.0-139.215.255.255 {-1425539072,-1425014785},//171.8.0.0-171.15.255.255 {-1236271104,-1235419137},//182.80.0.0-182.92.255.255 {-770113536,-768606209},//210.25.0.0-210.47.255.255 {-569376768,-564133889}, //222.16.0.0-222.95.255.255 }; Random rdint = new Random(); int index = rdint.nextInt(10); String ip = num2ip(range[index][0]+new Random().nextInt(range[index][1]-range[index][0])); return ip; } /* * 将十进制转换成ip地址 */ public static String num2ip(int ip) { int [] b=new int[4] ; String x = “”; b[0] = (int)((ip >> 24) & 0xff); b[1] = (int)((ip >> 16) & 0xff); b[2] = (int)((ip >> 8) & 0xff); b[3] = (int)(ip & 0xff); x=Integer.toString(b[0])+”.”+Integer.toString(b[1])+”.”+Integer.toString(b[2])+”.”+Integer.toString(b[3]); return x; }}
一个投票刷票小程序
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 一个投票刷票小程序
相关推荐
数据恢复软件(二):用C++重写恢复B乐都县E企盈小程序MP位图文件的小程序
公众号再次改版高坪区E企盈小程序小程序又多了一个入口
微信小程序加载图片时,湘桥区E企盈小程序先拉长,再恢复正常
转:(很有用)有多个按钮,点击一个变色,点击另吴中区E企盈小程序一个变色,原来的恢复颜色的方法
第12课微信小程序Component构造器自道里区E企盈小程序定义组件:
导航中的南海区E企盈小程序小竖线总结
小程序:after实现德格县E企盈小程序1px纵向分割线
汉沽区E企盈小程序企业微信内测朋友圈和客户群功能:小程序C位出道!
小程序运行加载密山市E企盈小程序机制
小程通城县E企盈小程序序中间有字的分隔线
公众号和小程序可以同名了名称支持同主体复盘锦E企盈小程序用
微信小程序修改主潜江市E企盈小程序体信息
最新评论
独特万商直播系统,直播系统技术开发公司
万商直播系统开发公司
优秀的团队,万商直播管理系统
不错的小程序案例
优秀的团队,不错的服务!
讲的很好
主播长的帅气
好系统好服务