安全基础第二天:http的header和referrer

这篇具有很好参考价值的文章主要介绍了安全基础第二天:http的header和referrer。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、form表单相关属性

 <form action="./a.php" enctype="multipart/form-data" method="post">
        用户名:<input type="text" name="submit-name" required minlength="4" maxlength="8" size="10"><br>
        另外的用户名: <input type="text" name="othername" pattern="[a-z]{3,6}"><br>
        密码; <input type="password" name="password"><br>
        文件:<input type="file" name="files"><br>
        <input type="submit" value="上传">
        <input type="reset" value="清除">
        <textarea name="neirong" id="neirong" cols="30" rows="5"></textarea>
 </form>
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
  1. action属性

给后端提交的一个地址

<form action="https://example.com/api"></form>
  1. method属性

传参的方法,一般用的是post传参

<form method="post"></form>
  1. enctype属性

上传一些文件

<form enctype="multipart/form-data"></form>
  1. required属性

限制输入长度

用户名:<input type="text" name="submit-name" required minlength="4" maxlength="8" size="10"><br>
  1. pattern属性

正则表达式限制

另外的用户名: <input type="text" name="othername" pattern="[a-z]{3,6}"><br>
  1. passwd属性

隐藏密码

密码; <input type="password" name="password" ><br>
  1. textarea属性

<textarea name="neirong" id="neirong" cols="30" rows="5"></textarea>

二、iframe(网页中嵌入其他网页)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="div">aaaaaaa</div>
    <iframe src="./b.html" width="10%" height="200" frameborder="1" sandbox="allow-scripts allow-same-origin allow-modals"></iframe>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>hello world</h1>
</body>
<script src="./b.js"></script>
</html>
alert(document.cookie);
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
  1. <iframe>的一些属性

嵌入的网页默认具有正常权限,比如执行脚本、提交表单、弹出窗口等。如果嵌入的网页是其他网站的页面,你不了解对方会执行什么操作,因此就存在安全风险。

  1. sandbox属性

  • allow-forms:允许提交表单。

  • allow-modals:允许提示框,即允许执行window.alert()等会产生弹出提示框的 JavaScript 方法。

  • allow-popups:允许嵌入的网页使用window.open()方法弹出窗口。

  • allow-popups-to-escape-sandbox:允许弹出窗口不受沙箱的限制。

  • allow-orientation-lock:允许嵌入的网页用脚本锁定屏幕的方向,即横屏或竖屏。

  • allow-pointer-lock:允许嵌入的网页使用 Pointer Lock API,锁定鼠标的移动。

  • allow-presentation:允许嵌入的网页使用 Presentation API。

  • allow-same-origin:不打开该项限制,将使得所有加载的网页都视为跨域。

  • allow-scripts:允许嵌入的网页运行脚本(但不创建弹出窗口)。

  • allow-storage-access-by-user-activation:sandbox属性同时设置了这个值和allow-same-origin的情况下,允许<iframe>嵌入的第三方网页通过用户发起document.requestStorageAccess()请求,经由 Storage Access API 访问父窗口的 Cookie。

  • allow-top-navigation:允许嵌入的网页对顶级窗口进行导航。

  • allow-top-navigation-by-user-activation:允许嵌入的网页对顶级窗口进行导航,但必须由用户激活。

  • allow-downloads-without-user-activation:允许在没有用户激活的情况下,嵌入的网页启动下载。

三、referer(请求头包含了当前请求页面的来源页面的地址)

referrer-policy:其作用是为了控制请求头中的referrer的内容

  1. no-referrer

整个referee首部会被移除,访问来源信息不随着请求一起发送。

  1. no-referrer-when-downgrade

在没有指定任何策略的情况下用户代理的默认行为。在同等安全级别的情况下,引用页面的地址会被发送(HTTPS->HTTPS),但是在降级的情况下不会被发送 (HTTPS->HTTP).

  1. origin

