博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
实验吧CTF题库-编程(部分)
阅读量:2259 次
发布时间:2019-05-09

本文共 1187 字,大约阅读时间需要 3 分钟。

  • 百米

3秒提交答案,数字是随机变化的

利用Python脚本解题

# -*- coding:utf-8 -*-__author__ = "MuT6 Sch01aR"import requestsfrom bs4 import BeautifulSoupimport sys,iourl = "http://ctf5.shiyanbar.com/jia/index.php"url_check = "http://ctf5.shiyanbar.com/jia/index.php?action=check_pass"s = requests.session()respons = s.get(url)soup = BeautifulSoup(respons.text,features="html.parser")a = soup.find("div",attrs={"name":"my_expr"}).get_text()a = a.replace("x","*")response = s.post(url_check,data={"pass_key":eval(a)})response.encoding = response.apparent_encodingsoup1 = BeautifulSoup(response.text,features="html.parser")b = soup1.find("div",attrs={"id":"templatemo_content"})sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')print(b)

 运行,得到flag

  • 找素数

利用python脚本解题

# -*- coding:utf-8 -*-__author__ = "MuT6 Sch01aR"from math import *a = 367-186b = 186c = 0while True:    a += b    for i in range(2,int(sqrt(a))+1):        if a % i == 0:            break        else:            if i == int(sqrt(a)):                c += 1                if c == 151:                    print("CTF{",a,"}")                    break    if c == 151:        break

 运行,得到flag

 

转载于:https://www.cnblogs.com/sch01ar/p/8206929.html

你可能感兴趣的文章
解决从本地文件系统上传到HDFS时的权限问题
查看>>
.Net Core 3.0 gRPC部署问题解决
查看>>
PHP下ajax跨域的解决方案之CORS
查看>>
无法远程访问Mysql的解决方案
查看>>
【转】QT 串口QSerialPort + 解决接收数据不完整问题
查看>>
Jmeter安装出现Not able to find Java executable or version问题解决方案
查看>>
SSH登录很慢问题的解决
查看>>
Invalid byte tag in constant pool: 19 与 javax/el/ELManager问题解决
查看>>
解决Visual Code安装中文插件失败问题
查看>>
adb devices unauthorized解决方法
查看>>
MySQL遇到Deadlock found when trying to get lock,解决方案
查看>>
ImportError: No module named _ssl解决方法
查看>>
JS 使用html2canvas实现截图功能的问题记录和解决方案
查看>>
org.apache.hadoop.ipc.Client: Retrying connect to server异常的解决
查看>>
eclipse中解决/**/多行注释代码后,格式变乱的问题
查看>>
导出Excel出现“异常来自 HRESULT:0x800A03EC”错误的解决方法(已验证)
查看>>
IDEA——找不到或无法加载主类的一种暴力解决方法
查看>>
cmake 成功后, make 出现 No such file or directory 问题解决
查看>>
npm 安装出现 UNMET DEPENDENCY 的解决方案
查看>>
get/post时中文乱码问题的解决办法
查看>>