欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

php混淆加密

程序员文章站 2022-04-06 16:49:57
...
1.php代码
<?php
 $O00OO0=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$O00O0O=$O00OO0{3}.$O00OO0{6}.$O00OO0{33}.$O00OO0{30};$O0OO00=$O00OO0{33}.$O00OO0{10}.$O00OO0{24}.$O00OO0{10}.$O00OO0{24};$OO0O00=$O0OO00{0}.$O00OO0{18}.$O00OO0{3}.$O0OO00{0}.$O0OO00{1}.$O00OO0{24};$OO0000=$O00OO0{7}.$O00OO0{13};$O00O0O.=$O00OO0{22}.$O00OO0{36}.$O00OO0{29}.$O00OO0{26}.$O00OO0{30}.$O00OO0{32}.$O00OO0{35}.$O00OO0{26}.$O00OO0{30};eval($O00O0O("JE8wTzAwMD0iZGVLeExXYnFBTmNHbXBJSFJrU2hzRWlaSm5RRnZYb3lhck11VVlPQkNqVmx3RGd0VGZ6UG1QemhPa0RmVHdSdm9NanljSlVTWUtYZW5RdGRzTnVJcGFnckxCVkdBSFdFYlpsQ3FGeGlpWjlicHlUd0FRd0VSM3dNRDI1RlIzY1NSUXRsekFKN1p0TUpla2VNRG9MbHpBVFFVTDVGdFdMUU9BRzBSUVdFakFKN1p0TU1Eb3dZbWtjRU4yOXJCMkxsekFtSEQyNW9wa1JzQm9keGVVNWJweVRRenFZd0FIOCtadHV3QUhiL1J2U2JadHV3QVg4c1lQcUdzN2FpWWZqd0FvRW9qQVNNUjN3RW1BVHVqQWNGYzBXTGpkWVFCMmRzbjEwbHpVSmxQYjB6QVVjYlJvZENqWjBsbmQ5eWNXdGxrSW1IQms4UU5xWXdBUTBsZWtoeGVrRW9qQVNNUjN3RW1BVHVqQWNGYzBXTGpkWVFSeW5TRFVtbWpBSk1qeVl3QWxKSlJ5blNEVVQ5akFjRmMwV0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08wTzAwKCRPME8wMDAsJE9PMDAwMCwkT08wMDAwKSwkT08wTzAwKCRPME8wMDAsMCwkT08wMDAwKSkpKTs="));
  ?>

2.php代码

function unscrambler($code) {
  if(! is_array($code)) {
    $code = str_replace('__FILE__', "'$code'", str_replace('eval', '$code=', file_get_contents($code)));
    eval('?>' . $code);
  }else {
    extract($code);
    $code = str_replace("eval", '$code=', $code);
    eval($code);
  }
  if(strstr($code, 'eval')) return unscrambler(get_defined_vars());
  else return $code;
}
  
echo unscrambler('需要还原的代码或文件名');

3.php代码

<?php
  function RandAbc($length=""){ //返回随机字符串
    $str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return str_shuffle($str);
  }
 $filepath='index.php';
 $path_parts= pathinfo($filepath);
 $filename=$path_parts["basename"];
 
 $T_k1=RandAbc();//随机密匙1
 
 $T_k2=RandAbc();//随机密匙2
  
 $vstr=file_get_contents($filename);//要加密的文件
  
 $v1=base64_encode($vstr);
 $c=strtr($v1,$T_k1,$T_k2);//根据密匙替换对应字符。
 
 $c=$T_k1.$T_k2.$c;
 
 $q1="O00O0O";
 $q2="O0O000";
 $q3="O0OO00";
 $q4="OO0O00";
 $q5="OO0000";
 $q6="O00OO0";
 $s='$'.$q6.'=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$'.$q1.'=$'.$q6.'{3}.$'.$q6.'{6}.$'.$q6.'{33}.$'.$q6.'{30};$'.$q3.'=$'.$q6.'{33}.$'.$q6.'{10}.$'.$q6.'{24}.$'.$q6.'{10}.$'.$q6.'{24};$'.$q4.'=$'.$q3.'{0}.$'.$q6.'{18}.$'.$q6.'{3}.$'.$q3.'{0}.$'.$q3.
'{1}.$'.$q6.'{24};$'.$q5.'=$'.$q6.'{7}.$'.$q6.'{13};$'.$q1.'.=$'.$q6.'{22}.$'.$q6.'{36}.$'.$q6.'{29}.$'.$q6.'{26}.$'.$q6.'{30}.$'.$q6.'{32}.$'.$q6.'{35}.$'.$q6.'{26}.$'.$q6.'{30};eval($'.$q1.'("'.base64_encode('$'.$q2.'="'.$c.'";eval(\'?>\'.$'.$q1.'($'.$q3.'($'.$q4.'($'.$q2.',$'.$q5.'*2),$'.$q4.'($'.$q2.',$'.$q5.',$'.$q5.'),$'.$q4.'($'.$q2.',0,$'.$q5.'))));').'"));';
  
 $s='<?
 '.$s.
'
?>';
  
echo $s;
//生成 加密后的php文件
!is_dir('create/') && mkdir('create/');
$fpp1 = fopen('create/'.$filename,'w');
fwrite($fpp1,$s) or die('写文件错误');
echo '加密成功!';
相关标签: php混淆加密