当前位置:网站首页>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)
#################分界线###################
边栏推荐
- 【leetcode】33. Search rotation sort array
- flink 提交程序
- Pytest-- test report allure configuration
- Blender stone carving
- Flink实时计算topN热榜
- Determine whether there are duplicate elements in the array
- Unreal material editor foundation - how to connect a basic material
- 测试--面试题总结
- Stm32 et développement de moteurs (système supérieur)
- 01-spooldir
猜你喜欢
![[unity3d] nested use layout group to make scroll view with dynamic sub object height](/img/b2/edab4ab48e1401934dcce7218df662.png)
[unity3d] nested use layout group to make scroll view with dynamic sub object height

Operator-1初识Operator

Solutions to a series of problems in sqoop job creation

How to get the password of cpolar?

allure--常用配置项

VLAN experiment

Blender模型导入ue、碰撞设置

Blender model import UE, collision settings

STM32 and motor development (upper system)

SPSS做Shapiro-Wilk正态分析
随机推荐
4.随机变量
Message mechanism -- getting to know messages and message queues for the first time
测试--面试题总结
ERROR 1118 (42000): Row size too large (> 8126)
Test -- Summary of interview questions
【Unity3D】无法正确获取RectTransform的属性值导致计算出错
flume 190 INSTALL
[IDL] Research
07 data import sqoop
Shapiro Wilk normal analysis by SPSS
Pytest-- test report allure configuration
What is the significance of the college entrance examination
合并有序数列
Transport Optimization abstraction
传输优化抽象
Blender ocean production
01安装虚拟机
Blender volume fog
SAP Spartacus express checkout design
Importing tables from sqoop