当前位置:网站首页>2.hacking-lab脚本关[详细writeup]
2.hacking-lab脚本关[详细writeup]
2022-07-02 06:50:00 【qwsn】

二、脚本关
1.key又又找不到了
分值:200
提示:
小明这次哭了,key又找不到了!!! key啊,你究竟藏到了哪里,为什么我看到的页面上都没有啊!!!!!!
通关地址
解题步骤:
第一步:访问通过地址,发现了一个a标签超链接,查看html源码后发现跳转的目的是search_key.php。


第二步:点击超链接,研究回显的内容,以及网络监测。

第三步:通过BurpSuite拦截,我们发现search_key.php页面使用了windows.location="./no_key_is_here_forever.php"从而跳转页面。同时发现了真正的key值。

第四步:python脚本直接获取key值
# coding=utf-8
# 引入requests库
import requests
# 设置待访问的目标url地址。
url='http://lab1.xseclab.com/xss1_30ac8668cd453e7e387c76b132b140bb/search_key.php';
# 实例化一个名为http的requests库的session类的对象,用于保持持久回话。
http = requests.Session();
# 以get形式访问目标url,同时不允许重定向,默认也是不允许的。
response = http.get(url, allow_redirects = False);
# 设置请求返回的页面结果编码为utf-8
response.encoding = 'utf-8';
# 打印输出返回的页面结果
print(response.text);
# 打印输出状态码
print(response.status_code);

做题总结:
(1)js的window.location方法-属性描述:
assign() 导航到一个新页面
reload() 强制从服务器重新加载当前页面
replace() 使用新的url替换本页面
(2)以下两种方法的效果等同:都是跳转到一个指定的页面。
方法1:window.location.assign("https://clqwsn.blog.csdn.net/");
方法2:window.location = "https://clqwsn.blog.csdn.net/";
(3)session会话:
requests库的session会话对象可以跨请求保持某些参数,说白了,就是比如你使用session成功的登录了某个网站,则在再次使用该session对象去访问该网站的其他网页都会默认使用该session之前使用的cookie等参数。
因此requests.session()起到了维持会话的作用,通俗的说就是可以让我们在跨请求时保存某些参数。
(4)requests.get() 跟 request.session().get() 的异同点:
两个都是基于 sessions.Session 发送get请求的,区别仅在于前者请求完即刻断开连接(连接只用一次),后者需要手动断开连接(连接可以反复用)。
(5)两种get请求的语法如下所示:
#########################################
# 1.requests直接发起get请求。
response = requests.get(url)
response.encoding='utf-8'
print(response.text)
#################分界线###################
# 2.先创建一个session对象,后发起get请求。
http = requests.Session()
response = http.get(url)
response.encoding='utf-8'
print(response.text)
#################分界线###################
边栏推荐
- Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
- Edge computing accelerates live video scenes: clearer, smoother, and more real-time
- SQOOP 1.4.6 INSTALL
- 【MySQL】连接MySQL时出现异常:Connection must be valid and open
- 数据库字典Navicat自动生成版本
- 【Lua】常见知识点汇总(包含常见面试考点)
- Test -- Summary of interview questions
- STM32 and motor development (upper system)
- Zlib download and use
- Stm32 et développement de moteurs (système supérieur)
猜你喜欢

Considerations for Apache deploying static web page projects

Blender camera surround motion, animation rendering, video synthesis

07数据导入Sqoop

Flink calculates topn hot list in real time

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer

互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书

Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?

Mock Server基本使用方法

2021-10-04

Operator-1初识Operator
随机推荐
Pytest-- test report allure configuration
VLAN experiment
Ks009 implement pet management system based on SSH
《MySQL 8 DBA基础教程》简介
01安装虚拟机
Commutateur Multi - lentilles Blender
Introduction and Principle notes of UE4 material
【虚幻4】UMG组件的简介与使用(更新中...)
【Lua】常见知识点汇总(包含常见面试考点)
使用Windbg静态分析dump文件(实战经验总结)
测试--面试题总结
flume 190 INSTALL
【MySQL】连接MySQL时出现异常:Connection must be valid and open
shell编程01_Shell基础
VLAN experiment
How to judge the quality of primary market projects when the market is depressed?
Sum the two numbers to find the target value
Message mechanism -- getting to know messages and message queues for the first time
两数之和,求目标值
session-cookie与token