当前位置:网站首页>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)
#################分界线###################
边栏推荐
- Deep understanding of redis cache avalanche / cache breakdown / cache penetration
- Rapid prototyping
- [unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
- Shapiro Wilk normal analysis by SPSS
- 02-taildir source
- AutoCAD - layer Linetype
- Postman--使用
- VLAN experiment
- 高考的意义是什么
- MongoDB-快速上手MongoDB命令行的一些简单操作
猜你喜欢

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

Database dictionary Navicat automatic generation version

Blender海洋制作

Introduction and Principle notes of UE4 material

SAP Spartacus express checkout design

sqoop创建job出现的一系列问题解决方法

Determine whether there are duplicate elements in the array

Post disaster reconstruction -- Floyd thought

Stm32 et développement de moteurs (système supérieur)

Test -- Summary of interview questions
随机推荐
07 data import sqoop
[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open
Windows环境MySQL8忘记密码文件解决方案
判断数组中是否存在重复元素
pytest学习--base
Lunix reallocates root and home space memory
Unreal material editor foundation - how to connect a basic material
虚幻材质编辑器基础——如何连接一个最基本的材质
Introduction and Principle notes of UE4 material
flink 提交程序
[unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
2.14 is it Valentine's day or Valentine's day when the mainstream market continues to fluctuate and wait for changes?
"Matching" is true love, a new attitude for young people to make friends
01-spooldir
【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
12.进程同步与信号量
Basic notes of illusory AI blueprint (10000 words)
[tutorial] how to make the Helpviewer help document of VisualStudio run independently
[Fantasy 4] the transformation from U3D to UE4
Database dictionary Navicat automatic generation version