QQ Farm, data packet capture analysis, source code implementation, image explanation

Source: Internet
Author: User

The analysis process is as follows:

1. log on to the farm first (we recommend that you log on from the space ).

2.open the packet capture tool (the wsockexpert_cn.exe.exe I use, select iexplorer.exe, and click open to start monitoring, as shown in figure

(Note: I use IE8 and there are many processes. If you are not sure, you can try it one by one. IE6 only has one process, which is not so troublesome)


3. Find the friend you want to give away and give away the pasture. Return to the packet capture tool. For example

(For packet capture analysis, you must first find someone who has activated the farm)


The data is as follows:

Post URL

Post/cgi-bin/cgi_feed_food HTTP/1.1
Accept :*/*
Accept-language: ZH-CN
Referer: http://appimg.qq.com/happyfarm/module/Master_v_13.swf? V = 1
X-flash-version: 10, 0, 32, 18
Content-Type: Application/X-WWW-form-urlencoded
Content-Length: 149
Accept-encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;. Net CLR 2.0.50727)
HOST: mc.qzone.qq.com
Connection: keep-alive
Cache-control: No-Cache
COOKIE: _ q_w_s _ appdataseed = 1; randomseed = 908772; login_time = hour; uin = o0385184514; skey = @ override; SSID = hour; pt2gguin = hour; ptcz = hour; PVID = 9714891820; FLV = 10.0

Post Data:

Foodnum = 10 & uid = 531348296 & Nick = % E5 % 97% 9C % E8 % a1 % 80% E5 % 88% E9 % ad % 94 & type = 0 & farmkey = 3ac36cc979237f6bda1c5f5765e13f86 & uidx = 379004904 & farmtime = 1261587968

Server return data

{"Addexp": 1, "added": 10, "animal": [{"buytime": 1261451345, "CID": 1504, "growtime": 86899, "growtimenext": 19932, "Hungry": 0, "serial": 1, "status": 5, "statusnext": 3, "totalcome": 7 }, {"buytime": 1261451345, "CID": 1504, "growtime": 72499, "growtimenext": 6701, "Hungry": 0, "serial": 2, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451345, "CID": 1504, "growtime": 57600, "growtimenext": 21600, "Hungry": 0, "serial": 3, "status": 2, "statusnext": 3, "totalcome": 0 }, {"buytime": 1261451355, "CID": 1005, "growtime": 57600, "growtimenext": 18000, "Hungry": 0, "serial": 4, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 5, "status": 2, "statusnext": 3, "totalcome": 0 }, {"buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 6, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 7, "status": 2, "statusnext": 3, "totalcome": 0}], "direction": "10 pastures are successfully added.", "money": 0, "Total": 2, "type": 0, "uid": 531348296}
Post URL

Post/cgi-bin/cgi_feed_food HTTP/1.1
Accept :*/*
Accept-language: ZH-CN
Referer: http://appimg.qq.com/happyfarm/module/Master_v_13.swf? V = 1
X-flash-version: 10, 0, 32, 18
Content-Type: Application/X-WWW-form-urlencoded
Content-Length: 149
Accept-encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;. Net CLR 2.0.50727)
HOST: mc.qzone.qq.com
Connection: keep-alive
Cache-control: No-Cache
COOKIE: _ q_w_s _ appdataseed = 1; randomseed = 908772; login_time = hour; uin = o0385184514; skey = @ override; SSID = hour; pt2gguin = hour; ptcz = hour; PVID = 9714891820; FLV = 10.0

Post Data:

Foodnum = 10 & uid = 531348296 & Nick = % E5 % 97% 9C % E8 % a1 % 80% E5 % 88% E9 % ad % 94 & type = 0 & farmkey = 3ac36cc979237f6bda1c5f5765e13f86 & uidx = 379004904 & farmtime = 1261587968

Server return data

