开心网刷分程序详解以及web游戏破解思路分析(一)

来源:互联网 发布:虎牙手机直播软件 编辑:程序博客网 时间:2024/05/17 03:01

************本人水平有限,在学习时请用批判的态度学习,有问题给我留言************

开心网刷分程序详解以及web游戏破解思路分析(一)


1、 开心网是现在web网站最前卫的网站,网站形式新颖,用户体验好,定位准确。开心网俨然有了网络下一代门户的潜质。开心网上最吸引人的就是它web小游戏,无论是停车、买人,还是农场都能使朋友之间充分互动。

现在来分析一下web游戏的刷分程序。

Web游戏就是通过http协议发送游戏的每一次操作请求的游戏,优点在于简单快捷,缺点在于太简单,别的程序可以很轻易的模拟。

 

第一次有刷分想法是08年底,当时看了某位前辈做web游戏外挂的文章,他用的是c,咱的方向是java,但是没关系,只要有了思路就没问题了。

本人使用的工具:IDE  eclipse + Myeclipse 5.0

                          浏览器是firefox  +   IE

                             http请求截取软件:Tamper Date(firefox的插件) httpWatchfiddler2

思路:截取每一次游戏post请求,用java模拟发送请求。

 

开心网是08年初新浪跳槽员工创立的网站,域名:http://www.kaixin001.com

网站的基准色是红色,文章中简称:红开

另外一个开心网是后来千橡国际模仿前一个网站的创意开发的网站,

域名:http://www.kaixin.com  网站基准色是黄色,文章中简称:黄开

 

本篇讨论的是黄开上的游戏,红开的游戏较为简单,明白原理后请大家自己开发相应外挂。

 

黄开的flash游戏是文章讨论重点,flash游戏是通过flash发送http请求的,在最初他们也是采用了一定的策略防止程序提交的,在程序开始发送一次post请求确定开始时间,然后游戏结束时发送一次请求记录游戏成绩,最初我以为只要模拟发送成绩的请求就万事大吉了,但是通过实验证明行不通,最后几近抓狂也没有成功。

事隔一段时间,再来分析的时候突然发现,发送成绩的请求中的开始时间的参数和第一次请求的时间相吻合,马上动手模拟,先发一次请求,记录时间,然后再发送一次请求,用第一次发送的时间为参数,结果成功!!!

 

2、现在公布程序源代码:

****************程序中账号、密码、游戏名称等参数请做相应的更改***************

 package httpClint;

import java.io.IOException;
import java.util.Date;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;

public class TestHttpClinet {

    /**
     * http请求提交类
     * @author caohua
     */
   
    static final String LOGON_SITE = "login.kaixin.com";

    static final int LOGON_PORT = 80;
   
    public static void main(String[] args) {
       
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT);
        PostMethod post = new PostMethod("/Login.do");
        NameValuePair name = new NameValuePair("email", "caohua_1012@163.com");   
        NameValuePair pass = new NameValuePair("password", "111111");
        post.setRequestBody(new NameValuePair[]{name,pass});
        
        try{
            client.executeMethod(post);
            post.releaseConnection();
           
            //检查是否重定向
            int statuscode = post.getStatusCode();
            if ((statuscode == HttpStatus.SC_MOVED_TEMPORARILY) ||
                (statuscode == HttpStatus.SC_MOVED_PERMANENTLY) ||
                (statuscode == HttpStatus.SC_SEE_OTHER) ||
                (statuscode == HttpStatus.SC_TEMPORARY_REDIRECT)) {
                //读取新的URL地址
                Header header = post.getResponseHeader("location");
                if (header != null) {
                    String newuri = header.getValue();
                    if ((newuri == null) || (newuri.equals("")))
                        newuri = "/";
                    GetMethod redirect = new GetMethod(newuri);
                    client.executeMethod(redirect);
                    redirect.releaseConnection();
                } else
                    System.out.println("");
            }
          
           PostMethod post2 = new PostMethod("http://xyx.kaixin.com/upload/plugins.php");
           NameValuePair action = new NameValuePair("action", "swfrecord");
           NameValuePair game = new NameValuePair("game", "puppyred_2");
           NameValuePair p = new NameValuePair("p", "nkflash");
          
           post2.setRequestBody(new NameValuePair[]{action,game,p});
           Date d = new Date();
   
           post2.releaseConnection();
           
            long l = d.getTime();
            String starttime1 = String.valueOf(l);
            l = l + 230000;
            String endtime = String.valueOf(l);
           
           
            PostMethod post1 = new PostMethod("http://xyx.kaixin.com/upload/plugins.php");
            NameValuePair bonus = new NameValuePair("bonus", "0");   
            NameValuePair level = new NameValuePair("level", "7");
            NameValuePair fscore = new NameValuePair("fscore", "7210");
            NameValuePair playertime = new NameValuePair("playertime", endtime);
            NameValuePair playedtime = new NameValuePair("playedtime", "23");
            NameValuePair starttime = new NameValuePair("starttime", starttime1);
            NameValuePair action1 = new NameValuePair("action", "swfrecord");
            NameValuePair game1 = new NameValuePair("game", "puppyred_2");
            NameValuePair p1 = new NameValuePair("p", "nkflash");
           
            post1.setRequestBody(new NameValuePair[]{bonus,level,fscore,playertime,playedtime,starttime,action1,game1,p1});
            post1.releaseConnection();
            GetMethod get = new GetMethod("http://xyx.kaixin.com/index.php");
            client.executeMethod(get);
            String responsekaixin = get.getResponseBodyAsString();
           
            int i = responsekaixin.indexOf("牛粪");
            int i1 = responsekaixin.lastIndexOf("牛粪");
           
            System.out.println("当前有------------------------:" + responsekaixin.substring(i+439, i1) + "积分");
            get.releaseConnection();
        }catch(IOException e){
            e.printStackTrace();
        }
    }

}

 

 

黄开已经更改了验证的策略,以上程序仅供学习,无法用于刷分。刷分请参考:开心网刷分程序详解以及web游戏破解思路分析(二)

原创粉丝点击