写了一个简单的代码,按shell哥的意思的。 只是把文件“变成”php代码。必将的时候可以直接写到php.... 里到服务器再把文件释放到某目录下。 代码没写得很清晰,其实很简单,有需要的可以改改也可以自己写。
<?php /************************************************************************* file to php by saiy[s4t] 说明: 这个文件只是把任意文件转换成php代码 使用的时候你可以使用下面的php2file函数转换为原来的文件 为了居家旅行的入侵而已。blog:http://www.51shell.cn ************************************************************************/ function php2file($code,$file){//code为编码后的变量名,file为保存的文件名 $tmp = base64_decode($code); $tmp = gzinflate($tmp); $fp = fopen($file,"w"); fwrite($fp,$tmp); fclose($fp); } function file2php($file){ $tmp = readfromfile($file); $tmp = gzdeflate($tmp); $tmp = base64_encode($tmp); $tmp = "<?php/n/**************************/n php to file by saiy[s4t]/n**************************/ /n/n/n$code = /"".$tmp."/";/n?".">"; return $tmp; } function readfromfile($file_name) { if (file_exists($file_name)) { $tmp=fopen($file_name,"r"); $tmp=fread($tmp, filesize($file_name)); fclose($tmp); return $file_data; } }
//juest a example for use it writeover("myrar.php",file2php("./file.rar")); //else function //写入文件函数 function writeover($file_name,$data,$method="w") { $tmp=fopen($file_name,$method);; fwrite($tmp,$data); fclose($tmp); } ?> 【转自世纪安全网 http://www.21safe.com】
|