zoukankan      html  css  js  c++  java
  • 模拟网站篡改

    环境准备

    主机 IP
    web01 10.0.0.7
    lb01 10.0.0.4

    1)配置一个网站

    [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;
        }
    } 

    2)写一个网站页面

    [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>

    3)重启nginx访问

    [root@web01 /code]# systemctl restart nginx
    
    #配置hosts
    10.0.0.7 linux.jiechi.com

    4)配置劫持网站的网站

    [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">';
        }
    }

    5)配置hosts访问

    [root@lb01 /code]# systemctl restart nginx
    
    #配置hosts
    #10.0.0.7 linux.jiechi.com
    10.0.0.4 linux.jiechi.com
  • 相关阅读:
    什么是Flex 布局
    wx.navigateTo、wx.redirectTo和wx.switchTab三种导航方式的区别
    Ajax 工作原理 及 实例
    NodeJS之 Express框架 app.use(express.static)
    Parcel 入门 (一)
    打包工具的介绍
    CSS网页布局
    《拖延心理学》阅读要点
    PHP实现页面静态化
    PHP中的魔术方法
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13617702.html
Copyright © 2011-2022 走看看