当前位置:网站首页>网络安全——XSS之被我们忽视的Cookie
网络安全——XSS之被我们忽视的Cookie
2022-08-10 12:49:00 【InfoQ】
1.1 XSS 跨站脚本攻击介绍

1.2 XSS 跨站脚本攻击分类
1.3 Cookie 概述
(1、Cookie 概述:
(2、使用JavaScript 创建Cookie
(3、使用JavaScript读取Cookie
(4、使用JavaScript 修改Cookie
(5、Cookie字符串
(6、JavaScript Cookie 实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>js_cookie 实例</title>
</head>
<head>
<script>
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function checkCookie() {
var user = getCookie("username");
if (user != "") {
alert("欢迎 " + user + " 再次访问");
} else {
user = prompt("请输入你的名字:", "");
if (user != "" && user != null) {
setCookie("username", user, 30);
}
}
}
</script>
</head>
<body onload="checkCookie()"></body>
</html>

(7、Cookie的安全问题
- 1.Cookie欺骗
- 2.Flash的代码隐患
边栏推荐
- Calculate the number of combinations recursively
- A can make large data clustering method of 2000 times faster, don't poke
- 金山云要飘到哪里?
- Loudi Center for Disease Control and Prevention Laboratory Design Concept Description
- LeetCode中等题之搜索二维矩阵
- ABAP 里文件操作涉及到中文字符集的问题和解决方案试读版
- 表中存在多个索引问题? - 聚集索引,回表,覆盖索引
- 浙大、阿里提出DictBERT,字典描述知识增强的预训练语言模型
- 娄底植物细胞实验室建设基本组成要点
- 11+ chrome高级调试技巧,学会效率直接提升666%
猜你喜欢
![ArcMAP has a problem of -15 and cannot be accessed [Provide your license server administrator with the following information:Err-15]](/img/da/b49d7ba845c351cefc4efc174de995.png)
ArcMAP has a problem of -15 and cannot be accessed [Provide your license server administrator with the following information:Err-15]

九宫格抽奖动效

Short read or OOM loading DB. Unrecoverable error, aborting now

关于flask中static_folder 和 static_url_path参数理解

Keithley DMM7510精准测量超低功耗设备各种运作模式功耗

2022 Recruitment Notice for Academician Zhao Guoping Group of Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences

燃炸!字节跳动成功上岸,只因刷爆LeetCode算法面试题

没有接班人,格力只剩“明珠精选”

Comparison version number of middle questions in LeetCode

【百度统计】用户行为分析
随机推荐
Reversing words in a string in LeetCode
Codeforces Round #276 (Div. 1) D. Kindergarten
Guidelines for Sending Overseas Mail (2)
bgp dual plane experiment routing strategy to control traffic
在web页面播放rtsp流视频(webrtc)
Codeforces Round #276 (Div. 1) B. Maximum Value
C# error The 'xmins' attribute is not supported in this context
需要被记录的OpenStack相关的命令_自己用
3DS MAX batch export file script MAXScript with interface
Twikoo腾讯云函数部署转移到私有部署
NodeJs原理 - Stream(二)
Interface Automation Testing Basics
YTU 2295: KMP模式匹配 一(串)
LeetCode·每日一题·640.求解方程·模拟构造
Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
R语言实战应用案例:论文篇(一)-特殊柱形图绘制
iTextSharp 使用详解
海外邮件发送指南(二)
神了!阿里数据库专家纯手写了这份604页的Oracle+MySQL攻坚指南
CodeForces-834C