開心網刷分程序詳解以及web遊戲破解思路分析(一)

************本人水平有限,在學習時請用批判的態度學習,有問題給我留言************

開心網刷分程序詳解以及 web 遊戲破解思路分析(一)


1、  開心網是現在 web 網站最前衛的網站,網站形式新穎,用戶體驗好,定位準確。開心網儼然有了網絡下一代門戶的潛質。開心網上最吸引人的就是它 web 小遊戲,無論是停車、買人,還是農場都能使朋友之間充分互動。

現在來分析一下 web 遊戲的刷分程序。

Web 遊戲就是通過 http 協議發送遊戲的每一次操作請求的遊戲,優點在於簡單快捷,缺點在於太簡單,別的程序可以很輕易的模擬。

 

第一次有刷分想法是 08 年底,當時看了某位前輩做 web 遊戲外掛的文章,他用的是 c ,咱的方向是 java ,但是沒關係,只要有了思路就沒問題了。

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

                          瀏覽器是 firefox  +   IE

                             http 請求截取軟件: Tamper Date(firefox 的插件 ) httpWatch fiddler2

思路:截取每一次遊戲 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", "[email protected]");   
        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 遊戲破解思路分析(二)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章