CTF-web 快速计算

管理员 2020-06-17 PM 591℃ 1条

题目描述:

快速口算分值: 350小明要参加一个高技能比赛,要求每个人都要能够快速口算四则运算,2秒钟之内就能够得到结果,但是小明就是一个小学生没有经过特殊的培训,那小明能否通过快速口算测验呢?

平台题目地址

做题地址

这个无论是直接手算或者发送到BURP上都不能完成,所以我写了个py脚本,可以一键拿key

import requests
from lxml import etree

"""发送请求包,获取式子和cookie"""
r = requests.get("http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php")
html = etree.HTML(r.text)   # 转为 lxml对象进行xpath解析
r.encoding = r.apparent_encoding
formula = str(html.xpath("/html/body/form/text()[2]")[0]).strip()[:-1]    # 获取式子,转为字符串对象
formula = eval(formula)    # 计算答案
cookie = r.headers['Set-Cookie'].split(";")[0]     # 截取服务器给的cookie

"""自定义cookie发送post包"""
headers = {'Cookie':cookie, 'Content-Type':'application/x-www-form-urlencoded'}   # 自定义header头
data = "v={}".format(str(formula))   # 要发送的post主体
p = requests.post("http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php", data = data, headers =headers)
p.encoding = p.apparent_encoding
html = etree.HTML(p.text)
print(html.xpath("//body/text()")[0])   # 打印出key

拿下key

标签: web

非特殊说明,本博所有文章均为博主原创。

评论啦~



唉呀 ~ 仅有一条评论


  1. 1
    1

    1

    回复 2024-02-16 22:20