• BUU MISC 刷题记录 (一)


    [INSHack2019]gflag

    题目

    知识点:Gcode 3D打印命令

    *G0:快速移动
    *G1:控制移动  :   坐标轴XYZE移动控制(G0和G1一样),  例子:G0 F2000 X30 Y30 Z30 E3
    *G2:顺时针画弧
    *G3:逆时针画弧
    .....
    

    更多命令可以看:3D打印gcode命令大全及解析
    在线解析网站:https://ncviewer.com/
    把给出的代码贴进去,点一下plot:

    [INSHack2019]Crunchy

    题目

    def crunchy(n):
        if n < 2: return n
        return 6 * crunchy(n - 1) + crunchy(n - 2)
    
    g = 17665922529512695488143524113273224470194093921285273353477875204196603230641896039854934719468650093602325707751568
    
    print("Your flag is: INSA{%d}"%(crunchy(g)%100000007))
    

    解析

    直接运行是不能运行的,会报错(超过最大递归限度),需要把递归改写一下
    一种方法是用矩阵乘法来做:

    贴上大佬的脚本

    def matrix_multiply(mat_a, mat_b, n):
        a, b, c, d = mat_a
        x, y, z, w = mat_b
    
        return (
            (a * x + b * z) % n,
            (a * y + b * w) % n,
            (c * x + d * z) % n,
            (c * y + d * w) % n,
        )
    
    def matrix_power(A, m, mod):
        if m == 0:
            return [1, 0, 0, 1]
        elif m == 1:
            return A
        else:
            B = A
            n = 2
            while n <= m:
                B = matrix_multiply(B, B, mod)
                n = n*2
            R = matrix_power(A, m-n//2, mod)
            return matrix_multiply(B, R, mod)
    
    F1 = [6, 1,
          1, 0]
    
    g = 17665922529512695488143524113273224470194093921285273353477875204196603230641896039854934719468650093602325707751568
    
    print("INSA{%d}"%matrix_power(F1, g, 100000007)[1])
    

    [INSHack2018]42.tar.xz

    题目

    This file is very deep. Will you dare dig in it ?
    打开是42个压缩包,每层打开都有42个,盲猜要开42层,4242=1.5013093754529657235677197216425e+68,这个数量就很恐怖了,贴上我的垃圾脚本,跑了第一个压缩包磁盘直接爆炸

    import lzma
    import shutil
    import tarfile
    import os
    
    def unzx(filename):
        print(filename)
        inputs = lzma.open(filename)
        out = open(filename.split(".")[0]+".tar","wb")
        shutil.copyfileobj(inputs,out)
        out.close()
        inputs.close()
        os.remove(filename)
        
    
    def untar(filename):
        print(filename)
        tar = tarfile.open(filename)
        names = tar.getnames()
        if os.path.isdir(filename):
            pass
        else:
            os.mkdir(filename.split(".")[0]+"/")
        for name in names:
            tar.extract(name,filename.split(".")[0]+"/")
        tar.close()
        os.remove(filename)
    
    def unpack(dirs):
        #print(dirs)
       
        files = os.listdir(dirs)
        #print(files)
        for file in files:
            unzx(dirs+"/"+file)
            untar(dirs+"/"+file.split(".")[0]+".tar")
            unpack(dirs+"/"+file.split(".")[0])
    
    
    unpack("42")
    

    解压到最后一层每一个文件都有500+mb, 但是居然诡异地找到了flag,在
    uuctf-misc[INSHack2018]42.tar.xz mp421111111111111111111111111111111111111111111121flag


    大佬的bash脚本

    while [ "`find . -type f -name '*.tar.xz' | wc -l`" -gt 0 ]; do find -type f -name "*.tar.xz" -exec tar xf '{}' ; -exec rm -- '{}' ;; done;
    

    速度还比较快,而且没有爆磁盘

    [INSHack2018]Spreadshit

    用office条件格式,给所有的空格染色,调整一下单元格大小


    BUU上提交字母要都改成小写

    [INSHack2018]GCorp - Stage

    打开
    追踪tcp流量
    拉到最底下
    base64解码
    没了

    INSHack2018 so deep

    用Audacity查看了一下频谱,发现有点模糊的文字,看不清楚,用sonic visualiser查看,
    在Layer选项中点击Add Peak Frequency Spectrogram, 调整视图至清晰,发现是flag的前一半

    https://blog.csdn.net/qq_36618918/article/details/107912977
    用deep sound解密

  • 相关阅读:
    Solution -「ARC 101E」「AT 4352」Ribbons on Tree
    Solution -「CF 855G」Harry Vs Voldemort
    Solution -「CF 1119F」Niyaz and Small Degrees
    Solution -「AGC 029E」「AT 4504」Wandering TKHS
    Solution -「CF 840C」On the Bench
    Solution -「AGC 004E」「AT 2045」Salvage Robots
    Solution -「CF 908D」New Year&Arbitrary Arrangement
    IDEA技巧-快速遍历数组
    [LOJ6055]「from CommonAnts」一道数学题 加强版
    LeetCode437路径总和III
  • 原文地址:https://www.cnblogs.com/yunqian2017/p/14974017.html
Copyright © 2020-2023  润新知