HanDs
NO.2

[Delphi文章] QQ农场登录前的分析 





学习中请遵循国家相关法律法规,黑客不作恶。没有网络安全就没有国家安全

本站需要登陆后才能查看

登录农场有两个渠道:

  1、通过QQ校友登录;

  2、通过QQ空间登录;

介绍一下工具:fiddler(HTTP抓包工具)

这个是在空间渠道登录的截图:

 

可以看到,从空间登录农场的地址是:http://happyfarm.qzone.qq.com/

            从校友登录农场的地址:http://happyfarm.xiaoyou.qq.com/

 

紧接着POST了一个包到:http://happyfarm.qzone.qq.com/api.php?mod=user&act=run



可以看见  body一栏内,POST的数据主要包括两大部分:

  1、各功能swf的版本;

  2、farmkey 和 farmtime;(这是一组对应的编码,farmkey是依据farmtime生成的一组32位的MD5码;

顺带介绍一下时间戳。也就是上面的farmtime;详细请参见 时间戳-百度百科

  Delphi将当前时间转换成时间戳代码:DatetimeToUnix(Now - 8 / 24);(中国处于GMT +8时区)

  记得在uses里加上DateUtils

核心内容:

    返回的数据内容,也就是HTML源码。

{"farmlandStatus":[{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":2,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255605382,"r":1255756582},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255551999,"r":1255703199},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255551999,"r":1255703199},{"a":33,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":3,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255604257,"r":1255751857},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552000,"r":1255703200},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552000,"r":1255703200},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552001,"r":1255703201},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552002,"r":1255703202},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552002,"r":1255703202},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552003,"r":1255703203},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":2,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255605383,"r":1255756583},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552003,"r":1255703203},{"a":34,"b":1,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":0,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255585357,"r":1255585357},{"a":34,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":1,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255552004,"r":1255703204},{"a":33,"b":4,"c":0,"d":0,"e":1,"f":0,"g":0,"h":1,"i":100,"j":2,"k":0,"l":0,"m":0,"n":[],"o":0,"p":[],"q":1255542157,"r":1255689757}],"items":{"1":{"itemId":213},"2":{"itemId":214},"3":{"itemId":215},"4":{"itemId":216}},"exp":53725,"weather":{"weatherId":1,"weatherDesc":"\u6674\u5929"},"serverTime":{"time":1255789091},"user":{"uId":155893,"userName":null,"money":462700,"headPic":null,"exp":53725,"yellowlevel":0,"yellowstatus":0,"canbad":50,"pf":false},"cacheControl":{"seed":9,"tool":1,"diy":3},"a":true,"b":1255686763,"c":false,"task":{"taskId":0,"taskFlag":0}}

这个是JSON格式的数据,详细请参见JSON网站:JSON

下一个地址是:http://happyfarm.qzone.qq.com/api.php?mod=user&act=getNotice
(获取系统公告)这里就不详细介绍了

分析:

  可以看到,登录后会发一个(我们定义为run动作)数据,告诉服务器开始游戏,服务器立即返回当前登录帐户的农场信息,也就是以上的JSON格式的数据。

  也就是说,只要能模拟发出首个POST数据包即可获得自己农场的信息。

  网上有牛人破解了farmtime和farmkey的关系,我这里把规则写好了。

获取farmkey:

function TCommon.getFarmKey(time: TDateTime): string;  
var
  md5: TIdHashMessageDigest5;
  temp1: Integer;
  temp3: string;
begin
  temp3 := 'sdoit78sdopig7w34057';
  temp1 := DatetimeToUnix(time - 8 / 24);
  Delete(temp3, 1, temp1 mod 10);
  temp3 := IntToStr(temp1) + temp3;
  md5 := TIdHashMessageDigest5.Create;
  Result := LowerCase(md5.AsHex(md5.HashValue(temp3)));
end;

以上是对农场登录的分析,下一篇文章具体介绍如何用WEB控件POST数据,来模拟登录农场;


学习中请遵守法律法规,本网站内容均来自于互联网,本网站不负担法律责任
QQ 农场登录前的分析
#1楼
发帖时间:2016-7-9   |   查看数:0   |   回复数:0
游客组