在任何情况下,仅发送文件的源作为引用地址。例如 https://example.com/page.html 会将 https://example.com/ 作为引用地址。

  1. origin-when-cross-origin

对于同源的请求,会发送完整的URL作为引用地址,但是对于非同源请求仅发送文件的源。

  1. same-origin

对于同源的请求会发送引用地址,但是对于非同源请求则不发送引用地址信息。

6 .strict-origin

在同等安全级别的情况下,发送文件的源作为引用地址(HTTPS->HTTPS),但是在降级的情况下不会

发送 (HTTPS->HTTP)。

  1. strict-origin-when-cross-origin

对于同源的请求,会发送完整的URL作为引用地址;在同等安全级别的情况下,发送文件的源作为引

用地址(HTTPS->HTTPS);在降级的情况下不发送此首部 (HTTPS->HTTP)。

  1. unsafe-url

无论是同源请求还是非同源请求,都发送完整的 URL(移除参数信息之后)作为引用地址。(最不安全了)

四、防盗链

  1. 防盗链的工作原理

通过Referer或者签名,网站可以检测目标网页访问的来源网页,如果是资源文件,则可以追踪到显示

它的网页地址 一旦检测到来源不是本站,即进行阻止或者返回指定的页面

  1. 如何绕过图片的防盗链(无referer信息)

(1) 方案一(strict-origin-when-cross-origin下的同源降级

(HTTPS->HTTP))

此实验需要在浏览器较低的版本实现,最新版本浏览器会自动拒绝同源降级

  1. 先利用openssl生成自签名证书

