【无标题】[广东省大学生攻防大赛 2022]pyre

2023-12-28 16:53:28

使用pycdc工具得到源码

# Source Generated with Decompyle++
# File: 1.pyc (Python 3.7)


def check():
    a = input('plz input your flag:')
    c = [
        144,
        163,
        158,
        177,
        121,
        39,
        58,
        58,
        91,
        111,
        25,
        158,
        72,
        53,
        152,
        78,
        171,
        12,
        53,
        105,
        45,
        12,
        12,
        53,
        12,
        171,
        111,
        91,
        53,
        152,
        105,
        45,
        152,
        144,
        39,
        171,
        45,
        91,
        78,
        45,
        158,
        8]
    if len(a) != 42:
        print('wrong length')
        return 0
    b = None
    for i in range(len(a)):
        if ord(a[i]) * 33 % b != c[i]:
            print('wrong')
            return None

    print('win')

但是没有看到模数,因此查看字节码,获知模数(使用pycdas工具查看字节码)

import gmpy2
enc = [144, 163, 158, 177, 121, 39, 58, 58, 91, 111, 25, 158, 72, 53, 152, 78, 171, 12, 53, 105, 45, 12, 12, 53, 12, 171, 111, 91, 53, 152, 105, 45, 152, 144, 39, 171, 45, 91, 78, 45, 158, 8]
key = gmpy2.invert(33, 179) # 求一个模的逆元
for i in range(len(enc)):
    enc[i] = enc[i] * key % 179
print(bytes(enc))

文章来源:https://blog.csdn.net/2201_76139143/article/details/135186166
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。