zoukankan      html  css  js  c++  java
  • 实验吧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

  • 相关阅读:
    C平衡二叉树(AVL)创建和删除
    C格式字符串转为二叉树
    C前序遍历二叉树Morris Traversal算法
    C单链表操作
    C仿黑白棋版XO棋
    C传递参数给main函数
    C图形化第一步
    Perl看完这个,再不敢说自己会玩贪吃蛇
    Perl寻路A*算法实现
    C字符贪吃蛇
  • 原文地址:https://www.cnblogs.com/sch01ar/p/8206929.html
Copyright © 2011-2022 走看看