模拟网站篡改
环境准备
主机 | IP |
web01 | 10.0.0.7 |
lb01 | 10.0.0.4 |
[root@web01 /code]# vim /etc/nginx/conf.d/linux.jiechi.com.conf server { listen 80; server_name linux.jiechi.com; charset utf-8; location / { root /code/jc; index index.html; } }
[root@web01 /code]# mkdir /code/jc
[root@web01 /code]# cat /code/jc/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>我是title</title>
</head>
<body>
<article>
<header>
<h1>我是qiudao</h1>
<p>创建时间:<time pubdate="pubdate">2018/8/10</time></p>
</header>
<p>
<b>Aticle</b>第一次用h5写文章,好他*的紧张...
</p>
<footer>
<p><small>版权所有!</small></p>
</footer>
</article>
</body>
</html>
[root@web01 /code]# systemctl restart nginx
#配置hosts
10.0.0.7 linux.jiechi.com
[root@lb01 ~]# vim /etc/nginx/conf.d/linux.jiechi.com.conf
server {
listen 80;
server_name linux.jiechi.com;
charset utf-8;
location / {
#劫持
proxy_pass http://10.0.0.7;
include proxy_params;
#篡改
sub_filter '<title>我是title</title>' '<title>我不是个东西</title>';
sub_filter '<b>qiudao</b>第一次用h5写文章,好他*的紧张...' '<img src="https://blog.driverzeng.com/zenglaoshi/xingganheguan.gif">';
}
}
[root@lb01 /code]# systemctl restart nginx
#配置hosts
#10.0.0.7 linux.jiechi.com
10.0.0.4 linux.jiechi.com
本文来自博客园,作者:六月OvO,转载请注明原文链接:https://www.cnblogs.com/chenlifan/p/13617702.html