美文网首页
实验吧 编程类题

实验吧 编程类题

作者: SevenBy | 来源:发表于2018-03-14 14:50 被阅读16967次

    第一题:

    #小猴子爱吃桃
    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'<div.*?my_expr.*?>(.*?)</div>',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+'}')
    

    相关文章

      网友评论

          本文标题:实验吧 编程类题

          本文链接:https://www.haomeiwen.com/subject/brufqftx.html