(https://github.com/zxl925768661/Blog/tree/main/HTTP%E7%9B%B8%E5%85%B3/Demos/referer/demo03))

安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
  1. 客户端的js

let https = require("https");
let fs = require("fs");
let url = require("url");
let path = require("path");


var options = {
  hostname: "localhost",
  port: 8000,
  path: "/",
  method: "GET",
  rejectUnauthorized: false,
  key: fs.readFileSync("./keys/client.key"),
  cert: fs.readFileSync("./keys/client.crt"),
  ca: [fs.readFileSync("../ca/ca.crt")],
};

// 创建服务器
https.createServer(options, function (req, res) {

  let staticPath = path.join(__dirname, "src");
  let pathObj = url.parse(req.url, true);

  if (pathObj.pathname === "/") {
    pathObj.pathname += "index.html";
  }
  //  读取静态目录里面的文件,然后发送出去
  let filePath = path.join(staticPath, pathObj.pathname);
  fs.readFile(filePath, "binary", function (err, content) {
    if (err) {
      res.writeHead(404, "Not Found");
      res.end("<h1>404 Not Found</h1>");
    } else {
      res.writeHead(200, "OK");
      res.write(content, "binary");
      res.end();
    }
  });

}).listen(8080);
安全基础第二天:http的header和referrer

客户端的html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>client</title>
</head>
<body>
    <h1>client页面</h1>
    <div id="container">
        <!-- <img src="https://localhost:8000/" referrerpolicy="no-referrer"> -->
        <img src="http://192.168.192.128:9090">
    </div>
    <!-- <script src="js/fetchImg.js"></script> -->
</body>
</html>
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
  1. 服务端的js

et https = require("https");
let fs = require("fs");
let url = require("url");
let path = require("path");
// 白名单
const whiteList = ["192.168.191.128:8080"];  //我们客户端请求的

const options = {
  key: fs.readFileSync("./keys/server.key"),
  cert: fs.readFileSync("./keys/server.crt"),
};


https
  .createServer(options, function (req, res) {

    let refer = req.headers["referer"] || req.headers["refer"];
    console.log('refer----', refer, req.url);
    res.setHeader("Access-Control-Allow-Origin", "*");
    if (refer) {
      let referHostName = url.parse(refer, true).host;
      let currentHostName = url.parse(req.url, true).host;
      console.log(referHostName, currentHostName, '--==')
      // 当referer不为空, 但host未能命中目标网站且不在白名单内时, 返回错误的图
      if (
        referHostName != currentHostName &&
        whiteList.indexOf(referHostName) == -1
      ) {
        res.setHeader("Content-Type", "image/jpeg");
        fs.createReadStream(path.join(__dirname, "./src/img/403.jpg")).pipe(res);
        return;
      }
    }
    // 当referer为空时, 返回正确的图
    res.setHeader("Content-Type", "image/jpeg");
    fs.createReadStream(path.join(__dirname, "./src/img/1.jpg")).pipe(res);

  }).listen(9090);
安全基础第二天:http的header和referrer
  1. node client.js和node server.js

安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer
  1. 浏览器访问:https://192.168.191.128:8080

  1. 成功为

安全基础第二天:http的header和referrer

(2)方案二(设置meta标签)

头部加入<meta name="referrer" content="no-referrer">属性

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="referrer" content="no-referrer">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAsJCQcJCQcJCQkJCwkJCQkJCQsJCwsMCwsLDA0QDBEODQ4MEhkSJRodJR0ZHxwpKRYlNzU2GioyPi0pMBk7IRP/2wBDAQcICAsJCxULCxUsHRkdLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCz/wAARCAEHAQcDASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAECAwYHBQT/xABREAABAwEEBQUIDAwFBQEAAAABAAIDBAURElEGITFBcRNhgaGzByI1NnJ1kbIVMjRSVWJzdJSxtMEUFyMzQkNUgpLR0tNTk6LC8BZEY2Th8f/EABsBAQACAwEBAAAAAAAAAAAAAAAFBgEDBAIH/8QANxEAAgECBAIGCQMEAwAAAAAAAAECAwQFESExEmETQVFxsdEGFCI0gZGhweEyM0IVNfDxQ1Jj/9oADAMBAAIRAxEAPwDqxJv2naovdmUO08UQC92ZS92ZREAvdmUvdmURAL3ZlL3ZlEQC92ZS92ZREAvdmUvdmVClAL3ZlL3ZlQpQC92ZS92ZREAvdmUvdmVClAL3ZlL3ZlEQC92ZS92ZUKUAvdmUvdmVClAL3ZlL3ZlEQC92ZS92ZREAvdmUvdmURAL3ZlL3ZlEQC92ZREQA7TxRDtPFEAREQBERAEREARFCAKVCIApUKUARQiAKVCICUUKUBClQiAKVCICUREAREQBERAEREAREQA7TxRDtPFEAREQBERAFIa47OtXDANusqyApyfOmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFMAzPUmAZnqV0QFCzI+lVLSNyyogMClXczePQqIAiIgCIiAIiIAdp4oh2ni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hdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SIiA//9k=" alt="">
</body>
</html>
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer

(3) 方案三(设置referrerpolicy="no-referrer")

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- <meta name="referrer" content="no-referrer"> -->
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img  referrerpolicy="no-referrer" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAsJCQcJCQcJCQkJCwkJCQkJCQsJCwsMCwsLDA0QDBEODQ4MEhkSJRodJR0ZHxwpKRYlNzU2GioyPi0pMBk7IRP/2wBDAQcICAsJCxULCxUsHRkdLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCz/wAARCAEHAQcDASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAECAwYHBQT/xABREAABAwEEBQUIDAwFBQEAAAABAAIDBAURElEGITFBcRNhgaGzByI1NnJ1kbIVMjRSVWJzdJSxtMEUFyMzQkNUgpLR0tNTk6LC8BZEY2Th8f/EABsBAQACAwEBAAAAAAAAAAAAAAAFBgEDBAIH/8QANxEAAgECBAIGCQMEAwAAAAAAAAECAwQFESExEmETQVFxsdEGFCI0gZGhweEyM0IVNfDxQ1Jj/9oADAMBAAIRAxEAPwDqxJv2naovdmUO08UQC92ZS92ZREAvdmUvdmURAL3ZlL3ZlEQC92ZS92ZREAvdmUvdmVClAL3ZlL3ZlQpQC92ZS92ZREAvdmUvdmVClAL3ZlL3ZlEQC92ZS92ZUKUAvdmUvdmVClAL3ZlL3ZlEQC92ZS92ZREAvdmUvdmURAL3ZlL3ZlEQC92ZREQA7TxRDtPFEAREQBERAEREARFC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j5kx8yxqUBfHzJj5lREBfHzJj5ljUoC+PmTHzLGpQFsbsgqkk7SiIAiIgCIiAIiIAiIgB2niiHaeKIAiIgCIiAIiIAiIgIUoiAhSiIAiIgIUoiAIiICFKIgIUoiAIiIAiIgCIiAIiIAiIgJLSSmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SYXZIiAYXZJhdkiIBhdkmF2SIgGF2SIiA//9k=" alt="" >
</body>
</html>
安全基础第二天:http的header和referrer
安全基础第二天:http的header和referrer

(4) 方案四(XMLHttpRequest中setRequestHeader方法)

1.非同源情况下

// 通过ajax下载图片
function loadImage(uri) {
return new Promise(resolve => {
let xhr = new XMLHttpRequest();
xhr.responseType = "blob";
xhr.onload = function() {
resolve(xhr.response);
};


xhr.open("GET", uri, true);
// 通过setRequestHeader设置header不会生效
// 会提示 Refused to set unsafe header "Referer"
xhr.setRequestHeader("Referer", "");
xhr.send();
});
}



// 将下载下来的二进制大对象数据转换成base64,然后展示在页面上
function handleBlob(blob) {
let reader = new FileReader();
reader.onload = function(evt) {
let img = document.createElement('img');
img.src = evt.target.result;
document.getElementById('container').appendChild(img)
};
reader.readAsDataURL(blob);
}


const imgSrc = " https://tiebapic.baidu.com/forum/w%3D580%3B/sign=f88eb0f2cf82b9013dadc33b43b6ab77/562c11dfa9ec8a135455cc35b203918fa1ecc09c.jpg";


loadImage(imgSrc).then(blob => {
handleBlob(blob);
});
安全基础第二天:http的header和referrer

首先依旧是把百度贴吧的图片放在我们src中,之后把图片地址传递给loadimage这个函数,之后通过ajex把图片下下来,用到了promise异步下载,当下载成功调用resolve,下载失败调用的是reject,成功调用httprequest去请求url也就是百度图吧的图片,之后通过设置requestheade的referrer为空去限制,之后通过onload函数监听,把监听的结果返回给我们的resolve,resolve函数会把结果返回给.then(blob),其实reslove函数就是一个回调函数,之后把结果传递给handleBlob(blob)这个函数,这个函数建立了一个FileReader()对象,这个对象有一个监听的函数,并且还重建了一个img标签,最终把src从事件中拿了出来,把它放入到了container里面了,最后访问(不成功的原因在于我们的浏览器有些保留字段的设置,恰巧referer就是其中之一,所以就不让了)另外最终的图片是利用base64编码表示的,利用的接口函数就是readAsDataURL(blob)这个函数,在同源下是可以的

2.同源情况下

// 通过ajax下载图片
function loadImage(uri) {
    return new Promise(resolve => {
        let xhr = new XMLHttpRequest();
        xhr.responseType = "blob";
        xhr.onload = function() {
            resolve(xhr.response);
        };

        xhr.open("GET", uri, true);
        // 通过setRequestHeader设置header不会生效
        // 会提示 Refused to set unsafe header "Referer"
        xhr.setRequestHeader("Referrer", ""); 
        xhr.send();
    });
}
  

// 将下载下来的二进制大对象数据转换成base64,然后展示在页面上
function handleBlob(blob) {
    let reader = new FileReader();
    reader.onload = function(evt) {
        let img = document.createElement('img');
        img.src = evt.target.result;
        document.getElementById('tupian').appendChild(img)
    };
    reader.readAsDataURL(blob);
}

const imgSrc = "http://127.0.0.1/3/1.jpg";

loadImage(imgSrc).then(blob => {
    handleBlob(blob);
});
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- <meta name="referrer" content="no-referrer"> -->
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="tupian">aaaa</div>
</body>
<script src="./test.js"></script>
</html>
安全基础第二天:http的header和referrer

五、Burp Suite抓包工具

POST /2/a.php HTTP/1.1
Host: 10.4.136.247
Content-Length: 325
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1 Origin: http://10.4.136.247
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary5DaoJrBa0XD8Zxld
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://10.4.136.247/2/a.html
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
------WebKitFormBoundary5DaoJrBa0XD8Zxld
Content-Disposition: form-data; name="submit-name"
admin
------WebKitFormBoundary5DaoJrBa0XD8Zxld
Content-Disposition: form-data; name="files"; filename="1.php"
Content-Type: application/octet-stream
<?php
var_dump["$username"]
------WebKitFormBoundary5DaoJrBa0XD8Zxld--
  1. POST /2/a.php HTTP/1.1

提交的方法是post,提交的地址是/2/a.php,利用的http协议是1.1

  1. Host: 10.4.136.247

请求的地址

  1. Content-Length: 325

请求的长度为325

  1. Cache-Control: max-age=0

缓存,无缓存

  1. Upgrade-Insecure-Requests: 1 Origin: http://10.4.136.247

来源地址

  1. Content-Type: multipart/form-data; boundary=----WebKitFormBoundary5DaoJrBa0XD8Zxld

文件的类型是form-data

  1. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

浏览器的内核版本

  1. Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

支持的文件类型

  1. Referer: http://10.4.136.247/2/a.htmlAc cept-Encoding: gzip, deflate

referer请求访问的文件目录

  1. Accept-Language: zh-CN,zh;q=0.9

语言

  1. Connection: close
------WebKitFormBoundary5DaoJrBa0XD8Zxld
Content-Disposition: form-data; name="submit-name"

前端传输的名字,后端抓取的名字

  1. admin

------WebKitFormBoundary5DaoJrBa0XD8Zxld

抓取的名字是admin

  1. Content-Disposition: form-data; name="files"; filename="1.php"

抓取的是文件files,文件是1.php

  1. Content-Type: application/octet-stream

文件类型

  1. <?php
var_dump["$username"]

抓取的内容<?php var_dump["$username"]

六、cookies和session

存在客户端和服务端,当我们的用户去访问一个浏览器,我们需要注册账号和密码,当我们注册成功后,我们的服务器会将我们用户数据存储到数据库,数据库生成一个session文件,并将其返回给我们的客户端,我们客户端会将这个文件存储在我们的cookie中,当我们再次去登录服务器的时候,我们的服务器会将我们的cookie的值和我们的服务器的session值进行对比,如果相同就可以登陆,所以我们黑客常见的是想办法去盗取我们客户端的cookie。

七、同源和跨域

同源:协议相同、host相同、端口相同文章来源地址https://www.toymoban.com/news/detail-468368.html

到了这里,关于安全基础第二天:http的header和referrer的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 关于允许TRACE方法,HTTP X-XSS-Protection缺失,HTTP Content-Security-Policy缺失,X-Frame-Options Header未配置安全处理方法

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 基于Apache Web服务器对一下发现的安全问题进行配置处理,包含允许TRACE方法,HTTP X-XSS-Protection缺失,HTTP Content-Security-Policy缺失,X-Frame-Options Header未配置,HTTP X-Download-Options缺失,HTTP X-Content-Type-Options缺失,HTTP

    2024年02月07日
    浏览(41)
  • 【HTTP】1. http的相关的基础概念

    对器客户端和 服务器端之间数据传输的格式规范,格式简称为“超文本传输协议”。 (1)、无状态协议对于事务处理没有记忆能力。缺少状态意味着如果后续处理需要前面的信息 (2)、无状态协议解决办法: 通过1、Cookie 2、通过Session会话保存。 cookies机制和session机制的区别:

    2024年04月10日
    浏览(26)
  • 安全基础 --- 编码(02)+ form表单实现交互

    (1)php 用php文件接收 运行结果: (2)nodejs 我们使用linux虚拟机实现交互:创建新目录,使用 npm init 创建 package.json 包 下载express库 修改package.json包 web-express目录下创建web-express.js文件 直接运行web-express.js文件 web界面运行form表单与nodejs交互 (3)python 下载Flask模块 创建 12

    2024年02月14日
    浏览(30)
  • 网络编程 http 相关基础概念

    HTTP表单是一种用于在Web应用程序中收集用户输入数据的机制。它由HTML表单元素和HTTP请求组成。 HTML表单元素(如、、等)用于创建用户界面,让用户输入数据。用户可以在表单中填写文本、选择选项、上传文件等。 当用户提交表单时,浏览器会将表单数据封装在HTTP请求中,

    2024年02月11日
    浏览(40)
  • Java基础八 - HTTP相关/Cookie/Session/网络攻击

    一、 反射/序列化/拷贝 1. 反射 2. 序列化 3. 动态代理 4. 深拷贝和浅拷贝 1. Session与Cookie 2. 如何避免sql注入 3. XSS(跨站脚本攻击) 4.  CSRF( 跨站网站攻击 )  1. 301与302 redirect(重定向) 2.  forward 和 redirect 的区别 3. tcp和udp 4. OSI 的七层模型 5. HTTP常见状态码 6. HTTP HTTPS区别 7. HTTPS传

    2024年02月11日
    浏览(31)
  • 什么是HTTP头部(HTTP headers)?

    前端入门之旅:探索Web开发的奇妙世界 欢迎来到前端入门之旅!感兴趣的可以订阅本专栏哦!这个专栏是为那些对Web开发感兴趣、刚刚踏入前端领域的朋友们量身打造的。无论你是完全的新手还是有一些基础的开发者,这里都将为你提供一个系统而又亲切的学习平台。在这个

    2024年02月07日
    浏览(39)
  • Spring Security 6.x 系列【46】漏洞防护篇之安全相关的HTTP响应头

    有道无术,术尚可求,有术无道,止于术。 本系列Spring Boot 版本 3.0.4 本系列Spring Security 版本 6.0.2 源码地址:https://gitee.com/pearl-organization/study-spring-security-demo

    2024年02月07日
    浏览(41)
  • HTTP Header 参数详解

    关于HTTP消息头 HTTP消息头是在,客户端请求(Request)或服务器响应(Response)时传递的,位请求或响应的第一行,HTTP消息体(请求或响应的内容)是其后传输。HTTP消息头,以明文的字符串格式传送,是以冒号分隔的键/值对,如:Accept-Charset: utf-8,每一个消息头最后以回车符

    2024年04月23日
    浏览(27)
  • piakchu-‘http header’注入

    http消息头 是指,在超文本传输协议( Hypertext Transfer Protocol ,HTTP)的请求和响应消息中,协议头部分的那些组件。 http header 头信息可以获取客户端的一些信息,比如useragent、accept等字段,而且http消息头支持自定义。 首先打开pikachu靶机, 我们先根据提示使用admin 123456 来登

    2023年04月11日
    浏览(27)
  • http请求头部(header)详解

    通常HTTP消息包括客户机向服务器的请求消息和服务器向客户机的响应消息。这两种类型的消息由一个起始行,一个或者多个头域,一个只是头域结束的空行和可 选的消息体组成。HTTP的头域包括通用头,请求头,响应头和实体头四个部分。每个头域由一个域名,冒号(:)和域

    2024年02月12日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包