【转】PHP免扩展加密(夹杂加密)的根基道理(二)数

看代码吧!


<?php
function phpencode($code) {
$code = str_replace(array('<?php','?>','<?PHP'),array('','',''),$code);
$encode = base64_encode(gzdeflate($code));// 开始编码
$encode = '<?php'."\neval(gzinflate(base64_decode("."'".$encode."'".")));\n?>";
return $encode;
}
function phpdecode($code) {
$code = str_replace(array('<!?php','<?PHP',"eval(gzinflate(base64_decode('","')));",'?>'),array('','','','','',''),$code);
$decode = base64_decode($code);
$decode = @gzinflate($decode);
return $decode;
}
?>
</span></p><form method="post">
<textarea cols="55" rows="8">
<?php
if(!empty($_POST['source'])) {
if($_POST['button']=='加密') {
echo htmlspecialchars(phpencode(stripcslashes($_POST['source'])));
}
if($_POST['button']=='解密') {
echo htmlspecialchars(phpdecode(stripcslashes($_POST['source'])));
}
}
?>
</textarea>
<?php
if(!empty($_POST['source']))
{
if($_POST['button']=='加密')
{
echo '加密乐成.';
}
if($_POST['button']=='解密') {
echo '解密乐成.';
}
}else{
echo '操纵失败';
}
?>
<input type="submit" value="加密">
<input type="submit" value="解密">
</form>

这里对适才的加密来说,对代码举办了压缩,再base64 对较量之前的较为安详. 下面是微盾的加密代码,对比上面的加密,增加了夹杂操纵.


<?php // This file is protected by copyright law & provided under license. Copyright(C) 2005-2009 , All rights reserved.
$OOO0O0O00=__FILE__;$OOO000000=urldecode('%74%68%36%73%62%65%68%71%6c%61%34%63%6f%5f%73%61%64%66%70%6e%72');$OO00O0000=244;$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000000{5};$O0O0000O0='OOO0000O0';eval(($$O0O0000O0('JE9PME9PMDAwMD0kT09PMDAwMDAwezE3fS4kT09PMDAwMDAwezEyfS4kT09PMDAwMDAwezE4fS4kT09PMDAwMDAwezV9L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jSYtJOiNUwxHjHxHjHJKX0hDBCPkoriNUwJhbSYtMajDo8IwmOPDbHIfoazftnpcJEibo4JKX0hgW0hCBwPhTSYtMc1dMY0DB9VwoyJhtLYtmSYtMajDo8Ihtk0DolzwolzwuOlF3WIcmaVC3Opd24iwJL7eWp9eWP=


个中赤色部份为夹杂的措施,下面蓝色部份为数据. 这样加密较量难处理惩罚. 有乐趣的,可以本身去下载微盾.
下面附上运行的流程代码:


这里为当前PHP文件 ,下面为编码的数据


$OOO0O0O00=__FILE__;
$OOO000000=urldecode('%74%68%36%73%62%65%68%71%6c%61%34%63%6f%5f%73%61%64%66%70%6e%72');
解码后为:th6sbehqla4co_sadfpnr
下面就是用夹杂的O(欧)0(零)要人不易读.
//************* 2
$OO0OO0000=$OOO000000{17}.$OOO000000{12}.$OOO000000{18}.$OOO000000{5}.$OOO000000{19};
if(!0)$O000O0O00=$OO0OO0000($OOO0O0O00,'rb');$OO0OO000O=$OOO000000{17}.$OOO000000{20}.$OOO000000{5}.$OOO000000{9}.$OOO000000{16};
$OO0OO00O0=$OOO000000{14}.$OOO000000{0}.$OOO000000{20}.$OOO000000{0}.$OOO000000{20};$OO0OO000O($O000O0O00,1260);
$OO00O00O0=($OOO0000O0($OO0OO00O0($OO0OO000O($O000O0O00,380),'EnteryouwkhRHYKNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/')));
eval($OO00O00O0);

//************* 1
$OO00O00O0=str_replace('__FILE__',"'".$OOO0O0O00."'",($OOO0000O0($OO0OO00O0($OO0OO000O($O000O0O00,$OO00O0000),'EnteryouwkhRHYKNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'))));fclose($O000O0O00);eval($OO00O00O0);

//************* 1 在这里获得最终的代码了.

echo "this test echo 123!\n";
echo "this test echo 456!\n";

$a="123123";

if($a!=""){

echo "this test if !\n";

}
ab();
function ab()
{
echo ("this is test function!");
}


最在竣事的最后,后期呈现的期他的加密神盾,威盾等等.回收了ascii码 129-255的乱码夹杂来实现变量名,造成不易读.这样可以更好的掩护代码的执行.但也存在致命的问题.就是无论怎么加密.最终都要还原成明文.这个就是破解的要害地址.在下次,读读这个加密的缺点,尚有这个加密壳的资料.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7752.html