{"Addexp": 1, "added": 10, "animal": [{"buytime": 1261451345, "CID": 1504, "growtime": 86899, "growtimenext": 19932, "Hungry": 0, "serial": 1, "status": 5, "statusnext": 3, "totalcome": 7 }, {"buytime": 1261451345, "CID": 1504, "growtime": 72499, "growtimenext": 6701, "Hungry": 0, "serial": 2, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451345, "CID": 1504, "growtime": 57600, "growtimenext": 21600, "Hungry": 0, "serial": 3, "status": 2, "statusnext": 3, "totalcome": 0 }, {"buytime": 1261451355, "CID": 1005, "growtime": 57600, "growtimenext": 18000, "Hungry": 0, "serial": 4, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 5, "status": 2, "statusnext": 3, "totalcome": 0 }, {"buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 6, "status": 2, "statusnext": 3, "totalcome": 0 },{ "buytime": 1261451355, "CID": 1005, "growtime": 43200, "growtimenext": 32400, "Hungry": 1, "serial": 7, "status": 2, "statusnext": 3, "totalcome": 0}], "direction": "10 pastures are successfully added.", "money": 0, "Total": 2, "type": 0, "uid": 531348296}

There are so many preparations. The following is an analysis.


Send data as follows


(The sent data itself is useless and can be saved, such as the owner ID and the owner nickname)

Below is the implementation

1. The first method is to use HTML forms.

View plaincopy to clipboardprint?
<MCE: Script Type = "text/JavaScript"> <! --
/*
Author: Wang anlin. QQ: 379184514. Mail: w18514379@126.com. Blog: http://blog.csdn.net/w184514.pdf or http://blog.csdn.net/lin#184514.
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24
*/
// --> </MCE: SCRIPT>
<MCE: Script Type = "text/JavaScript" src = "md5.js" mce_src = "md5.js"> </MCE: SCRIPT>
<MCE: Script Type = "text/JavaScript"> <! --
Function Test () // calculate the farmkey and submit the form
{
VaR c = new date ();
VaR farmtime = math. Floor (C. gettime ()/1000 );
Var key = "FS # $ hsj! Fa * af! -0aps ";
VaR farmkey = hex_md5 (farmtime + key. substr (parseint (farmtime) % 10, 19 ));
// Key = "& farmtime =" + farmtime + "& farmkey =" + farmkey;
Document. getelementbyid ("farmtime"). value = farmtime; // fill time farmtime to form
Document. getelementbyid ("farmkey"). value = farmkey; // fill time farmkey to form
Window. Frames ["free"]. Submit (); // execute the submit form
// Return key;
};
// --> </MCE: SCRIPT>
<Form name = "free" method = "Post" Action = "http://mc.qzone.qq.com/cgi-bin/cgi_feed_food">
UID <input name = "uid" value = "379004904"/> (friend ID. This ID is not a QQ number. For details, see the JS version.) <br>
Foodnum <input name = "foodnum" value = "10"/> (number of free pastures) <br>

<Br> you do not need to enter the following three items <br>
Farmtime <input name = "farmtime" value = ""/> <br>
Farmkey <input name = "farmkey" value = ""/> <br>
Type <input name = "type" value = "0"/> <br>
<Input type = "button" value = "" onclick = "test ()">

</Form>
<Br>
<Br>
<Br>
Author: Wang anlin. QQ: 379184514. Mail: w18514379@126.com. Blog: http://blog.csdn.net/w184514.pdf or http://blog.csdn.net/lin#184514.
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24
<MCE: Script Type = "text/JavaScript"> <! --
/*
Author: Wang anlin. QQ: 379184514. Mail: w18514379@126.com. Blog: http://blog.csdn.net/w184514.pdf or http://blog.csdn.net/lin#184514.
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24
*/
// --> </MCE: SCRIPT>
<MCE: Script Type = "text/JavaScript" src = "md5.js" mce_src = "md5.js"> </MCE: SCRIPT>
<MCE: Script Type = "text/JavaScript"> <! --
Function Test () // calculate the farmkey and submit the form
{
VaR c = new date ();
VaR farmtime = math. Floor (C. gettime ()/1000 );
Var key = "FS # $ hsj! Fa * af! -0aps ";
VaR farmkey = hex_md5 (farmtime + key. substr (parseint (farmtime) % 10, 19 ));
// Key = "& farmtime =" + farmtime + "& farmkey =" + farmkey;
Document. getelementbyid ("farmtime"). value = farmtime; // fill time farmtime to form
Document. getelementbyid ("farmkey"). value = farmkey; // fill time farmkey to form
Window. Frames ["free"]. Submit (); // execute the submit form
// Return key;
};
// --> </MCE: SCRIPT>
<Form name = "free" method = "Post" Action = "http://mc.qzone.qq.com/cgi-bin/cgi_feed_food">
UID <input name = "uid" value = "379004904"/> (friend ID. This ID is not a QQ number. For details, see the JS version.) <br>
Foodnum <input name = "foodnum" value = "10"/> (number of free pastures) <br>

<Br> you do not need to enter the following three items <br>
Farmtime <input name = "farmtime" value = ""/> <br>
Farmkey <input name = "farmkey" value = ""/> <br>
Type <input name = "type" value = "0"/> <br>
<Input type = "button" value = "" onclick = "test ()">

</Form>
<Br>
<Br>
<Br>
Author: Wang anlin. QQ: 379184514. Mail: w18514379@126.com. Blog: http://blog.csdn.net/w184514.pdf or http://blog.csdn.net/lin#184514.
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24

2. Method 2: Use Js.

<SCRIPT type = "text/JavaScript">
/*
Author: Wang anlin. QQ: 379184514. Mail: w18514379@126.com. Blog: http://blog.csdn.net/w184514.pdf or http://blog.csdn.net/lin#184514.
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24
*/
</SCRIPT>
<SCRIPT type = "text/JavaScript" src = "md5.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
// Calculate the farmkey
Function getkey ()
{
VaR c = new date ();
VaR farmtime = math. Floor (C. gettime ()/1000 );

Var key = "FS # $ hsj! Fa * af! -0aps ";
VaR farmkey = hex_md5 (farmtime + key. substr (parseint (farmtime) % 10, 19 ));
Key = "& farmtime =" + farmtime + "& farmkey =" + farmkey;
// Alert (key );
Return key;
};

// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx post send data end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //
Function createxmlhttprequest ()
{
If (window. XMLHttpRequest ){
Xmlhttpr = new XMLHttpRequest ();
} Else if (window. activexobject ){
Try {
Xmlhttpr = new activexobject ("msxml2.xmlhttp ");
} Catch (e ){
Try {
Xmlhttpr = new activexobject ("Microsoft. XMLHTTP ");
} Catch (e ){}
}
}
}

Function sendrequest (method, URL, Data, callback)
{
Createxmlhttprequest ();
Xmlhttpr. Open (Method = "P "? "Post": "Get", URL, false); // method equals to "P" is the POST method, and others are the get method.
Xmlhttpr. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded ");
Xmlhttpr. onreadystatechange = eval (callback + "processresponse"); // create a processing function using eval
Xmlhttpr. Send (data );
}

// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx post data sending end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //

// 00000000000000000000000000000000000000000000 free pasture start 000000000000000000000000000000000000000000000000000000000000000 //
Function feedfoodprocessresponse ()
{
If (xmlhttpr. readystate = 4 & xmlhttpr. Status = 200)
{
Txtoutput. value = xmlhttpr. responsetext; // the return value of the service, which is sent to the text field for display.
}
}
Function getfeedfood (foodnum, frienduid)
{
VaR url = "http://mc.qzone.qq.com/cgi-bin/cgi_feed_food ";
VaR DATA = "foodnum =" + foodnum + "& uid =" + frienduid + "& type = 0" + getkey ();
Sendrequest ("P", URL, data, "feedfood ");
}
// 00000000000000000000000000000000000000000000 free pasture end 000000000000000000000000000000000000000000000000000000000000000 //

// Zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz get personal information start zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz //
Function userinfoprocessresponse () // created through the eval function. That is, Eval ("userinfo" + "processresponse \ (UNM \)");
{
If (xmlhttpr. readystate = 4 & xmlhttpr. Status = 200)
{
Txtoutput. value = xmlhttpr. responsetext;
Transuserinfo (xmlhttpr. responsetext );
}
}

Function getuserinfo ()
{
VaR url = "http://happyfarm.qzone.qq.com/api.php? MoD = user & act = run ";
VaR DATA = getkey ();
Sendrequest ("P", URL, data, "userinfo ");
}

Function transuserinfo (mystring)
{
VaR userinfo = eval ('+ mystring +'); // use the string mystring to create the JSON object userinfo.
// Create a table and use innerhtml. Note that the innerhtml attribute of the table is read-only, so you cannot directly operate innerhtml of the table. Here, the innerhtml Of The DIV is operated.
VaR STR = '<tr align = middle bgcolor = "# ffff66"> <TD>' + userinfo. user. UID + '</TD> <TD>' + userinfo. user. yellowlevel + '</TD> <TD>' + userinfo. user. exp + '</TD> <TD>' + userinfo. user. money + '</TD> <TD>' + getlevel (userinfo. user. exp) [0] + '</TD> <TD>' + (getlevel (userinfo. user. exp) [0] + 1) * 200-getlevel (userinfo. user. exp) [1]) + "\/" + (getlevel (userinfo. user. exp) [0] + 1) * 200 + '</TD> </tr> ';
Document. getelementbyid ('userinfodiv '). innerhtml = '<Table border = 1> <tbody id = userinfotab> <tr align = middle> <TH> uid </Th> <TH> yellow drill level </Th> <th> experience </Th> <TH> gold coins </Th> <TH> level </Th> <TH> Upgrade </Th> </tr> '+ STR +' </tbody> </table> ';
}
// Zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz get personal information end zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz //

//************************************** ************************ **************************************** *//
// The experience required for upgrading level 9 or above is incorrect. The specific calculation method is unclear. All levels are correct.
Function getlevel (experience ){
VaR levelarray = new array (2 );
Levelarray [0] = 0;
Levelarray [1] = 0;
For (VAR I = 1; I <100; I ++ ){
Levelarray [0] + = 200 + 200*(I-1 );
If (levelarray [0]> experience ){
// Obtain the required upgrade experience
Levelarray [1] = levelarray [0]-experience;
// Obtain the current level
Levelarray [0] = I-1;
Break;
}
}
Return levelarray;
};

//************************************** ********************* **************************************** **//

// ---------------------------- Friends list start -------------------------------------------//
Function friendlistprocessresponse ()
{
If (xmlhttpr. readystate = 4 & xmlhttpr. Status = 200)
{
Txtoutput. value = xmlhttpr. responsetext;
Transfriend (xmlhttpr. responsetext );
}
}

Function getfriendlist ()
{
VaR url = "http://happyfarm.qzone.qq.com/api.php? MoD = friend ";
VaR DATA = getkey ();
Sendrequest ("P", URL, data, "friendlist ");
}

Function transfriend (mystring)
{

VaR friendinfo = new array ();
Friendinfo = eval ('+ mystring + ')');
VaR friendtitle = '<tr align = middle> <TH> NO. </Th> <TH> id </Th> <TH> QQ </Th> <TH> nickname </ th> <TH> Avatar </Th> <TH> yellow diamond </Th> <TH> experience </Th> <TH> gold coins </Th> <TH> Grade </ th> <TH> Upgrade </Th> <TH> dog food </Th> <TH> selected </Th> </tr> ';
// Alert (friendinfo [0]. userid );

VaR STR = "";
For (I = 0; I <friendinfo. length; I ++)
{
// Friendinfo [0]. userid;
STR + = '<tr align = middle> <TD>' + I + '</TD> <TD>' + friendinfo [I]. userid + '</TD> <TD>' + friendinfo [I]. uin + '</TD> <TD>' + friendinfo [I]. username + '</TD> </TD> <TD>' + friendinfo [I]. yellowlevel + '</TD> <TD>' + friendinfo [I]. exp + '</TD> <TD>' + friendinfo [I]. money + '</TD> <TD>' + getlevel (friendinfo [I]. exp) [0] + '</TD> <TD>' + (getlevel (fr Iendinfo [I]. exp) [0] + 1) * 200-getlevel (friendinfo [I]. exp) [1] * 1) + '\/' + (getlevel (friendinfo [I]. exp) [0] + 1) * 200 + '</TD> <TD>? </TD> <input type = "checkbox" id = "friendinfo '+ I +'" Checked> </TD> </tr> ';
}
VaR userinfo = '<tr align = middle bgcolor = "# ffff66"> <TD>' + I + '</TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [0]. innertext + '</TD> <TD> null </TD> <TD> master </TD> <TD> null </TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [1]. innertext + '</TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [2]. innertext + '</TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [3]. innertext + '</TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [4]. innertext + '</TD> <TD>' + document. getelementbyid ("userinfotab "). rows [1]. cells [5]. innertext + '</TD> <TD>? </TD> <input type = "checkbox" id = "friendinfo '+ I +'" Checked> </TD> </tr> ';
Document. getelementbyid ('friendlistdiv '). innerhtml = '<Table border = 1> <tbody id = friendtab>' + friendtitle + STR + userinfo + '</tbody> </table> ';
}

// ------------------------------- Friend list end -----------------------------------------------//

</SCRIPT>

<A target = "_ blank" tabindex = "8" href = "http://qzone.qq.com" id = "label_forget_pwd"> login </a>
(You must first log on to the farm through the space to use this plug-in !)
<Br>
<Br>

<Input type = "button" value = "get personal information" onclick = "getuserinfo ()">
<Div id = "userinfodiv">
<Table border = 1>
<Tbody id = userinfotab>
</Tbody>
</Table>
</Div>
<Br>

<Input type = "button" value = "getting friend lists" onclick = "getfriendlist ()">
(You Need To "obtain personal information ")
<Div id = "friendlistdiv">
<Table border = 1>
<Tbody id = friendtab>
</Tbody>
</Table>
</Div>

<Br>
Free pasture quantity <input id = "foodnum" value = ""/> <br>
Friend code <input id = "frienduid" value = ""/>
(Note: The Friend code is not a QQ number. It is the UID obtained by "getting personal information" and "getting friends list". Generally, the first three digits are the same as the QQ number)
<Br>
<Input type = "button" value = "Send pasture" onclick = 'getfeedfood (foodnum. Value, frienduid. Value) '>
<Br>

<Br>
Raw data returned by the server <br>
<Textarea id = "txtoutput" style = "width: 850px; Border: 1px solid # c5e2f2; overflow: visible;" rows = "15"> </textarea>
<Input class = "but" id = "res" type = "button" value = "UTF-8 restores Chinese keywords" onclick = "txtresult. value = Unescape (txtoutput. value. replace (/\ U/g, '% U'); "/>
<Input class = "but" id = "Conv" type = "button" value = "UTF-8 ↑" onclick = 'txtoutput. value = txtresult. value. replace (/[^ \ u0000-\ u00ff]/g, function ($0) {return escape ($0 ). replace (/(% u) (\ W {4})/GI, "\ U $2")}); '/>
<Textarea id = "txtresult" style = "width: 850px; Border: 1px solid # c5e2f2; overflow: visible;" rows = "15"> </textarea>

<Br>
In order to prevent logon from taking too long, you can call the refresh farm without waiting for a while.
<Br>
<Input type = "button" value = "refreshing farm" onclick = 'document. getelementbyid ("happyfarm"). src = "http://happyfarm.qzone.qq.com/"; '>
<IFRAME id = "happyfarm" width = "100%" Height = "670" frameborder = "0" application = "yes" scrolling = "no" src = 'HTTP: // happyfarm.qzone.qq.com '> </iframe>

<Br>
Special statement: This work is only for research and exchange purposes. It is only for you to provide some ideas and can be modified or disseminated at will. You will not be held responsible for copyright protection, and you will not answer questions or update the work any more.
2009.12.24

End www.hitidc.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.