jsp演示http通信,wireshark抓通信报文,重定向/转发 cookie

重定向报文

 

转发报文

iframe报文

 修改window报文

 cookie(打开浏览器访问)

set-cookie

 刷新后看cookie

 window.location.href或http://127.0.0.1/web看cookie

 

 

 cookie【iframe/window.location.href】

 

 

 

 

演示文件

setprivi.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
     <%
        String  userid=request.getParameter("userid");
        if("zj".equals(userid)
        		|| "czh".equals(userid)
        		|| "100".equals(userid)
        		){
        	session.setAttribute("user", userid);
        	out.print("模拟学生/普通用户登录成功");
        	
        }else
        {
        	session.setAttribute("user", null);
        	out.print("模拟学生/普通用户登录失败");        	
        }
        	
        
      Cookie cookies[]=  request.getCookies() ;
      for(Cookie c:cookies)
    	  out.print(c.getName()+":"+c.getValue()+":"+c.getDomain());
     
     
     
     %>
    

</body>
</html>

testprivi.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<script type="text/javascript">
	var user = "${sessionScope.user}";
	var admin = "${sessionScope.admin}";
	function del(userid) {
		if (admin.length != 0 || user.length != 0) {
			if (admin.length != 0) {
				return confirm("确定要删除吗?");
			}
			if (user.length != 0) {
				if (user != userid) {
					alert("普通用户不能删除非本人信息");
					return false;
				}
				return confirm("确定要删除吗?");
			}
		} else {
			alert("请先登录");
			return false;
		}
	}
</script>

</head>
<body>
<a href="javascript:alert('执行删除操作。。。。')" 
                onclick="return del(100)">删除学生或老师信息</a>

</body>
</html>

   演示效果

 

 抓包wireshark

请求操作

请求报文

TCP层信息

双方端口共4个字节

 

 

 回应信息

追踪http流

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值