开心网刷分程序详解以及web游戏破解思路分析一
开心网刷分程序详解以及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
年初新浪跳槽员工创立的网站,域名:
网站的基准色是红色,文章中简称:红开
另外一个开心网是后来千橡国际模仿前一个网站的创意开发的网站,
域名:
网站基准色是黄色,文章中简称:黄开
本篇讨论的是黄开上的游戏,红开的游戏较为简单,明白原理后请大家自己开发相应外挂。
黄开的
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”, “ ”);
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(“
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(“
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(“
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
游戏破解思路分析(二)