当前位置:网站首页>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)
#################分界线###################
边栏推荐
猜你喜欢
Blender海洋制作
[Fantasy 4] introduction and use of UMG components (under update...)
SAP Spartacus express checkout design
【MySQL】连接MySQL时出现异常:Connection must be valid and open
快速做出原型
"Matching" is true love, a new attitude for young people to make friends
webUI自动化学习
Vscode set JSON file to format automatically after saving
Basic usage of mock server
[visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
随机推荐
[unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
虚幻材质编辑器基础——如何连接一个最基本的材质
Test -- Summary of interview questions
Shutter - canvas custom graph
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
The primary market project galaxy will conduct public offering on coinlist on February 17
Sum the two numbers to find the target value
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
Flutter——Canvas自定义曲线图
Network communication learning
Use WinDbg to statically analyze dump files (summary of practical experience)
AutoCAD - layer Linetype
网络通信学习
"Matching" is true love, a new attitude for young people to make friends
Pytest-- test report allure configuration
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
01-spooldir
Mock Server基本使用方法
SAP Spartacus express checkout design
Determine whether there are duplicate elements in the array