Last active
February 27, 2017 09:53
-
-
Save lifesign/9825937 to your computer and use it in GitHub Desktop.
纯真数据库自动更新
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
纯真数据库自动更新原理实现 | |
示例代码使用php实现,从copywrite.rar中读取解密需要的一个key,然后解密qqwry.rar头0x200字节数据,随后使用zlib解压数据即可得到qqwry.dat文件 | |
通过此代码的实现,你应该可以自行实现一个纯真数据库更新工具。copywrite.rar中还有一些更多的数据,没有一一列出,比如版本号、qqwry.rar文件大小。 | |
collect from https://github.com/shuax/QQWryUpdate/blob/master/update.php | |
*/ | |
$copywrite = file_get_contents("http://update.cz88.net/ip/copywrite.rar"); | |
$qqwry = file_get_contents("http://update.cz88.net/ip/qqwry.rar"); | |
$key = unpack("V6", $copywrite)[6]; | |
for($i=0; $i<0x200; $i++) | |
{ | |
$key *= 0x805; | |
$key ++; | |
$key = $key & 0xFF; | |
$qqwry[$i] = chr( ord($qqwry[$i]) ^ $key ); | |
} | |
$qqwry = gzuncompress($qqwry); | |
$fp = fopen("qqwry.dat", "wb"); | |
if($fp) | |
{ | |
fwrite($fp, $qqwry); | |
fclose($fp); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment