实验吧 编程类题

第一题:

#小猴子爱吃桃
count=1
days=10
for i in range(days):
    count=(count+1)*2
print('CTF{'+str(count)+'}')

第二题:百米

import requests
import re

'''
实验吧 编程类第二题。 百米
'''

url="http://ctf5.shiyanbar.com/jia"
session=requests.session()
response=session.get(url)

html=str(response.content)
keyword=re.compile(r'(.*?)
',re.S) item=re.findall(keyword, html) result=item[0].replace("x","*") pattern=eval(result) rehtml=session.post("http://ctf5.shiyanbar.com/jia/index.php?action=check_pass",data={'pass_key':pattern}) lisa=['key','flag','KEY','Flag','Key','FLAG'] for x in lisa: if x in str(rehtml.text): res=re.search(x,str(rehtml.text)).span() print("Maybe find flag ok") print(str(hh.text)[res[0]:int(res[-1])+8])

第三题 三洋献瑞

import itertools
for (a,b,c,d,e,f,g,h) in list(itertools.permutations('1234567890',8)):
    #if int(a+b+c+d)>1000 and int(b+e+f+g)>1000
    if int(a+b+c+d)+int(e+f+g+b)==int(e+f+c+b+h):
        if int(a+b+c+d)>1000 and int(e+f+g+b)>1000:
            print('CTF{'+e+f+g+b+'}')

你可能感兴趣的:(实验吧 编程类题)