刷票系统(微信人工投票10元1000票)
刷票系统(微信人工投票10元1000票)
一、前言
相信大家平时肯定会收到朋友发来的链接,打开一看,哦,需要投票。投完票后弹出一个页面(恭喜您,您已经投票成功),再次点击的时候发现,啊哈,您的IP(***.***.***.***)已经投过票了,不能重复投票。这时候,我们可能会想,能不能突破ip地址的限制进行刷票呢?有了这样的想法,那就去做吧,下面我将介绍我这个简单的刷票系统,仅供有需求的园友们参考。
二、系统设计
系统主要实现的是突破IP限制进行刷票,其中,由IP采集模块负责从互联网上爬取代理IP,放入阻塞队列,该任务会定期执行。之后由投票模块从阻塞队列中获取IP,并进行设置,然后进行投票。系统流程图如下:
三、系统技术
系统使用HttpClient + JSoup + 多线程来完成刷票,HttpClient用于进行投票,JSoup用于解析页面,多线程技术用于分离任务,使得分工更加明确。使用到了生产者消费者模式,该模式直接使用BlockingQueue来实现。
四、系统介绍
系统主要分为三个模块:
① IP采集模块
② 投票模块
③ IP信息模块
其中,IP采集模块主要是从互联网爬取IP代理信息,并将该信息放入阻塞队列,这样就可以伪造IP,进行多次投票。
其中,投票模块从IP采集模块放入阻塞队列取出IP信息,并设置代理,找到投票入口地址,然后进行投票操作。
其中,IP信息模块主要是对爬取的IP信息进行了封装,方便其他模块进行操作。
4.1 IP采集模块
IP采集模块流程图如下
几点说明:
1.系统使用的代理IP站点URL为http://www.kuaidaili.com/,www.xicidaili.com。
2.提取IP信息为提取单条IP信息,并判断历史IP表是否已经存在,若存在,表示之前已经加入过此IP信息,则直接丢弃,反之,则加入队列并加入历史IP表。
3.此任务会定期开启,如一个小时爬取一次代理IP。
4.2 投票模块
投票模块流程图如下
几点说明:
1.投票网站
http://www.hnxdf.com/vote/,我们选取的第一位进行投票,分析出投票的入口为http://www.hnxdf.com/vote/iRadio_vote.asp?VoTeid=215。
2.根据IP采集模块放入队列的IP信息进行设置,然后进行投票。
4.3 IP信息模块
此模块主要对从网站爬取的IP信息进行了封装,方便其他模块进行操作。
五、系统代码框架
系统的整个代码框架如下
其中,bean包的IpInfo封装了爬取的IP信息。
其中,entrance包的Vote为系统的入口。
其中,thread包的IPCollectTask为爬取代理IP任务,VoteThread为进行投票线程。
六、系统代码
1.IpInfo.javapackagecom.hust.grid.leesf.bean; publicclassIpInfo{ publicIpInfo(StringipAddress,intport,Stringlocation, StringanonymousType,Stringtype,StringconfirmTime){ this(ipAddress,port,location,anonymousType,type,confirmTime,null, null); } publicIpInfo(StringipAddress,intport,Stringlocation, StringanonymousType,Stringtype,StringconfirmTime, StringgetPostSupport,StringresponseSpeed){ this.ipAddress=ipAddress; this.port=port; this.location=location; this.anonymousType=anonymousType; this.type=type; this.confirmTime=confirmTime; this.getPostSupport=getPostSupport; this.responseSpeed=responseSpeed; } publicStringgetIpAddress(){ returnipAddress; } publicvoidsetIpAddress(StringipAddress){ this.ipAddress=ipAddress; } publicintgetPort(){ returnport; } publicvoidsetPort(intport){ this.port=port; } publicStringgetLocation(){ returnlocation; } publicvoidsetLocation(Stringlocation){ this.location=location; } publicStringgetAnonymousType(){ returnanonymousType; } publicvoidsetAnonymousType(StringanonymousType){ this.anonymousType=anonymousType; } publicStringgetType(){ returntype; } publicvoidsetType(Stringtype){ this.type=type; } publicStringgetConfirmTime(){ returnconfirmTime; } publicvoidsetConfirmTime(StringconfirmTime){ this.confirmTime=confirmTime; } publicStringgetGetPostSupport(){ returngetPostSupport; } publicvoidsetGetPostSupport(StringgetPostSupport){ this.getPostSupport=getPostSupport; } publicStringgetResponseSpeed(){ returnresponseSpeed; } publicvoidsetResponseSpeed(StringresponseSpeed){ this.responseSpeed=responseSpeed; } @Override publicbooleanequals(Objectanthor){ if(this==anthor){ returntrue; } if(anthor==null||getClass()!=anthor.getClass()){ returnfalse; } IpInfoipInfo=(IpInfo)anthor; return(this.ipAddress.equals(ipInfo.ipAddress) &&this.port==ipInfo.port &&this.location.equals(ipInfo.location) &&this.anonymousType.equals(ipInfo.anonymousType) &&this.type.equals(ipInfo.type)&&this.confirmTime .equals(ipInfo.confirmTime)) &&this.getPostSupport.equals(ipInfo.getPostSupport) &&this.responseSpeed.equals(ipInfo.responseSpeed); } @Override publicinthashCode(){ inthash=5; hash=89*hash +(this.ipAddress!=null?this.ipAddress.hashCode():0); hash=89*hash+this.port; hash=89*hash +(this.location!=null?this.location.hashCode():0); hash=89 *hash +(this.anonymousType!=null?this.anonymousType.hashCode() :0); hash=89*hash+(this.type!=null?this.type.hashCode():0); hash=89*hash +(this.confirmTime!=null?this.confirmTime.hashCode():0); hash=89 *hash +(this.getPostSupport!=null?this.getPostSupport.hashCode() :0); hash=89 *hash +(this.responseSpeed!=null?this.responseSpeed.hashCode() :0); returnhash; } @Override publicStringtoString(){ return"ipAddress="+ipAddress+",port="+port+",localtion=" +location+",anonymousType="+anonymousType+",type=" +type+",confirmTime="+confirmTime+",getPostSupport=" +getPostSupport+",responseSpeed="+responseSpeed; } privateStringipAddress; privateintport; privateStringlocation; privateStringanonymousType; privateStringtype; privateStringconfirmTime; privateStringgetPostSupport; privateStringresponseSpeed; }
2.Vote.javapackagecom.hust.grid.leesf.entrance; importjava.util.Timer; importjava.util.concurrent.BlockingQueue; importjava.util.concurrent.LinkedBlockingQueue; importcom.hust.grid.leesf.bean.IpInfo; importcom.hust.grid.leesf.thread.IPCollectTask; importcom.hust.grid.leesf.thread.VoteThread; publicclassVote{ privateBlockingQueue<IpInfo>ipInfoQueue; privateIPCollectTaskipCollectTask; privateVoteThreadvoteThread; publicVote(){ ipInfoQueue=newLinkedBlockingQueue<IpInfo>(); ipCollectTask=newIPCollectTask(ipInfoQueue); voteThread=newVoteThread(ipInfoQueue); } publicvoidvote(){ Timertimer=newTimer(); longdelay=0; longperiod=1000*60*60; //每一个小时采集一次ip timer.scheduleAtFixedRate(ipCollectTask,delay,period); //开启投票任务 voteThread.start(); } publicstaticvoidmain(String[]args){ Votevote=newVote(); vote.vote(); } }
3.IPCollectTask.javapackagecom.hust.grid.leesf.thread; importjava.io.IOException; importjava.util.ArrayList; importjava.util.List; importjava.util.TimerTask; importjava.util.concurrent.BlockingQueue; importjava.util.concurrent.LinkedBlockingQueue; importorg.jsoup.Jsoup; importorg.jsoup.nodes.Document; importorg.jsoup.nodes.Element; importorg.jsoup.select.Elements; importcom.hust.grid.leesf.bean.IpInfo; publicclassIPCollectTaskextendsTimerTask{ privateBlockingQueue<IpInfo>ipInfoQueue;//连接生产者与消费者的阻塞队列 privateList<IpInfo>historyIpLists;//记录已经获取的ip信息 publicIPCollectTask(BlockingQueue<IpInfo>ipInfoQueue){ this.ipInfoQueue=ipInfoQueue; this.historyIpLists=newArrayList<IpInfo>(); } /** *获取www.xicidaili.com的ip地址信息 */ publicvoidgetXiCiDaiLiIpLists(){ Stringurl="http://www.xicidaili.com/"; Stringhost="www.xicidaili.com"; Documentdoc=getDocumentByUrl(url,host); //解析页面的ip信息 parseXiCiDaiLiIpLists(doc); } /** *解析页面的ip信息 * *@paramdoc */ publicvoidparseXiCiDaiLiIpLists(Documentdoc){ ElementseleLists=doc.getElementsByTag("tbody"); Elementtbody=eleLists.get(0);//获取tbody ElementstrLists=tbody.children(); Elementele=null; for(inti=0;i<trLists.size();i++){ if((i%22==0)||(i%22==1)){//去掉不符合条件的项 continue; } ele=trLists.get(i); ElementschildrenList=ele.children(); StringipAddress=childrenList.get(1).text(); intport=Integer.parseInt(childrenList.get(2).text()); Stringlocation=childrenList.get(3).text(); StringanonymousType=childrenList.get(4).text(); Stringtype=childrenList.get(5).text(); StringconfirmTime=childrenList.get(6).text(); IpInfoipInfo=newIpInfo(ipAddress,port,location, anonymousType,type,confirmTime); putIpInfo(ipInfo); } } /** *将ip信息放入队列和历史记录中 * *@paramipInfo */ privatevoidputIpInfo(IpInfoipInfo){ if(!historyIpLists.contains(ipInfo)){//若历史记录中不包含ip信息,则加入队列中 //加入到阻塞队列中,用作生产者 try{ ipInfoQueue.put(ipInfo); }catch(InterruptedExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } //加入历史记录中 historyIpLists.add(ipInfo); } } /** *根据网页Document解析出ip地址信息 * *@paramdoc */ privatevoidparseKuaiDaiLiIpLists(Documentdoc){ ElementseleLists=doc.getElementsByTag("tbody"); Elementtbody=eleLists.get(0);//获取tbody ElementstrLists=tbody.children();//获取十条ip记录 for(Elementtr:trLists){//遍历tr ElementstdElements=tr.children();//tr中的td包含了具体的信息 StringipAddress=tdElements.get(0).text(); intport=Integer.parseInt(tdElements.get(1).text()); StringanonymousType=tdElements.get(2).text(); Stringtype=tdElements.get(3).text(); StringgetPostSupport=tdElements.get(4).text(); Stringlocation=tdElements.get(5).text(); StringresponseSpeed=tdElements.get(6).text(); StringconfirmTime=tdElements.get(7).text(); IpInfoipInfo=newIpInfo(ipAddress,port,location, anonymousType,type,confirmTime,getPostSupport, responseSpeed); putIpInfo(ipInfo); } } /** *根据提供的url和host来获取页面信息 * *@paramurl *@paramhost *@return */ privateDocumentgetDocumentByUrl(Stringurl,Stringhost){ Documentdoc=null; try{ doc=Jsoup .connect(url) .header("User-Agent", "Mozilla/5.0(WindowsNT6.1;WOW64;rv:43.0)Gecko/20100101Firefox/43.0") .header("Host",host).timeout(5000).get(); }catch(IOExceptione){ e.printStackTrace(); } returndoc; } /** *获取http://www.kuaidaili.com/free/的ip */ privatevoidgetKuaiDaiLiFreeIpLists(){ //第一次访问,需解析总共多少页 StringbaseUrl="http://www.kuaidaili.com/free/inha/"; Stringhost="www.kuaidaili.com"; Documentdoc=getDocumentByUrl(baseUrl,host); //解析ip信息 parseKuaiDaiLiIpLists(doc); ElementlistNav=doc.getElementById("listnav"); //获取listnav下的li列表 ElementsliLists=listNav.children().get(0).children(); //获取含有多少页的子元素 ElementpageNumberEle=liLists.get(liLists.size()-2); //解析有多少页 intpageNumber=Integer.parseInt(pageNumberEle.text()); //拼接成其他页的访问地址 for(intindex=1;index<=pageNumber;index++){ baseUrl=baseUrl+index; doc=getDocumentByUrl(baseUrl,host); parseKuaiDaiLiIpLists(doc); //休眠一秒 fallSleep(1); } } /** *获取www.kuaidaili.com/proxylist/的ip */ privatevoidgetKuaiDaiLiIpLists(){ intstart=1; StringbaseUrl="http://www.kuaidaili.com/proxylist/"; Stringhost="www.kuaidaili.com"; while(start<=10){//爬取10页 Stringurl=baseUrl+start+"/"; Documentdoc=getDocumentByUrl(url,host); //解析ip信息 parseKuaiDaiLiIpLists(doc); start++; //休眠一秒 fallSleep(1); } } /** *进行休眠 */ privatevoidfallSleep(longseconds){ try{ Thread.sleep(seconds*1000); }catch(InterruptedExceptione){ e.printStackTrace(); } } @Override publicvoidrun(){ //getKuaiDaiLiFreeIpLists(); System.out.println("IPCollecttaskisrunning"); getKuaiDaiLiIpLists(); getXiCiDaiLiIpLists(); } publicBlockingQueue<IpInfo>getIpInfoQueue(){ returnipInfoQueue; } publicstaticvoidmain(String[]args){ BlockingQueue<IpInfo>queue=newLinkedBlockingQueue<IpInfo>(); IPCollectTasktask=newIPCollectTask(queue); Threadthread=newThread(task); thread.start(); try{ Thread.sleep(30*1000); }catch(InterruptedExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } System.out.println("queuesizeis"+queue.size()); try{ while(!queue.isEmpty()){ System.out.println(queue.take()); } }catch(InterruptedExceptione){ e.printStackTrace(); } System.out.println("historyListsizeis"+task.historyIpLists.size()); } }
4.VoteThread.javapackagecom.hust.grid.leesf.thread; importjava.io.IOException; importjava.util.concurrent.BlockingQueue; importorg.apache.http.HttpEntity; importorg.apache.http.HttpHost; importorg.apache.http.HttpResponse; importorg.apache.http.client.ClientProtocolException; importorg.apache.http.client.HttpClient; importorg.apache.http.client.methods.HttpGet; importorg.apache.http.conn.params.ConnRoutePNames; importorg.apache.http.impl.client.DefaultHttpClient; importorg.apache.http.params.HttpConnectionParams; importorg.apache.http.params.HttpParams; importorg.apache.http.util.EntityUtils; importcom.hust.grid.leesf.bean.IpInfo; publicclassVoteThreadextendsThread{ privateBlockingQueue<IpInfo>ipInfoQueue; publicVoteThread(BlockingQueue<IpInfo>ipInfoQueue){ this.ipInfoQueue=ipInfoQueue; } @Override publicvoidrun(){ HttpClientclient=newDefaultHttpClient(); HttpParamsparams=client.getParams(); HttpConnectionParams.setConnectionTimeout(params,10000); HttpConnectionParams.setSoTimeout(params,15000); HttpResponseresponse=null; HttpGetget=null; HttpEntityentity=null; HttpHostproxy=null; while(true){ IpInfoipInfo=null; try{ ipInfo=ipInfoQueue.take(); }catch(InterruptedExceptione1){ //TODOAuto-generatedcatchblock e1.printStackTrace(); } proxy=newHttpHost(ipInfo.getIpAddress(),ipInfo.getPort()); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); get=newHttpGet( "http://www.hnxdf.com/vote/iRadio_vote.asp?VoTeid=215"); get.addHeader("Host","www.hnxdf.com"); get.addHeader("User-Agent", "Mozilla/5.0(WindowsNT6.1;WOW64;rv:43.0)Gecko/20100101Firefox/43.0"); try{ response=client.execute(get); entity=response.getEntity(); byte[]bytes=EntityUtils.toByteArray(entity); //对响应内容编码格式进行转化,统一成utf-8格式 Stringtemp=newString(bytes,"gbk"); byte[]contentData=temp.getBytes("utf-8"); System.out.println(newString(contentData)); System.out.println("-----------------------------------"); }catch(ClientProtocolExceptione){ e.printStackTrace(); }catch(IOExceptione){ e.printStackTrace(); } } } }
七、系统总结
此系统很简单,想清楚思路之后很快就能够写出代码,系统运行时,由于代理IP站点提供的免费IP质量不是太高,有效的IP地址还是很少,所有效果不是特别理想,此系统功能也很简单,但是各位园友可以在此基础上去发挥自己的想象力,定制属于自己的投票系统。
七夕最初的乞巧是什么意思今天蚂蚁庄园近日七夕最初的乞巧是什么意思登录了热搜,也是在网上引起了网友们的关注,那么很多小伙伴可能还不清楚具体的情况如何,小编也是在网上查阅了一些信息,那么接下来就分享给大家来了解下七夕最初
文曲星下凡(什么孩子命里有文曲星)文曲星下凡(什么孩子命里有文曲星)农历二月初三,通常被认为是主管学业事业的文昌帝君生日。在民间来说,文昌帝君通常被称为文昌星,或者混称为文曲星。历史上那些文采盖世而被朝廷重用成为国
有哪些仙女(仙女的名字有哪些)吉生起名小程序,免费起名宝宝科学取名起名改名专业人工服务平台!(此处已添加小程序,请到今日头条客户端查看)人的名字就像人的影子,伴随你一生。古人云,名正则言顺,言顺则事成,俗话说人
你呀你在哪里(你呀你呀歌词)爱的你呀何处寻。mp3247来自音乐博览audio我爱的你呀我爱的你你在哪里呀在哪里我爱的你呀我爱的你你在哪里呀在哪里往日的甜蜜化为一丝丝滴滴重复在睡梦里我爱的你呀我爱的你你在哪里
张玉环回应申请国家赔偿金一千万也换不回我27年青春年华最近张玉环案受到了社会各界的广泛关注,现在张玉环已经回到了老家,正在开展新的生活,大家都非常关注张玉环的情况,同时对张玉环将获得的国家赔偿也是议论纷纷,有人说张玉环可以获得三百多万
张玉环一千万也换不回我27年青春年华张玉环无罪释放之后网友讨论最多的就是张玉环的赔偿金,9日张玉环回应申请国家赔偿,直言一千万也换不回我27年青春年华。的确,近27年的牢狱时光足以改变一个人的一生,在牢狱里与世隔绝的
中国人民解放军军衔制(军衔军职对应表)中国人民解放军军衔制(军衔军职对应表)目前,我国法定的衔级制度共有6种,分别是解放军的军衔武警部队的警衔人民警察的警衔海关关员的关衔消防救援队伍的消防救援衔外交人员的外交衔。下面,
二本警校有哪些(报考公安大学眼睛近视怎么办)根据国家卫健委发布的中国眼健康白皮书2018年,全国高中生的近视高达81。0。有多少学子,埋头苦读,熬过了高考,却栽在视力上,不得不放弃心心念念的专业。所以他们都会好奇做完近视手术
可以拿身份证查酒店记录吗(拿身份证去公安局可以查酒店记录吗)怎么通过身份证查看宾馆入住记录?去公安局查询。利用身份证住宾馆,这些信息都会录入公安局的专门系统内,可以从那里查出。不过,个人是没有权利查询的。望采纳。身份证宾馆登记记录可以在网上
ka什么意思(什么叫KA)一煤安矿安认证制度简介煤安和矿安认证,简称MAKA认证,即是我国特有的对应用于煤矿井下和非煤矿场所的设备和产品必须取得的安全标志认证制度。对井工煤矿用设备仪器仪表等设施实行安全生产
参公和公务员的区别(公务员和参公管理到底有什么区别?)参公和公务员的区别(公务员和参公管理到底有什么区别?)公务员和参公虽然都出现在公务员考试中,但两者却有明显的区别。公务员是行政机关工作人员,而参公的本质是事业单位人员,只是按公务员
平安为什么不停的招聘(平安降额)今天有老铁反馈自己的平安信用卡降额了,从5。9万直接降到3000元。那么今天利用这个机会给大家分享一下平安信用卡降额的原因,大家一定要注意避免!第一消费单一降额平安的5倍积分又延续
平安惠普怎么样(平安普惠适合长期发展吗)平安普惠作为普惠金融市场重要的创新驱动者和领导者,始终不忘初心,回归普惠金融本源,为小微人群三农人群社会中的广大弱势金融消费者提供优质金融产品,打造有温度的金融服务品牌,帮助国人实
宜信普惠怎么样(宜信普惠车抵贷靠谱吗)近日,有网友在中国网投诉平台(tousu。china。com。cn)发布了关于宜信普惠的投诉,内容如下本人于2018年11月2号申请一笔贷款,实际到账金额却是35000元,合同写的
宜信怎么样(2021年宜信贷款逾期还不上怎么办)我的文章题目也许会触及到他人的利益,但是我用自己亲身经历告诉大家宜信这个借贷平台实在是太黑。为不要让其他网友在为钱着急乱去借钱而带来日后的痛苦我把自己亲身经历告诉大家。如有半点假话
宜信贷款怎么样(宜信来的起诉短信是真的吗)近日,有网友在中国网投诉平台(tousu。china。com。cn)发布了关于宜信普惠的投诉,内容如下本人于2018年11月2号申请一笔贷款,实际到账金额却是35000元,合同写的
宜信惠普贷款怎么样(2021年宜信普惠贷款利息)网贷业务剥离后,宜人金科向个人财务管理转型,从网贷到财富管理,必然会面临模式上的差异与困难。如今,信贷业务依然是宜人金科业绩支柱,但与同业相比,它已被甩在身后。撰文冬弥出品消费金融
酒吧打出优衣库女主角驻唱广告这是怎么回事近日酒吧打出优衣库女主角驻唱广告登录了热搜,也是在网上引起了网友们的关注,那么很多小伙伴可能还不清楚具体的情况如何,小编也是在网上查阅了一些信息,那么接下来就分享给大家来了解下酒吧
酒吧打出优衣库女主角驻唱广告不以为耻反以为荣近日酒吧打出优衣库女主角驻唱广告登录了热搜,也是在网上引起了网友们的关注,那么很多小伙伴可能还不清楚具体的情况如何,小编也是在网上查阅了一些信息,那么接下来就分享给大家来了解下酒吧
酒吧打出优衣库女主角驻唱广告五年前的优衣库三里屯视频事件相信很多网友们都记忆尤深,更是让优衣库被更多的人群所了解,此次事件也一度被大家怀疑是优衣库自导自演。而最近广东东莞某酒吧打出优衣库女主角驻唱广告牌,用词
优衣库女主角事件是怎么回事近日优衣库女主角事件是怎么回事登录了热搜,也是在网上引起了网友们的关注,那么很多小伙伴可能还不清楚具体的情况如何,小编也是在网上查阅了一些信息,那么接下来就分享给大家来了解下优衣库
优衣库不雅视频女主复出系炒作相信提起优衣库,很多人脑海里依旧会浮现出优衣库事件流传的视频,同时也有很多人认为优衣库的成功在于那次事件。近日有网传优衣库不雅视频女主将复出进行演出,这个消息一时间引发了很多人的关