码迷,mamicode.com
首页 > 其他好文 > 详细

MOCTF-火眼金睛

时间:2018-12-22 11:34:03      阅读:363      评论:0      收藏:0      [点我收藏+]

标签:输入   class   moc   bs4   answer   题目   pos   beautiful   爬虫   

MOCTF-火眼金睛

http://119.23.73.3:5001/web10/

把这个题目当作python爬虫来练习。

首先要获取到文本框里面的全部信息,

import requests
import re
from bs4 import BeautifulSoup
url="http://119.23.73.3:5001/web10/"
res=requests.get(url)
bf=BeautifulSoup(res.text,"lxml")#用beautiful soup来解析
moctf=bf.find_all("textarea")#获取 textarea 标签的值
moctf_list=re.findall("moctf",str(moctf))#一个list,全部是"moctf"

url=url="http://119.23.73.3:5001/web10/work.php"#审查元素可以看到,work.php接受一个name为"answer"的输入框提交类型为post的值
res2=requests.post(url=url,data={"answer":len(moctf_list)},cookies=res.cookies) #这里必须有cookie,不然不知道你提交的是哪一次
print(res2.text)

MOCTF-火眼金睛

标签:输入   class   moc   bs4   answer   题目   pos   beautiful   爬虫   

原文地址:https://www.cnblogs.com/zaqzzz/p/10159939.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!