php给代码加密目录下所有php文件加密
作者:互联网
1 <html class="no-js"> 2 <head> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>操作成功</title> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> 7 <meta name="author" content="柳叶湖畔,Mr.zhao" /> 8 <meta name="copyright" content="2014 LYH Company Website Management System" /> 9 <meta name="MSSmartTagsPreventParsing" content="True" /> 10 <meta http-equiv="MSThemeCompatible" content="Yes" /> 11 <style type="text/css"> 12 .tip {margin:6rem 0 0 0;} 13 .tip .icon { 14 width: 80px; 15 height: 80px; 16 background-color: #40b737; 17 border-radius: 100%; 18 -webkit-border-radius: 100%; 19 -moz-border-radius: 100%; 20 color: #fff; 21 font-size: 80px; 22 text-align: center; 23 line-height: 80px; 24 } 25 .icon { 26 position: relative; 27 width: 80px; 28 height: 80px; 29 border-radius: 50px; 30 -webkit-border-radius: 50px; 31 -moz-border-radius: 50px; 32 border: 4px solid #40b737; 33 margin: 15px auto 5px auto; 34 } 35 .dec_txt{font-size:1rem;color:#999;text-align:center;margin:2rem 0 0 0;} 36 .jump{font-size:.8rem;color:#999;text-align:center;margin:2rem 0 0 0;} 37 .jump a{font-size:.8rem;color:#999;} 38 </style> 39 </head> 40 <body> 41 <?php 42 function RandAbc($length = "") { // 返回随机字符串 43 $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 44 return str_shuffle($str); 45 } 46 //zhao/ying\huawen-pxuqy*6lrkdg9_e0736o4+f37j 47 // 48 $folder = './temp'; 49 $dir_data = fileShow($folder); 50 foreach ($dir_data as $k=>$v){ 51 $filename = $folder.'/'.$v; //要加密的文件 52 $T_k1 = RandAbc(); //随机密匙1 53 $T_k2 = RandAbc(); //随机密匙2 54 $vstr = file_get_contents($filename); 55 $v1 = base64_encode($vstr); 56 $c = strtr($v1, $T_k1, $T_k2); //根据密匙替换对应字符。 57 $c = $T_k1.$T_k2.$c; 58 $q1 = "O00O0O"; 59 $q2 = "O0O000"; 60 $q3 = "O0OO00"; 61 $q4 = "OO0O00"; 62 $q5 = "OO0000"; 63 $q6 = "O00OO0"; 64 $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.'))));').'"));'; 65 $s = '<?php '."\n".$s."\n".' ?>'; 66 $fpp1 = fopen($filename, 'w'); 67 fwrite($fpp1, $s) or die('写文件错误'); 68 } 69 70 //遍历目录下的所有文件夹 71 function folderShow($dir){ 72 $handle = opendir($dir); 73 $folderdata = array(); 74 while($file = readdir($handle)){ 75 if($file !== '..' && $file !== '.'){ 76 $f = $dir.'/'.$file; 77 if(is_file($f)){ 78 79 }else{ 80 $folderdata[] = $file; //代表文件夹 81 folderShow($f); 82 } 83 } 84 } 85 return $folderdata; 86 } 87 //遍历目录下的所有文件 88 function fileShow($dir){ 89 $handle = opendir($dir); 90 $filedata = array(); 91 while($file = readdir($handle)){ 92 if($file !== '..' && $file !== '.'){ 93 $f = $dir.'/'.$file; 94 if(is_file($f)){ 95 $filedata[] = $file; //代表文件 96 } 97 } 98 } 99 return $filedata; 100 } 101 ?> 102 <div class="tip"> 103 <div class="icon">✓</div> 104 <div class="dec_txt">操作完成</div> 105 </div> 106 </body> 107 </html>
标签:加密,q6,radius,file,q5,php,border,目录,dir 来源: https://www.cnblogs.com/zhaoying/p/15108570.html