實驗吧CTF題庫-編程(部分)


  • 百米

3秒提交答案,數字是隨機變化的

利用Python腳本解題

# -*- coding:utf-8 -*-
__author__ = "MuT6 Sch01aR"

import requests
from bs4 import BeautifulSoup
import sys,io

url = "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_encoding

soup1 = 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-186
b = 186
c = 0
while 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM