平凉关卡-RSA.ios:



1.利用Weil pairing从点对gift里恢复RSA素因子P

2.用pp分解RSA模数n,得到pq

3.计算RSA私钥d

4.解密c,得到flag


#!/usr/bin/env python# -*- coding: utf-8 -*-
# solve.py  -- Python 3.9+  纯 Python,无第三方库# 思路要点:# 1) 从 output.txt 解析 a, r, P, Q, gift[], n, c# 2) 构造 F_{p^2} (i^2 = -1) 与 E0: y^2 = x^3 + 1# 3) 取 r-子群:P_r = ((p+1)/r)*P, Q_r = ((p+1)/r)*Q# 4) 用“**Weil 配对**”而不是 Tate 配对:e'_r(φ(P_r), φ(Q_r)) = e_r(P_r, Q_r)^{deg φ}#    其中 deg φ = 2^a * x,x 是待求字节;Weil 配对比值会抵消规范化常数# 5) 对每个 gift 的 (φ(P), φ(Q)) 还原出 E':y^2 = x^3 + A'x + B',计算 e'_r,做离散对数求 deg φ (mod r)# 6) x = deg φ * inv(2^a, r) (mod r),且 1..255;拼回小端得到 pp,分解 n 并 RSA 解密得到 flag
import refrom math import gcd
# ------------ 小工具 ------------def inv_mod(a: int, m: int) -> int:    a %= m    return pow(a, -1, m)
def long_to_bytes(n: int) -> bytes:    if n == 0:        return b'x00'    out = []    while n:        out.append(n & 0xff)        n >>= 8    return bytes(reversed(out))
# ------------ 读取并解析 output.txt ------------txt = open('output.txt','r',encoding='utf-8',errors='ignore').read()
a = int(re.search(r'as*=s*(d+)', txt).group(1))r = int(re.search(r'rs*=s*(d+)', txt).group(1))n = int(re.search(r'bns*=s*(d+)', txt).group(1))c = int(re.search(r'bcs*=s*(d+)', txt).group(1))e = 65537
pre, giftblock = txt.split('gift ='1)
# 解析 F_{p^2} 标量:形如 'A*i + B' 或纯整数 'B'def parse_fp2_scalar(s: str):    s = s.strip()    if '*i' not in s:        return (0int(s))    s2 = s.replace(' ''').replace('+i','+1*i').replace('-i','-1*i')    m = re.match(r'^(-?d+)*i([+-]d+)$', s2)    if not m:        raise ValueError(f'无法解析 Fp2 标量: {s}')    return (int(m.group(1)), int(m.group(2)))
def parse_point(pair):    x = parse_fp2_scalar(pair[0])    y = parse_fp2_scalar(pair[1])    return (x, y)
pair_re = re.compile(r'(s*([^)]+?)s*,s*([^)]+?)s*)')
pairs_pre = pair_re.findall(pre)if len(pairs_pre) < 2:    raise ValueError('未解析到 P、Q。')P_xy = parse_point(pairs_pre[0])Q_xy = parse_point(pairs_pre[1])
pairs_gift = pair_re.findall(giftblock)if len(pairs_gift) % 2 != 0:    raise ValueError('gift 点对数量异常。')gift_points = []for i in range(0len(pairs_gift), 2):    gift_points.append((parse_point(pairs_gift[i]), parse_point(pairs_gift[i+1])))
# ------------ 计算 p ------------def lcm(a, b): return a // gcd(a, b) * bL = 1for t in range(1256):    L = lcm(L, t)p = (pow(2, a) * r * L) - 1
# ------------ F_{p^2} 与椭圆曲线实现(短魏尔斯特拉斯) ------------MOD = p
class Fp2:    __slots__ = ('a','b')  # 表示 a*i + b    def __init__(self, a, b):        self.a = a % MOD        self.b = b % MOD    def __add__(self, other): return Fp2(self.a + other.a, self.b + other.b)    def __sub__(self, other): return Fp2(self.a - other.a, self.b - other.b)    def __neg__(self):        return Fp2(-self.a, -self.b)    def __mul__(self, other):        ai = (self.a * other.b + self.b * other.a) % MOD        br = (self.b * other.b - self.a * other.a) % MOD        return Fp2(ai, br)    def inv(self):        den = (self.a*self.a + self.b*self.b) % MOD        invden = pow(den, -1, MOD)        return Fp2(-self.a * invden, self.b * invden)    def __truediv__(self, other): return self * other.inv()    def __pow__(self, e):        e = int(e)        out = Fp2(0,1)        base = self        while e:            if e & 1: out = out * base            base = base * base            e >>= 1        return out    def __eq__(self, other):        return (self.a - other.a) % MOD == 0 and (self.b - other.b) % MOD == 0    def __repr__(self): return f'{self.a}*i+{self.b}'
def F(e):  # 常数 -> Fp2    if isinstance(e, Fp2): return e    return Fp2(0, e)
def from_tuple(t): return Fp2(t[0], t[1])
class ECPoint:    __slots__ = ('x','y','inf','E')    def __init__(self, E, x=None, y=None, inf=False):        self.E = E; self.x = x; self.y = y; self.inf = inf    @staticmethod    def infinity(E): return ECPoint(E, NoneNoneTrue)    def copy(self):  return ECPoint.infinity(self.E) if self.inf else ECPoint(self.E, self.x, self.y, False)
class EllipticCurve:    __slots__ = ('A','B')    def __init__(self, A, B):  # y^2 = x^3 + A x + B        self.A = F(A); self.B = F(B)
    def add_with_slope(self, P: ECPoint, Q: ECPoint):        if P.inf: return Q.copy(), None        if Q.inf: return P.copy(), None        if P.x == Q.x:            if (P.y + Q.y) == Fp2(0,0):  # 垂直相加                return ECPoint.infinity(self), None            lam = (F(3)*P.x*P.x + self.A) / (F(2)*P.y)        else:            lam = (Q.y - P.y) / (Q.x - P.x)        if P.x == Q.x and P.y == Q.y:            x3 = lam*lam - F(2)*P.x            y3 = lam*(P.x - x3) - P.y        else:            x3 = lam*lam - P.x - Q.x            y3 = lam*(P.x - x3) - P.y        return ECPoint(self, x3, y3, False), lam
    def add(self, P, Q):        R,_ = self.add_with_slope(P,Q); return R
    def mul(self, P: ECPoint, k: int):        if P.inf or k == 0return ECPoint.infinity(self)        if k < 0return self.mul(ECPoint(self, P.x, -P.y, False), -k)        R = ECPoint.infinity(self); B = P.copy()        while k:            if k & 1: R = self.add(R, B)            B = self.add(B, B)            k >>= 1        return R
    # 原始 Miller:返回 f_{r,P}(Q)(未做最终指数)    def miller_raw(self, P: ECPoint, Q: ECPoint, r: int):        if P.inf or Q.inf: return Fp2(0,1)        f = Fp2(0,1)        T = P.copy()        bits = bin(r)[3:]  # 去最高位        for b in bits:            R, lam = self.add_with_slope(T, T)            if lam is None:                g = Fp2(0,1)            else:                nu = T.y - lam*T.x                num = (Q.y - lam*Q.x - nu)                den = (Q.x - R.x)                g = num / den            f = (f*f) * g            T = R            if b == '1':                R, lam = self.add_with_slope(T, P)                if lam is None:                    g = Fp2(0,1)                else:                    nu = T.y - lam*T.x                    num = (Q.y - lam*Q.x - nu)                    den = (Q.x - R.x)                    g = num / den                f = f * g                T = R        return f
    # Weil 配对(做一次最终指数把结果映到 μ_r)    def weil_pairing_red(self, P: ECPoint, Q: ECPoint, r: int):        # e_r(P,Q) = (-1)^r * f_{r,P}(Q) / f_{r,Q}(P)        fPQ = self.miller_raw(P, Q, r)        fQP = self.miller_raw(Q, P, r)        val = fPQ / fQP        if r % 2 == 1:  # 乘 (-1)            val = val * Fp2(0, -1)        # 映射到 μ_r        return val ** ((MOD*MOD - 1)//r)
# ------------ 构造 E0 与 r-子群基 ------------E0 = EllipticCurve(01)  # y^2 = x^3 + 1(j=0)P0 = ECPoint(E0, from_tuple(P_xy[0]), from_tuple(P_xy[1]), False)Q0 = ECPoint(E0, from_tuple(Q_xy[0]), from_tuple(Q_xy[1]), False)
co_r = (p + 1) // rP_r = E0.mul(P0, co_r)Q_r = E0.mul(Q0, co_r)
# 基准 Weil 配对生成元(在 μ_r)w_base = E0.weil_pairing_red(P_r, Q_r, r)
# 预计算 w_base^j -> j 映射表,做离散对数table = {}val = Fp2(0,1)for j in range(r):    table[(val.a, val.b)] = j    val = val * w_base
inv_2a_mod_r = inv_mod(pow(2, a, r), r)
# ------------ 逐 gift 还原每个字节 ------------xs_le = []for (phiP_xy, phiQ_xy) in gift_points:    x1 = from_tuple(phiP_xy[0]); y1 = from_tuple(phiP_xy[1])    x2 = from_tuple(phiQ_xy[0]); y2 = from_tuple(phiQ_xy[1])
    # 由两点解出 E':y^2 = x^3 + A'x + B'    S1 = y1*y1 - x1*x1*x1    S2 = y2*y2 - x2*x2*x2    dx = x1 - x2    if dx == Fp2(0,0):        raise RuntimeError('遇到退化情形 x1==x2(概率极低);可改写为用第三点拟合)。')    A1 = (S1 - S2) / dx    B1 = S1 - A1*x1    E1 = EllipticCurve(A1, B1)
    phiP = ECPoint(E1, x1, y1, False)    phiQ = ECPoint(E1, x2, y2, False)    phiP_r = E1.mul(phiP, co_r)    phiQ_r = E1.mul(phiQ, co_r)
    w1 = E1.weil_pairing_red(phiP_r, phiQ_r, r)    j = table.get((w1.a % MOD, w1.b % MOD))    if j is None:        # 兜底线扫(基本不会触发)        cur = Fp2(0,1); j = None        for t in range(r):            if cur == w1:                j = t; break            cur = cur * w_base        if j is None:            raise RuntimeError('离散对数失败。')
    # deg φ ≡ j (mod r);x ≡ j * inv(2^a) (mod r),因 x<r 且 1..255,直接取其值    x_byte = (j * inv_2a_mod_r) % r    if not (1 <= x_byte <= 255):        raise RuntimeError(f'异常字节 {x_byte} 不在 1..255')    xs_le.append(x_byte)
# 小端拼回 pppp = 0for i, b in enumerate(xs_le):    pp |= (b << (8*i))
if n % pp != 0:    raise RuntimeError('pp 不能整除 n,可能解析出错。')qq = n // pp
phi_n = (pp - 1) * (qq - 1)d = inv_mod(e, phi_n)m = pow(c, d, n)flag = long_to_bytes(m)
print('r =', r, 'a =', a)print('pp bits:', pp.bit_length())print('pp | n ?', n % pp == 0)print('flag =', flag.decode('utf-8', errors='ignore'))
flag{S1mple_Is0geNy_7r1ck_t0_Recov3r_Fla9}

平凉关卡-Lesscommon:



循环、移位、模加、异或

# -*- coding: utf-8 -*-import struct
def rol32(x, n):    n &= 0x1F; x &= 0xFFFFFFFF    return ((x << n) | (x >> (32 - n))) & 0xFFFFFFFF
def ror32(x, n):    n &= 0x1F; x &= 0xFFFFFFFF    return ((x >> n) | (x << (32 - n))) & 0xFFFFFFFF
def u32(x): return x & 0xFFFFFFFF
def key_schedule(key_bytes: bytes, S_len: int):    # 对应反汇编中 sub_2170 的行为(L 从后向前打包,S 初始化后做 3*max(S_len,L_len) 混合)    L_len = (len(key_bytes) + 3) >> 2    if L_len == 0:        L_len = 1    L = [0] * L_len    for i in range(len(key_bytes)-1, -1, -1):        idx = i // 4        L[idx] = u32((L[idx] << 8) + key_bytes[i])
    S = [0] * S_len    S[0] = 1766649740    add_const = 1422508807    for j in range(1, S_len):        S[j] = u32(S[j-1] + add_const)
    v15 = 0    v16 = 0    idxS = 0    idxL = 0    rounds = 3 * max(S_len, L_len)    for k in range(rounds):        v = S[idxS]        v7 = u32(k ^ rol32(u32(v15 + v16 + v), 3))        S[idxS] = v7        v16 = v7        v_l = L[idxL]        v8 = u32(rol32(u32(v15 + v7 + v_l), (v7 + v15) & 0x1F))        L[idxL] = v8        v15 = v8        idxS = (idxS + 1) % S_len        idxL = (idxL + 1) % L_len    return S
def decrypt_block(block8: bytes, S, rounds_count: int):    v15 = struct.unpack('<I', block8[0:4])[0]    v13 = struct.unpack('<I', block8[4:8])[0]    for k in range(rounds_count, 0, -1):        tmp = u32(v13 ^ v15)        v13_in = u32(ror32(tmp, v15) - S[2*k + 1])        tmp2 = u32(v15 ^ v13_in)        v15_in = u32(ror32(tmp2, v13_in) - S[2*k])        v13, v15 = v13_in, v15_in    v14 = u32(v15 - S[0])    v12 = u32(v13 - S[1])    return struct.pack('<I', v14) + struct.pack('<I', v12)
def decrypt_buffer(cipherbytes: bytes, S, rounds_count: int):    if len(cipherbytes) % 8 != 0:        raise ValueError('cipher length must be multiple of 8')    out = bytearray()    for i in range(0len(cipherbytes), 8):        out += decrypt_block(cipherbytes[i:i+8], S, rounds_count)    # 去 PKCS-like 填充    if not out:        return bytes(out)    pad_len = out[-1]    if 1 <= pad_len <= 8 and out.endswith(bytes([pad_len]) * pad_len):        return bytes(out[:-pad_len])    return bytes(out)
if __name__ == '__main__':    key_bytes = struct.pack('<4I'0x674523010xEFCDAB890x98BADCFE0x10325476)
    cipher_bytes = bytes([      0x4C,0x6F,0xAB,0xF3,0x13,0x78,0xE2,0xF6,0x86,0x9D,0x1C,0x99,0xDE,0x85,0xCC,0x10,      0xE8,0x28,0xEE,0x05,0x92,0x21,0x4B,0x34,0x43,0x28,0x17,0x3C,0x56,0x5B,0x73,0x51,      0x9F,0x8A,0x1D,0x0F,0x97,0x34,0x2C,0x56,0x42,0x9F,0x69,0x48,0xA3,0xD5,0x8A,0xF5    ])
    rounds_count = 12    S_len = 2 + 2 * rounds_count   # 确保 S 能被访问到需要的索引    S = key_schedule(key_bytes, S_len)
    plain = decrypt_buffer(cipher_bytes, S, rounds_count)    print('decrypted (hex):', plain.hex())    print('decrypted (utf-8):', plain.decode('utf-8', errors='replace'))

天水关卡-HashBaseWorld:



In post quantum cryptography, hash-based cryptography is a type of public-key cryptography that uses hash functions to provide security.It is considered to be resistant to attacks from quantum computers, which can break many traditional cryptographic systems.
from pwn import *from binascii import hexlify, unhexlifyimport hashlibimport wagnerimport random
x = 'aa  bbccdd' + 'a' * 118y = 'aabb  ccdd' + 'a' * 118z = 'aabbcc  dd' + 'a' * 118
sh = remote('pwn-170bbda91c.challenge.longjiancup.cn'9999, ssl=True)
sh.recvline()sh.recvline()sh.sendlineafter(b'x:',x.encode())sh.sendlineafter(b'y:',y.encode())sh.sendlineafter(b'z:',z.encode())sh.recvline()
YOUR_SUFFIX_HEX = str(sh.recvline().strip().decode().split('with')[-1]).strip()print(YOUR_SUFFIX_HEX)YOUR_SUFFIX_BYTES = unhexlify(YOUR_SUFFIX_HEX)n = 4722366482869645213711
def hashfunc_with_suffix(r, n, index):    r_bytes = r.to_bytes((int.bit_length(n) + 7) // 8'big')
    preimage = r_bytes + YOUR_SUFFIX_BYTES
    h = hashlib.sha3_512(preimage).digest()    return int.from_bytes(h, 'big') % n
def generator_with_suffix(n, index):    r = random.randrange(0, n)    hash_value = hashfunc_with_suffix(r, n, index)    return wagner.Lineage(hash_value, r)
if __name__ == '__main__':    print('正在使用 Wagner 算法寻找满足条件的哈希输入...')    r_values = wagner.solve(n, tree_height = 3,generator=generator_with_suffix)    sendmsg = []    for r in r_values:        r_hex = hexlify(r.to_bytes((int.bit_length(n) + 7) // 8'big')).decode()        final_message_hex = r_hex + YOUR_SUFFIX_HEX        print(f'msg: {final_message_hex}')        sh.sendlineafter(b'msg:',final_message_hex.encode())    print(sh.recvline())    print(sh.recvline())
flag{dPXNQ8ki99DjBe7pE0Yt4WJMcgaxJSrm}

天水关卡-Prover:



SAT Prover


from typing import Listfrom z3 import *
# Helpers for rotations on z3 BitVecsdef rol8_z3(x, r):    return RotateLeft(x, r % 8)
def rol32_z3(x, r):    return RotateLeft(x, r % 32)
def rol64_z3(x, r):    return RotateLeft(x, r % 64)
# popcount32 using SWAR (matches sub_30B0)def popcount32_z3(x):    # x is a 32-bit BitVec    a = x - (LShR(x, 1) & BitVecVal(0x55555555, 32))    b = (a & BitVecVal(0x33333333, 32)) + (LShR(a, 2) & BitVecVal(0x33333333, 32))    c = (b + LShR(b, 4)) & BitVecVal(0x0F0F0F0F, 32)    d = c * BitVecVal(0x01010101, 32)    return LShR(d, 24)
# Constants from data segmentbyte_6085 = [0x03, 0x05, 0x09, 0x0B, 0x0D]byte_608A = [0xA5, 0x5C, 0xC3, 0x96, 0x3E, 0xD7, 0x21]
# Build solvers = Solver()
22 characters of the flagc = [BitVec(f'c{i}'8) for i in range(22)]
# Known prefix/suffix: 'flag{' and '}'known = list(b'flag{')s.add(c[0] == known[0])s.add(c[1] == known[1])s.add(c[2] == known[2])s.add(c[3] == known[3])s.add(c[4] == known[4])s.add(c[21] == ord('}'))
# Unknown middle 16 chars are lowercase hex [0-9a-f]for i in range(521):    s.add(Or(And(c[i] >= 0x30, c[i] <= 0x39), And(c[i] >= 0x61, c[i] <= 0x66)))
# Compute v59 bytes from chars as in mainb = []for i in range(22):    mul = BitVecVal(byte_6085[i % 5], 8)    add_term = BitVecVal((19 * i + 79) & 0xFF, 8)    tmp = (mul * c[i]) + add_term  # wraps to 8-bit    tmp = Extract(70, tmp)    x = tmp ^ BitVecVal(byte_608A[i % 7], 8)    v = rol8_z3(x, i % 5)    b.append(v)
# Build v47 = v59 padded with zeros to multiple of 4 (22 -> 24)v47 = b + [BitVecVal(08), BitVecVal(08)]
# Pack into 6 dwords little-endian -> v45D = []for k in range(0244):    d = ZeroExt(24, v47[k])         | (ZeroExt(24, v47[k+1]) << 8)         | (ZeroExt(24, v47[k+2]) << 16)         | (ZeroExt(24, v47[k+3]) << 24)    D.append(Extract(310, d))
# Compute v42 = sum(popcount32(d)) & 0xFFv42_sum = BitVecVal(032)for d in D:    v42_sum = v42_sum + popcount32_z3(d)v42 = Extract(70, v42_sum)
# Aggregates over bytesv53 = BitVecVal(016)v52 = BitVecVal(08)v51 = BitVecVal(08)v50 = BitVecVal(08)for j in range(22):    v53 = Extract(150, v53 + ZeroExt(8, b[j]))    v52 = v52 ^ b[j]    v51 = Extract(70, v51 + Extract(70, (b[j] * BitVecVal(j + 18))))    # v50 accumulates popcount of each byte (sub_3040 / sub_30B0)    cnt = popcount32_z3(ZeroExt(24, b[j]))    v50 = Extract(70, v50 + Extract(70, cnt))
# sub_3160 picks D[idx % 6]idx = lambda i: D[i % 6]
# Recreate the 32-bit mixing to compute v34, n1727223967, n1911915815, ((v32+v33)^A5...)v21 = idx(0)v20 = rol32_z3(v21, 5)v37 = (idx(2) - BitVecVal(164053152732)) ^ v20v18 = idx(4) ^ BitVecVal(0xDEADBEEF, 32)v19 = idx(7)  # -> D[1]n172 = (rol32_z3(v19, 11) + v18 + v37) ^ BitVecVal(0xA5A5A5A5, 32)
v16 = (BitVecVal(0xFFFFFFFF & (-2048144789), 32) * idx(1))v17 = idx(5)v35 = rol32_z3(v17, 13) + v16v15 = idx(8) + BitVecVal(213558786132)v13 = (BitVecVal(66826526132) * idx(3)) ^ v15 ^ v35v14 = idx(9)v34 = (rol32_z3(v14, 17) + v13) ^ BitVecVal(0x5A5AA5A5, 32)
v12 = idx(0)v33 = idx(3) ^ v12 ^ BitVecVal(0x13579BDF, 32)v11 = idx(1)v10 = idx(2)v32 = rol32_z3(v10, 7) + v11
for m in range(2):    v9 = rol32_z3((BitVecVal(m, 32) ^ BitVecVal(0x9E3779B9, 32)) - (BitVecVal(204814478932) * v32), 5 * m + 5)    v30 = rol32_z3(v32, 11) ^ v32 ^ v9 ^ v33    v33 = v32    v32 = v30
v8 = rol32_z3(v33, 3)n191 = (rol32_z3(v32, 11) + v8) ^ BitVecVal(0x5A5AA5A5, 32)
64-bit hash sub_31B0v5 = BitVecVal(0x243F6A8885A308D3, 64)for i in range(22):    shift = 8 * (i & 7)    vi64 = ZeroExt(56, b[i])    mixed = v5 ^ (vi64 << shift)    mixed = BitVecVal(0x9E3779B185EBCA87, 64) * mixed    v5 = rol64_z3(mixed, 13)
tmp = BitVecVal(0xBF58476D1CE4E5B9, 64) * (v5 ^ LShR(v5, 30))v3 = BitVecVal(0x94D049BB133111EB, 64) * (tmp ^ LShR(tmp, 27))n161 = v3 ^ LShR(v3, 31)
# Target constraints from mains.add(n161 == BitVecVal(0x9B30518C600D26DD, 64))s.add(Extract(310, n161) == BitVecVal(161147465332))s.add(n191 == BitVecVal(191191581532))s.add(((v32 + v33) ^ BitVecVal(0xA5A5A5A5, 32)) == BitVecVal(232339650232))  # -1971570794 mod 2^32s.add(v34 == BitVecVal(401960693432))  # -275360362 mod 2^32s.add(n172 == BitVecVal(172722396732))s.add(v42 == BitVecVal(0x50, 8))s.add(v50 == BitVecVal(0x50, 8))s.add(v51 == BitVecVal(0x43, 8))s.add(v52 == BitVecVal(0x55, 8))s.add(v53 == BitVecVal(0x0913, 16))
# Solveif s.check() != sat:    print('UNSAT or timeout')else:    m = s.model()    flag_bytes = [m[c[i]].as_long() for i in range(22)]    flag_str = ''.join(chr(v) for v in flag_bytes)    print(flag_str)
flag{7ac1d3e59f0b2468}

临洮关卡-EzHNP:



常见的格密码学问题EHNP


import jsonfrom lbc_toolkit import ehnpfrom hashlib import md5
with open('data.json''r'as f:    json_data = json.load(f)
xbar = json_data['xbar']p = json_data['p']Pi = json_data['Pi']Nu = json_data['Nu']Alpha = json_data['Alpha']Rho = json_data['Rho']Mu = json_data['Mu']Beta = json_data['Beta']
sol = ehnp(xbar,p,Pi,Nu,Alpha,Rho,Mu,Beta,delta=1/10^12 , verbose=True)print(sol)print('flag :''flag{' + md5(str(sol).encode()).hexdigest() + '}')# flag{67f56be77ad87032f8a91070057184bf}
第三届“陇剑杯”网络安全大赛初赛-夺旗闯关赛WriteUp
# https://github.com/DownUnderCTF/Challenges_2022_Public/blob/main/crypto/rsa-interval-oracle-iii/solve/solv.sage

flag{67f56be77ad87032f8a91070057184bf}

兰州关卡-Dragon:



Evil Dragon

#!/usr/bin/env python3
import structimport argparsefrom typing import List

def rol32(x: int, r: int) -> int:    '''    对 32 位整数 x 左循环移位 r 位。    '''    x &= 0xFFFFFFFF    return ((x << r) | (x >> (32 - r))) & 0xFFFFFFFF

def mx(y: int, z: int, s: int, k: List[int], p: int, e: int) -> int:    '''    XXTEA 核心混合函数,与 obf_jmp_0 中的实现保持一致。    '''    t = ((z << 4) ^ (y >> 5)) + ((y << 4) ^ (z >> 5))    t &= 0xFFFFFFFF    idx = ((p & 3) ^ e) & 3    u = ((s ^ y) + (k[idx] ^ z)) & 0xFFFFFFFF    return (t ^ u) & 0xFFFFFFFF

def xxtea_decrypt(    v: List[int], k: List[int], rounds: int = 0x2A, delta: int = 0x87654321) -> List[int]:    '''    对整数列表 v 应用定制的 XXTEA 解密算法,返回解密后的整数列表。    rounds: 轮数,默认为 0x2A;delta:累减常量。    '''    n = len(v)    if n < 2:        return v.copy()
    v = v.copy()    s = (rounds * delta) & 0xFFFFFFFF
    while rounds > 0:        e = (s >> 2) & 3        # p 从 n-1 倒序到 0        for p in range(n - 1, -1, -1):            y = v[(p + 1) % n]            z = v[(p - 1) % n]            v[p] = (v[p] - mx(y, z, s, k, p, e)) & 0xFFFFFFFF        s = (s - delta) & 0xFFFFFFFF        rounds -= 1
    return v

def words_to_bytes(words: List[int]) -> bytes:    '''    将 32 位整数字列表打包成小端字节串,并去除尾部多余的 0x00。    '''    data = b''.join(struct.pack('<I', w) for w in words)    return data.rstrip(b'x00')

def main():    parser = argparse.ArgumentParser(        description='自定义 XXTEA 解密脚本,生成 candidate_raw.bin 和 candidate_der.bin'    )    parser.add_argument(        '--out-raw', default='candidate_raw.bin'help='解密后原始密钥输出文件名'    )    parser.add_argument(        '--out-der', default='candidate_der.bin'help='解密后派生密钥输出文件名'    )    args = parser.parse_args()
    # 已知密文(32-bit words)    cipher_words = [        0x0EB4D6CE,        0x521DDE8B,        0x21ED24FD,        0xBA10EC26,        0x3339931C,        0x46DC0E7D,        0xCC469F44,        0x64BA7079,        0x64777977,        0xB2151C98,        0xDBCC5AA1,    ]
    # 原始密钥和派生密钥    K_raw = [0x123456780x9ABCDEF00xFEDCBA980x76543210]    K_derived = [rol32(x ^ 0x13579BDF7for x in K_raw]
    # 解密    plain_raw = xxtea_decrypt(cipher_words, K_raw)    plain_der = xxtea_decrypt(cipher_words, K_derived)
    # 转成字节并写文件    data_raw = words_to_bytes(plain_raw)    data_der = words_to_bytes(plain_der)
    with open(args.out_raw, 'wb'as f:        f.write(data_raw)    with open(args.out_der, 'wb'as f:        f.write(data_der)
    # 打印结果    print(f'Written raw plaintext to '{args.out_raw}'')    print(f'Written derived plaintext to '{args.out_der}'')    try:        print('RAW ASCII:', data_raw.decode('utf-8', errors='replace'))        print('DER ASCII:', data_der.decode('utf-8', errors='replace'))    except UnicodeDecodeError:        pass

if __name__ == '__main__':    main()

武威关卡-和我的保险去说吧!:



人生呐能不能放过我这一😭
下辈子我只想做个😇
不会长大的孩子👶
有人取暖有人依靠👫
不会有太多心事😌
用最天真的橡皮🧽
就能擦去生活的争执🤧

这题直接问ai,

通过ai生成图片 直接攻击 得到flag。

import torchimport torch.nn as nnimport torch.optim as optimfrom torch.utils.data import DataLoaderfrom torchvision import datasets, models, transformsfrom PIL import Imageimport osfrom tqdm import tqdm
# --- 配置参数 ---DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')MODEL_PATH = './model.pth'DATASET_PATH = './dataset'PATCH_SIZE = 64IMAGE_SIZE = 224BATCH_SIZE = 16EPOCHS = 20LEARNING_RATE = 0.01TARGET_LABEL = 32
# 和服务器完全一致的标准化参数normalize = transforms.Normalize(mean=[0.34030.31210.3214],                                 std=[0.27240.26080.2669])
# --- 主要攻击逻辑 ---
def generate_adversarial_patch():    print(f'[*] 使用设备: {DEVICE}')
    # 1. 加载模型    print('[*] 正在加载ResNet-18模型...')    model = models.resnet18(weights=None, num_classes=43)    model.load_state_dict(torch.load(MODEL_PATH, map_location=DEVICE, weights_only=True))    model.to(DEVICE)    model.eval()    print('[+] 模型加载成功!')
    # 2. 加载数据集    # !--- 这是修正的部分 ---!    # 在ToTensor之前,先将所有图片统一到一个固定尺寸,以避免DataLoader打包时出错。    data_transform = transforms.Compose([        transforms.Resize((4848)), # 确保所有图片尺寸一致        transforms.ToTensor()    ])    # !--------------------!
    dataset = datasets.ImageFolder(root=DATASET_PATH, transform=data_transform)    data_loader = DataLoader(dataset, batch_size=BATCH_SIZE, shuffle=True)    print(f'[+] 数据集加载成功,共 {len(dataset)} 张图片。')
    # 3. 初始化一个随机补丁    patch = torch.rand((3, PATCH_SIZE, PATCH_SIZE), device=DEVICE, requires_grad=True)
    # 4. 设置优化器和损失函数    optimizer = optim.Adam([patch], lr=LEARNING_RATE)    criterion = nn.CrossEntropyLoss()
    print('[*] 开始生成对抗性补丁...')    # 5. 开始迭代优化(训练补丁)    for epoch in range(EPOCHS):        total_loss = 0        progress_bar = tqdm(data_loader, desc=f'Epoch {epoch+1}/{EPOCHS}')
        for images, _ in progress_bar:            images = images.to(DEVICE)
            # --- 模拟服务器的apply_patch操作 ---            patched_images = []            for img in images:                # a. 缩放图片到模型需要的224x224尺寸                img_resized = transforms.functional.resize(img, (IMAGE_SIZE, IMAGE_SIZE))
                # b. 随机选择粘贴位置                h = torch.randint(0, IMAGE_SIZE - PATCH_SIZE, (1,)).item()                w = torch.randint(0, IMAGE_SIZE - PATCH_SIZE, (1,)).item()
                # c. 粘贴补丁                img_patched = img_resized.clone()                img_patched[:, h:h+PATCH_SIZE, w:w+PATCH_SIZE] = patch
                # d. 标准化                img_normalized = normalize(img_patched)                patched_images.append(img_normalized)
            patched_batch = torch.stack(patched_images)            # --- 模拟结束 ---
            target = torch.full((patched_batch.size(0),), TARGET_LABEL, dtype=torch.long, device=DEVICE)
            output = model(patched_batch)            loss = criterion(output, target)
            optimizer.zero_grad()            loss.backward()            optimizer.step()
            with torch.no_grad():                patch.clamp_(01)
            total_loss += loss.item()            progress_bar.set_postfix({'Loss'f'{loss.item():.4f}'})
        avg_loss = total_loss / len(data_loader)        print(f'--- Epoch {epoch+1} 完成, 平均损失: {avg_loss:.4f} ---')
    print('[+] 补丁生成完毕!')    return patch.detach().cpu()


def save_patch(patch_tensor, filename='patch.png'):    print(f'[*] 正在保存补丁到 {filename}...')    to_pil = transforms.ToPILImage()    patch_image = to_pil(patch_tensor)    patch_image.save(filename)    print(f'[+] 补丁已成功保存!请将 {filename} 上传到题目网站。')


if __name__ == '__main__':    if not os.path.exists(MODEL_PATH):        print(f'[!] 错误: 未找到模型文件 '{MODEL_PATH}'。请确保它在当前目录。')    elif not os.path.exists(DATASET_PATH):        print(f'[!] 错误: 未找到数据集文件夹 '{DATASET_PATH}'。请确保它在当前目录。')    else:        final_patch = generate_adversarial_patch()        save_patch(final_patch)

武威关卡-qrandom:



Welcome to /dev/qrandom.

# pip install pulp pycryptodomeimport re, math, binasciifrom hashlib import md5from Crypto.Cipher import AESimport pulp
DUMP = r'''(把你消息里从第一行 0.5117... 开始,到最后一行那串很长的十六进制密文,完整粘过来)'''
# 1) 解析 111 组 (p, hex) + 最后一行密文floats = [float(x) for x in re.findall(r'(?<![0-9a-f])([01]?.d+)', DUMP)]hexes  = re.findall(r'b[0-9a-fA-F]{64}b', DUMP)# 最后一行密文:不是 64 长度的那串十六进制tail_hex = [x for x in re.findall(r'b[0-9a-fA-F]+b', DUMP) if len(x) % 2 == 0 and len(x) != 64][-1]
assert len(floats) >= 111 and len(hexes) >= 111'数据对不完整'pairs = list(zip(floats[:111], hexes[:111]))
def hex_to_bits(h):    b = bytes.fromhex(h)    return [(byte >> i) & 1 for byte in b for i in range(7, -1, -1)]
Y = [hex_to_bits(h) for _, h in pairs]          # 111 x 256C = [round(p * 256for p, _ in pairs]          # wt(key_i)Yw = [sum(row) for row in Y]                    # wt(y_i)
# 2) 建 ILP:变量 s_j∈{0,1},对每个 i:sum_j s_j*(1-2*y_{ij}) = C_i - Yw_iprob = pulp.LpProblem('RecoverSecret', pulp.LpStatusOptimal)s = [pulp.LpVariable(f's_{j}', lowBound=0, upBound=1, cat='Binary'for j in range(256)]
for i in range(111):    coeffs = [(1 - 2*Y[i][j]) for j in range(256)]  # ±1    rhs = C[i] - Yw[i]    prob += (pulp.lpSum(coeffs[j]*s[j] for j in range(256)) == rhs)
# 3) 目标随便(满足所有等式即可;加个零目标)prob += 0
# 4) 求解status = prob.solve(pulp.PULP_CBC_CMD(msg=False))assert pulp.LpStatus[status] == 'Optimal'f'Solve failed: {pulp.LpStatus[status]}'
s_bits = [int(v.value()) for v in s]# 校验:H(s, y_i) 是否等于 C_idef dist(a,b): return sum(x^y for x,y in zip(a,b))for i in range(111):    assert dist(s_bits, Y[i]) == C[i]
# 5) bits -> secret bytessecret_bytes = bytearray()for k in range(32):    byte = 0    for bit in range(8):        byte = (byte << 1) | s_bits[k*8 + bit]    secret_bytes.append(byte)
print('secret =', secret_bytes.hex())# 6) 解密最后一行密文ciphertext = bytes.fromhex(tail_hex)key = md5(bytes(secret_bytes)).digest()cipher = AES.new(key=key, nonce=b'suan', mode=AES.MODE_CTR)flag = cipher.decrypt(ciphertext)print('FLAG =', flag.decode(errors='ignore'))

张掖关卡-EzRSA:




https://eprint.iacr.org/2015/399.pdf #参考第四章复现
from hashlib import md5import gmpy2
N = 26268730376437465619747694229815132112356009401457332980851056512039125223572256698349771745578453140493876212463576489209738411249084508080478694026253629200996310338757187318441202469686076039890134185431684441359243354704263064234240086825746163991079770608706318080187838346308275952776624452743607846880304450313206803189691667577029544109916752102320546913500125755585846121732050365905475657534212726256756746039084912189272366784040969231066445117215657215829849656693063578208088202426535503487910218578492518434196569870719493059385839261089380130480423821295066603358207028054043048125741423807188147987085832743445123553073152696727751125483576028512717206368045536417759527251023868141937939623844579653265851402580124683575024614189972285427565432873667120809809043257322812206538513607106896678013661889538006697792498773324430892036328479787592534603420393976859097111766115664536568600174661408966752810147765359457299675138286153249230507380279571265200903508341525000206063239474522535928604338905222350260169289987224801122613022899426132977730753999469774641969032858199815868818963668340622385018741897864273298666009308437596214984923449367723130426774344499084593948724110357417583619849807298721126592058616230830739923131253986476938002577678368880848114129110989465464525451588180478130971014371659044272104534650272521051999317149337405085502453976751315249127755982158564239606404377644596597916428577964249191182550655100126397207382479785807769424298675817417202125439722840236522143567234109720595039177912180946167844145145903053062114120024450001549985690733165572603974924291425391827069759568973804368183217329386829017904072163434847612578457084566644983269349460906787391624411018874985536773349629525733271396150024651088458868183570715252393978334078259541510939794631562766759031076066630999542704510541875380695974071628728467682964669191679057082188294556198855917314356463397599216270560261680203491880473615502472508618629238106552179639568812738473568557482998886277688215476836352447353937481882890838429982421630884888267136652341224220780956011226957090375553428888051723807702966880440485095787348825341960819628412617547753764977685524434688104767988306912220357449493316403810421567472248027083930799206008910755717352981722691562403900242544296260465325152366279356230294815796383473451199061019925049266901127948325702217456132024510281669728389479259951950009632805507649555078475462636245912447897338485339361243336691287180230241498175448961649021853461784719789202507890101502418690542468570646825884412246066476750750104515835968734860695742617626070776662307963466819038439069135450264885741115546144585815024686649765409440455489267865855759824581932707401571794335252835671929571685738615933133742296415149268704115519657377517910785790131444576985774422099124144361127054358743772590686958530315363753141384374631749040606501036616821675570665564897789309634837411217872016423620270432514590026611850860899431110920331575996682892486718751753329429397291057795906314787474395234029439341557145356008962111882982493638543079336151257635698798826149312607943707824855095359539267609619859964424598977106189931195593288055198093677980192828210109587692714726223930349505969990459710293312241184671267761345938125134848825717171463676332490368570557720234138303545271377655468806733458967997301816597747759390671689364331199985780493987915574302754731476822099011220963534493964175920189045489460504200054285675221421209675536315239347795412292515897003217941345905795303812527611398398429916043061723142131424775003143363840374210197590113105260631397003977773366806004198195398537396128059080923235451334338434400750703115178457974961157750373476398954289133395790156341284359278707357520510422633064468187584487008503026968172934030699387867465696766862569312654684533684303031244928266408492941941244997901137830872983613232343127780801243315298207427751307619428229414363458947747288271449491767546867298856653260773159610360224613235991580321437741548913137614717194351831492020374319422093978820089700261656645495985705865401897338354798682700954839093849713504951477113008365892440725328121665379685713727905912708383499947115588761662531602760132422900714327570021014455278868767465209977551645140369462295892862251367715720188079811263438287919259755214448402646388416244265800505983438313466616412699289739491972688127128151421826318565894513663885965421660206593927969036793202534737654646431844581393135442269067187006986125741071917437311269744311613508289452393879034633751210376456355009205791647800980592544046945566530573332333321953011523780913018355524646605933781924809922753990747195004993722326824912663519980020508596584468300360450920906680161341779221555395151128528762192454008519639980623498448660790190943147387072342753752258207452332024701564787345572234397512649357937747606540294797175867534887896234712556710287966713901102069147078145870385487796708451939327851936633752084539904370996753643289751256359315978157570395480111786935447912726674715455027459955662324899041526446592999574864650790610624452536617736835492738717140777527036142858959329494881125645462892493970727880915296495492719020874791489815100467660208951985486766976266011079822769510014341971693464723492339127722726260240375306279822244976625314393042993182733859006230742102847137470693059124451847878821754281181150561618727855166734455162808466033826702227043981332351991220286743979688362019835681369871464388154824903764019173547117591898593116467437952904384814151897572546824244697918118299372853683682439088746388045606171605938674028868322111415426248609640571042495282284522330249075172410235361701395474364146423418082851585079259596240879580953786684229355365085076615777644309135400272659390696452606474835790751095016675694874866364760497773488851305804997049662673607383972000177408022308339550082661473881288653613678584592276922801136987665880064592665238913981253224937112908480948773156318930066433227798713896489102152849338163663018603965327451541199350005497313097394981884284740414153911525798046421306201624190140497600259295356240000889224688810688976605709933478701227204805482021607809326806663896297487984432144565816235155507852867084358250687487269496647144666868049719329114633162208483735412195857890232245418653397663260299559847445485920258356412470576765657024312674096870267244449031865855117926994438443479605347948353000280991355145554728470451229822994612500160507448146914640072507303849490985724473892450219780438062303667919412094028517230712311216865744211400778981648344097100174798550082946887853553744930467375949677757133145402123822271760442504743240320986729674199977021408800154617702354584818213561456498632961133202398232400847028373528941108702241306671342139095275814689651772815332597479142067501638060124672330412834070963720523146195354753630708753552682099768490683368112166861167480557730850528546048925378286533872517935172065574657392138466035732387098355693684587548682315649256155921045060609700877031573641474900479758323472842438877531577021415291065825746528933276943698006660477139048779109872537924237713891659642820457973915911774120388120406360349039744503359898648496327658068085187457062814475272790214077271976938516096527739165888967203329287513690271761287559886582180616209546478888556634007341476437844179100907022513203931907596042238669749110166957748553642475156655596861689757752565462424465592087074332555715551156508659136729828495016479506658523293348740700405214150793916538101344404161562230936257189290225547126573749903406340835051866528275431627106512779566335730654251014821208692459941259439948366899262462878437496298936552185326347601711530381525889661562675431465213001994117084625238603138947159990388278722094274771390728784438369886205613535869837678969405601165615844382064367219553243823514091938527264957547072809630123147314507929007784157134836033089059171102323474738785684525250435435150294976377314225506137552678030888147264458545918377645291261901032558450360359903443858117957529065299005765683321724848326090104609284579372664272455751399690009426402821557029298511862711771514926860331575554345660041727646558030456665532659360111242817815396764594268500809031408572641344140227229003073686364414876686822421898327136247111030236719406931645485677998844624223032593210726220921644004848363527624993148525276728426145746978167419602845199170761263244848281658165672745488939281349615820944201036598476686213416883476826780532162792291554697338781532791763097166812386287377492244024376682594422064440100453967728721682980263190495239168175165630645693499492801193127172576715209045024082171970584379503316089845171467612073818749723806436012508222961650694837923502984362623053237844681005042814345697652266309601288117370577400490893536123099271955787372061754344810436290944590299838952898372547902198833073466674685054486949222184002754524596346420778716465214194899342559141180499516094504767281920731408858238386922144441311250210995489330487753747349844818629375420370363593538295680714396052116184577080800337897816121339286573664185519761386416238386551347788576830532552719050820816286249220267624098123542416145663775433437264493795517305255524051943788861458145331007260212376271435292965755541735074675999753547060912133490761128162690063812471085221580018410929746671259781353582357352984444593101640253384107811453636203377515633221776607461282332927336510180483288484511361556178526998411458803441315330924508449076143329906947618349395526556712567685643569237236515531174454422759132956640842947641212620221282024728807115468753505435671822083109822452320579632305672070881186155388879930167683258697964221360190924675499101771358748799775259614090745876294868705700407668453025948611706471064599704425259331230241178279141921313909751460765115840407849789205578971916503478590920808580311601817592012955689558856158443979594088618121483241698338395199868867818117729673670110271068668149674791421626209839577419788512720491696033134898027936068978893237450051184740987991533375363545315672453884232901353891746884505129931585292668926507386274878178257644984603172614981440551259981094932199823883956929945556941283260620680214858306890634759716282763881188890465044625602302367309431761096785628609220162660529350818503334992980499210798965087727307876433613834915771671777929622281032835325355335273673161178630545557088511390234237282428579432176102385950441317973440728284467784011112830776317668105415607701351800727810290801117259611178340522477720092188403214413488758395503100352332182171379424472931447207051060698417135749028103008212120682294503730632570241168387060967446047751029601460904635978177877336380851964258581301925268757312720579870577997631544137530211301610096753698096512983769700072645544781232457557239527562128568139324241652816508958498977486782831393309371120230015141509072490142179261284969365433725698583594217329390276446980861830739027981139941628975124249747787901513997505252208846312425524882460949294973499625687472493764166731435469365723376001102783928161811480868962363770419770889894347860462982058312259528217764670671305187022716877815193143453561694160243975770492551663593593443350204687530826640746449449278019538553104601391185098185776108661045437660669694553596281949836654554092835182576591952758136288286995200802506293507757980181654831833667748682246102943679813455116941036534282833543027452737212200683302204683465404574841733634206039164507443004970860205297714116686553680268537451382918517605916982599531591684616218512866344590941373653702944695477424120572617618147526425244049729633465945390206824474025703948047587043253963059027927441691806516067351365146141627697771075541069150425196153974816230431080587202237329961013163646896052376591337713630304203652874125024731236813007535299449732164344556761546053502200918590898800241563073677014619706386585073153219713482270312469872378376840802791455356646486279152963620782112046605626211198642681886740239430549936405529380478441477997565259142652848260899511385363651025354218932054743650978831849252486182652900390218005463052725562009208033248772329441413152791173772102985654545951827180005859591822222486565373199219428916306827357708653107633292925172926488891184334177884813268460887813013862909707159682496246300393024271797321856716743898242343178436159601349386528208103484445753245988360341482059284898261228562427827179518818607884979953382898767875298182971640774489640240362063650935587409723940699742945020969181897373226032629265647935229746364374171513200284122158943787781893533127334564456207515425349208911624357353913419038555341782461054934321241652682177980855176166209840822178094698007561949086673517619671033340837786877225141213577482525619720887767914871033510236921170150375150025392032350938435713218649520585535856155150716422381445314538676128635374945244543476155957725486886318983649464753588101156137184823587728815052616231279458399731527058745540064410091760553269030950465571034390674661169022298795531761770546198443276449437671110482216612912917496000884059121678742519651740963461710436653483815865209044270549639936162121860341446718199395211044598987336490468595949586711120480801955214788463367872026501075077382713342146738126578251035913916813719015486088470555924226881472390493376490920792374764490796494531815822458275576318814964068173057519432217953088391279502364777345111567887601151504869702569951559880457927181196887856880984182290561674058320701519009387373309204529033462002994660248439606695311777674570214294669319627897000115427904679656506571418163027273833874885701812415540241591577640857497044057454620651336808468429798240193688055483855399714408894124226509023363368599514465383607259978851284693259685556720806131711982035120707451797836645767838890462685989908567417936218968054738534250770225532227204659039560915720269069975091782702645136116880907458897982267891979035179540286942347901558178628437076313535123062102810341782535031762852737620817043210096143497113208739411132854440392107413357429404737947617692641158586991794905733642148587006816199925458056373897608025218411882905185260344848701342189635333380900693337563788099651787702338289557920208980483752726900532750575723517959085043168472760962975239557725534523020086103166137161830902390727501144981463143342044429296206997453214366375695341514797278287796010516652970897986887212819202742985902708944764491026273253532666695841046800394282643201186304384666333970622603959189870225181854819457404324531648163965683972320731141246961469429190548181882429705941113700043212672141574939785992580223691622661892771632423260552855284763572368158458817247819414183368979224674444262854770961832986012681754767749649131887949948182755512070706753323999290699478180515682093846355995251902100550045165245995716825370048723677365657310184683611488680725269298336309470613932226642781636023198425789423841762292132580020200548478024562571460051649486492208072679139790992598281357481722620146529503487916303012137956307145916656908149164069157421536526945558088970362713103544952663801831490892624629663388576093172288768727480730117360749026051213422825481436984622872027957622802881998289294858117620850597169863407565908085891827160523827228861449906511672712687798072276616209408279108903529092446738344029192227822261091404909563055938531731952379856604084448736630425583962516541037809046942108643685542167716391345796719233917243664417490640275180114361152887688695387116831046569121934418489161192345452561003802517903198173626512069273139017197474071225031614974536217360305826526631449714790218019028273651639333695539877614929770850526514361683239071812634157510773076283718150675723655958654439908002919881317130084674380107425845914418532950347141256510218636539230903173475407415868058389840827813415945911834366998179275208835499022868620189268729657237291163016456416698569179461772471582550187283407312581943105701525900615166285925279405551238194492457890469111262929975054714075425172740793205706465085879993260283654930968510214957890529594432246165140287325400548578330226693452716154447055333409420736028672949604697955659002072625211328387435132767262972138671688339160530977898984030191510660745084348809760011800862197873625007599226307416619328705092886689783290349825862396169037919367881086095739872817074970775054819180825867602808450175899528067253998989521681477390505040422756358788465027564825235405310681468392831888439296942109988315427821656795237826753350249650760694098487578946390365452318013291537165872128480771302652138078464542465675922776523659957722696704338944564128885834044659223483893135127777794983838488647844810605259415930450890700327424788276594538224967829273733136830117828330850001331568585996879856915007447310559343627261706677635643143221752631669425431324537185715707320664404757885487211353196233186958314487418528214723637541326019246268894832286869262502979352169436266854947280279850235495552062971550556261262890120778509317272869787240051005464034631532001802281701291209130727171155097176519945874434533283010709668738749320856375769028351431526108385832788310997627221371943649313352550105468848023756920396154250423119182102931669524200926694138703801827726222690604614455114556007898262464396262869364955833361288991814389888077050920701104863853619622426401382993437147044146312017902843717666468213583471371403064971423211357246597325730271552146340179762185661886529871646572468740673836192436924967870944973349231058368028668218111043677383548322117807451829234204970520956198028612916749022656355887047432029688803435520383706252674897436715272219014551433599337923316588982976281369937884520986531642841599919715793887008730728390918739141229606267751199865526232052967959274148784642919589340709953169392153313072090558379551733305593247706662674411352235726017916269728079198195516563525715631980357566329452119317832957961296283596644412369332236972357841403603217848852880488374846537300061620516942009383806623434093521085260096527576085250129169931958684207544247192660006008119019680444014321321307689462199132904242101483034958204347680363259705148373969741699512136724661110151188254174606281883535237496201675018033660202023981008459234724517747754813894117151014350189415407019934033745906011147500819574507613709083019710686971577863043139467447511788755411139283882782003483953487858271249100901649427600761161333894270589433935190895826974039745853215060600363965879415489383380349647204440436130879238371536140079294093839357093145842418501517913907035477642009129709054641875516301104675337652308229648804386178667091673058432735588681370281875971814107148356447944706195573686815001578151579204764951226512032235092379265977379065745115151885861391712649146476957912581501713335561972509401830637833353583756386909168410404778110974405006766520015500396153252273055422275092851861731706125531609929589216343641144691675744754477864317330128729630393153598036712031835719341366067604854006823002500883830201379830114400732117545906152799577069533509398393730502302088087131041979364259409706445799469236806240508575166111810575086808331021820390997928092710002203577910115806835748238585289431775800418885349659840615223003990157117435317604583812651302908505638081309079966536078233814825948581195996449429600799065454874789223538833588895032059950709469202817897930596373566189890639372785803950978183259490126958365637439624959208978989276756893395107714189149069946813965533001128452413562324348558203653241390259654739039177382141547831053503274143412986008163191228902834134481228867406031393349600821019485650849176577205468357534734667860665346959028248446057090312825090905055987845940863629569600368248618441631677693493131816152521202437149145970705133060414491789643908378439794456273405167037802584897627314636958764199732522028014985549977878644005596487603161428760911120282559697699074700831193931912737792672757615184230785006445513407382408993189454627239629995948319113727444357372807167292988626885155569861601829480303209459321507423899995015597377169119266019418139998339000473055199294901368595705537095584227139997656960329273843412613800000146943536806501231355463765569795920845356231845997178897549638486331352817549636775267568450697295715856879782878555237769619533821423255481001966308527703041568229153779890174041381264539799689884810027504938700019317660609222307432597171453771763289626015262975431738587411799512607861364366512105781665601210751871155247032148912360467953663873685963690241636669210532696270286363916635403027325824575362277853609183758744479644933443297307935784673777916643214601983916559074004383581444364464405096563876743201889115051358110019375535639828440327756225146335257994239915707038775675003859339847839074989594395893353566106249667186582775959266478918173110774873592687184336313319923042917870061653170734294432118199307322272447355150340986607114693652595381992494464252520611782883904293897011820906668241095009459980759719325648600164455080962551024118202694836502886709189027805853726585752797647197981573431396920320156402388526672533244168187820565859116379086361021381717289467515815009352864193062263528122360195244670999204016435821119406299249665294806291226907051920643735637419416631553026620007042336782487803594946162620769502455638884309345914157662819631312682829626614966594958013933760263954380582017426692156203093676116965062560303101112273440424362547415557775006875073246367198164457597164151200427232643290688485411158551150737882124021806422199588823335158654150528451096263490745703732479613003788664718283950799672207754912185437733169653586104561619299944093008499123681427466486476765947252814186824599614890802807396024361451726796355681025491505433680404544004794429716846529375907269853726353766896709842163415558700613002647604695065114477178780856241743521264421029544283601243369414306557588346275694269572409019949126248079981520652202420458179892353868012111135920976391079894895959215203178961445608695331179984113804548172572078292768729433577298816343134075498356090025520509862396314010257587761751349297340561641056336945553035264241216160096525899480752820545415568153241512025381970125735911667702284767307038945275111530821707144234582345351362591692497046357568129979748131529678140064668442625538112968565678769829608751409285739790766356728061312793984044713359134399816879667846783941897707753410114901469305134248140247104397620540650699929937822578413326526246113186771241467261635957907819397404184017632961255710064019828970355140502573698519794519773931576105421102485004484700164259774030723069579772332860189257977239565201020296564605742243298590538677590111380205348787992005803199929594807818623408367970091533728610717396658588674798341319434372471567880898652266175410036825557689983652185628374693082165501872984190642560546547911956223641410205570979184643013445493814759132505072231637442081022283538972750806800578663959639323187957014010648049984208200000695372956193099198076673416239436992340811010238924198351177345447303287249941423047311784051386940539319669569008121487286924899367933053970629389926799361839625300975332142790086397121383230032961227041100489291299896918925681481944180332339207227632276974721100900098794682473014627887527789878887034331603772785552807602947901768605041937213945936512085879914102410902780477772705820112406561652132444451305651370825156285124830026192196953969891187654694959439756247993440803164405503650583851336014214019217903013465646481165039298695425053257514372261733338720361968903096034371382579150076966684732747805253628534221003826674333368902836370219770497343300225162994277260477932362647695814406768173435292989627053708708270034258593267298081804227331015190429509456942656790353364883174961751364780795913270521809805561628111538077513354923426081921983601953714372783550480333637266616472664433974982846041797696038096575827525640636754886211560240053436728877708023733991738082782779145166062589281712212378046798204901760234374226224553308563786497635564520459795320829062452501528980254897383196310726070284949248292320442615150733912747516985105842855364799727567489858403410216808567429124763699453995444276024161534306179515114527337187572682407669347508144590226656432039053358608550043410338978434651898295365114880930674459470583710773765423569265921271336071858392328088353239170666180638467711135356819065433508322517818101306945590685812227071095394601617766523755716634739391726842420093076894654402700574940716749556212832560557015364847382166932668568271924894467820612252102755837430046810004735384211928909226326816168652048329545725230336815217773744078563789878293128680056178918277222738034350798405306016932338451826503034574922457389668924932181992984715977619300751329703272040030294851034825511739644954561715167187954265480648539755743705310215389294144334063902668009367868660108920048239267335617535695611992957576420445876584931676010480834197091819145628998412798685164740650513965318838538145046060489690319355524767677559866138242015561455888377036675226116686652626831821466647554343142232683328673093779247665026001722782567352997021650935357048899620245407179893512722524464857089300579338688775756123548658394000446137821450002022824368713312600320223674918406272813473680851525537809368760836905386591049319379616382522058774356259868475958198282733802346635397974610128754902023410484545920615770586577426297091058454065841109157426186005921525202486409278096434316319197097927599931482545537528725579600061695960482343786405158908882646469769731424490965739327065936612490268553969484510433550725856207800149185831824889960041976956414820594383035853826548487740710579540311874419199808667036775048856504705338369795383120805522436963316946998445413445574690157259435477654515344475167716491279956774504613386141453498635080857056229797930420489055098171323953637092311528701315377654042400946305502473338248567942418391025905311541060992763619315675323895023110627343948462962610428314741344285270833280321170087341572732013736486279160694440422625555545750698788315875426229379216889642057290895539215304869471420814815615040391576573197525857190572942622141047508912236164621654692087874534081942405151439498361400893904853825593515159614891717327137699655121612370934863565686105333150813741438500916523725731493593752820276045048567240064144817555104931064884448863099849344768094244603273905923257746860706175290656411995757082552573112302048424213041232600194930231846630961189772949484444602919461430315488663253843807702283061847512801999100263288679274626420013427386134101386685007310538700191195012105527522404195293034325295299575974424211328649516742415918970450800444933928195445477043980228127556553477675941070986384575652862793786894579610493737808542743858774208341448500798404000928179105413368964309111903071813971406466744811695034707523174980135284519789767384884130334338085601232986833565737142531386496658317879812273773239446052836328353181665808763848557229852905830458200395482642090941791973826579498762134998095108542413106129278360565968309683522472638908618910207333623878686476130373618031374938560664880624529856058326089480679730766051739533623519602815285496418824301275568423659315079292790270624709273553734649561960910545933157813649279892245125366187981579965413636259587219122680442837321345171627529828543285871433948336258544243011040113664544591296441682524140476198104310924485005957082690171571691374524807396777928500568484990877437707845153315986463618338857244091489141093514141239006408120506865059481440633133853851368875373946883138734471526865985970818227034358822619807526740333156338454863850443121835395429352267967998123869614687266581823767555633758420106058308687711669935563238531737402733162135930092904839692069315665825405914775773654154189987336924290506992541501553535434024435998863379460252620772695502130855286221681732796190145149376206763806400519680052504203862869479227887931956091389783875723719920420192560428544153759269698702391198382178016690832206447864794184477653761171257605724645179327545267626296322477280150874192367918549031860789302930405038552724777723533564540907193431334193365475139093087328761444381965283389835571032006252673972232041600109427512008643036034271405315792798313316181110967848046520905253616123988380651759565176162463661400883611874747708559018468695116717293278288619363618809289516479485311469534787983555143379228460503863514516012448397608689036110147099907608133605847813321806214426982999949028638719823019764522414979012839966911114369621168286988224169668992471018603188781301417108065854273557759907201388730171040141292784835349539266195186224628234116979514669343432970085548619344365098512075004557545780815146228113209382268609004854799964100310918693015721358303098934925887911515793856513123367011050520762903952861738760090342474507189272364270072010318507915487805629010470331462322221005680859437286599036778831328856717958603667590378309139679352745851530687338491145729481830307031562811075871601533575655286092239140815774319065844386878920784726460459598487610949247016199798193849398002466166085942859692638008715212317888019042108688496539654629622307302759392201963602431096776944618918271074064133723834554680028732013972041300265835678421320258519223437151757488289189812784530865854046277565206674189886507550678128137427749867571397584134358452791893931001696780679873329396265644048397722776562114450853683064451754730002931071994534950247401177666179759483417010116471561676091387622254184808716390025927664334902644340671806488264353597827421864636969291178244412728854764421373495751953368223308739794914155345397506972735024525152905162937857356141260765192710619179843046342832712134263210860160398709459085989459558726225735848911508919622596452262170849474712710073794219741740005477051639579741235962114348856319457727378367321925125685068923264629958598640594382534666383194515675200426948195736296207673944820015115729443481703708599045825213715358337806211762923339865848352903614067392237468615867058674426680548685810240591222173947208512140037972647094423996335557005598466116893718169396609836706031809704254061552637114936336142860632152712331586569337111258165598082577749929515820869993421620910428020058902659000837123739537169532325611059609029095771334858252536833244044267473192456277100823487833208198429382615278025812479002652786195588687613500918378429421214009435770280996327198476175817526940408115717651860166126807422811306215456474642844753079546672363637498058375290331578169776969592649177428959130250601219917441922452518254848783355818792085151859306472667084089661487301734458056072912151560276940757257567197772039369028650633370632953560441907851823804363809163761200769675160911613907404907464404803598102118378976095675128688360588301632597938699302187857064044466678558736363736354911980150109610372452684691487971195607120177898731580642463770950644206787378859660870591155202614762084444135120520856264929899782869941169921124656983428787165917601280007447921180712296575505731951869940073380025712686237949495019200955263145822214473244246236449731933738704774979287099791308191242676531146018553789522300238608309961234057101077983471483532490037956851242880492395362108641516499681057474110243017339435201765942068486811556495178965763182189748023649292142190399962836741228644317983261807212138894887336595152119026776257946627881572792588395295934992056083119254434110907341992892615561772775813549595024257573687979747393769407694634961065933553642900477703978599903482125453572778955154668014272049785708404415397404080120014218427867089468810631870189501250026369466783045258968033698236834896509495337075936951655377457275667375609306726368248691391343021198023858257556659624170746742377319005930280488207807484572173937491820990996794944055430939279999047731029643557367515393450656316257537484721676002469486765207618557799509296922213332192866588930053312822254506469961805277302781035056430456637878696730498988787223486038789139758924488407852139354670733057046105835261668062638461658525137792111608842999027755713367356662516234817689532422829370948240065594911456361196923276271414934897605310397447528111394828914064782709598933894585323981634603671795965247676016050082758505413015008528163690738191695264978685421035455547086593696444832158515975953538181413841645315353190965016736372200205374300889747410297796921011721399050632367764933687565152710791656501076292830057401549663240478394941963838441989281695665320208646913084244027507721475574799864835650920340709792033238115827630101575332819117631545277938523262851695478968110277363268626378095811073415284434385721508625588211901656123852828330814396770536404166210792182454233870839248804864826722441489074050974742961616987730603594204222907479813241937435762238352268054335738078980217781971636545477812605467494033530460641938053835802911307902918248160490867386709640413099776952266420526876079952673645097794987745581794676520227523789268264088135232035417752255053569716203342672986917900968141033976843395257312690915937521365079683588544883610019546085527811724439662550662148313960337938377907900176909416446092818519724899101717162459033832677786885221851727468849096473108506762486366257718792778969151450661099567110361485928897367929576686641057870914571942582034568995075797637601281149183169599212712487400417681952834677473086986051241850931515474550926385080823855169752461147798999261044207001791057914711859601363114867720380455204737807930412324925286315696566572551003896053727398259856384708763573724944475279173268890034966502877334114044801259248808907389737045045649563432736147319486821763978083155977762977837969732409837732986123200313174282614212911239528013286956839797773071981729177920646500378628007335193520194048806147441574128368171640347363173937015926125135079854046722071874294433958352821324377652753953244096357061266588182862318908346934052596866088255305447635342192023760607747495538426158450717060048163912214697991513252194059139157489080916665742446622187217186277637533164356760935541622096138026463560133181068834242872723573717396200586262513342625958009995858819709881531334770803814046632256016071189781897899571328806559321372175674339476445847858880611098071788051752681080624684638820200333738279786487872774317802438578233658386112353270682202543648776318580074530161446760550121928254686888858364255344244917484771877607268030199948325915983879592642850747686873742438277613577491669638644811876637284135275569132965146206120403377842930398278265042758803098169554520860052497583730914291361772196788876954941987071823213461390789885773216720926383417565489621745280323825279297350297751892262594283310853472735692962178906682374591854176197456718689023233224923002638484884446990564054493883591365687688789538821526733619968742727653164157319946145524969268409375692245573049561736480574029295539479656937713487405935333166014021085009764107220432525196097382760410059245783574332714787690702911249718999261819083416681480765773058537907927923404250658721026208365562341160007110816721772968303893474018825990133202824186027941358954441836563419263354384572477588049283762943876952595785676086094985160377829853748976852110043101469914498044486229795881438289791007328963241470193864134868704791421016900779461578813802776346167286810929729522095064147938535301544824414908372885872354571221314352005218513565406405614020713355128020850286989272322391337595804501939050692320858087425049959191492072785512083829716709097037396040549395006774223913903931214616761346885012619706414210887060806537576638042416638070498076991717888859223011112094175746406930301113055010308461734727355248478508217286135472315441400986095134246568423059733313661889766778708169916782695687261332248925854657968899158747271729946063410715273093749317366023741353285087315449824295777924249534620958631387244610341601736062587218102410512731401289e1 = 65537e2 = 13068528258656843351215980636523400805767052127160368459322336576873719270809193275761281684979033682984028051142164110441325187440800375504445743749976317736905712240514731684906362018040629935763729933217836791475583842363882699681750337995678933481576710648815887058931025473312650896238159279663267023240416688185356452243145834794863231485058316556499338511170411779256750550554115743758676667495379457650984203155364598307005560852000640946120412190914411811545126327918691895363989708620279861384482177486358017774947836571350386260572375777653174553321507003198432849909471969049265760014379478483895140682244548880876020842193562374141716596805494874923810954747695555062045258079464912500998787594412083850127440151646433408797062770132635354727650422467132243074701077774455150879396611121239352862190594418755096377627972183597132450823401272843787832652676193094554396007329289548025654711890047520432839129188660319814737370459269849457863241899005410422096621223123199176248580807523042640906507002382874245909841904592266476151051937010480093434395270834453013560975104552908649979087315647193390548566279778141660393456721638987203219318881375077561493052092807357362840625571015019796570025881985480558046310863273233016214824552738564880602032318592558576081523087065923607118615260198978658939113564535853980039103436548043394076542885200622738870736674150952112220604611568820163021629339653438351108907721115600516246647224937682366757140607005233811438765944860480359947006801590437468441676250964712142501735532804616818361710657860077926045703957510626730002435776006550180461135636515048625297899385795239730113454512062091431749908581722589184609270284627607428505126783980024179583254315609836896441914326677445924508316209341986266562038409781281688364083115404203483004269726587922183928315020296793744073986223418071520036875452424584332076982198153390384307445605344831643317842720245151762835575398966862364996720861958592828264013541531215277772480118459931671072758217946084632270036754576795551716774507796366294450722900113708194812530633259522309339712168248477959296789698077054844626391846475138857301928113514769786024710868995138963066712919599357687264750401773440964643172890671657271531947914652867891287812199349907351161308589323544659389811942775158408655305124250976584989616660099200172980780225150153067936652773073932098989873673888739728784308551899880644739575388533615377258052705531464075857467822402561960059415752312879238145179662768181310124857242104853265686799895919344589472812773157192534436733268275291103024479899782616583970154480902376510638343775431160295796715219122329463277039709429370242376166100928644007644455959242940870076450024400655487089190268479531666042554812768259874170807162759315279925990561388610382112627723930839395717824256318201381836799219932046263823487803636777220169617549462929528339828635247146286227186146756375624212570893078362414709685864024392219837890472779758804578190215359455139223594903040788111942911388948065783185034941308438787556376135088975849171653979596399889167677276870878206145390131098926332384390121053787690743790067171765711461071924973618060469929826098590487873753908112100072396796703877976070037969362735490812533581576667417681812708028086445181007614376119127812197310580160800166884777665676639195570168919288294355845170456624970829632021642127592711053223299608497441069122609654300066283945582383129335165880056971083322077804695769346841905518569907846845814153253625069572243047322724231368531426331943707202366674069144664590286894049810420244687960085592276307354386734400306378538836627254024616892075769245449728365617837755912593533875711126425136757205524693710885603927833880212768096700762691824511355578673108720760578141814290581418154580024501648311381682665049442239893872999951288718741926408865252457665557074460687153378414371380568618197777507859477505763221820572002086672695598771461169903402985782824017830762967154370922308189204831487925949620399961012278551872334932321432964787075365418340344366026036442576238804001481629194093657288974209116485547070145199618643141502475021560545638004262547149629847048914751274886578170701736841904314144805161809409914478074380025498981008072905872341519687178489401882434526699027364192544999168820335024012982870697253767688325218651949314503010487956933276243378114249367779519297400233056071591403567216037429008190377848712138866041752234914042348660106561970392673136526977375773548006515043730874571532209960760384678946313526248941388318310698038777857055900226353767417413874423155156400195181407550567453539649271774057884528873722077185443550449278090576311167008242897989096024568489861256600842929637257065716488301584482188292529422071013813980941648610929322201544056476361850750297653194508257247625159996656499727599761286999716440287478477234121057944293718031076142095764953900203226015907233150052593973508981676794939545973345721848678744327693188891748160842302125512363914119825863468080823495244226536519217091075407941199431790968891709973484466444954169981507754642795912442916948493876528347449055142254676147810177595411958667981482671971623829437325281375419767567122888176902622080259496051995702217133098429624573077468931860331654406365211318885287376512473197502839581932984857312487217818145690105013561678521652841069431430403948947425281902204432366522282620928504815400205629653157751645396788895488079335246967186547730786911270865617820809327747578735819069543410872683404997713733553639628119665516179829544003247511692840802856162762127450485562139366043202098297651172601939695356909327396876504551473403058401263456224868676620531909287210399007686092113452067353787859635811701224058820449157932278899096330968871915869885235550594631486710051976137162404507222088243064986575980104711791124613026411741079195637867830795504300751208532918495115964821346097990344579466097692897932467960612081270979550897598245059850788265063348396619172850318500323819279605471040554425971193186977985517228350976670053277322118144531405946475726420798662057116149501200559528623893312832897784711378471684257530809029726901352614298318406124679486870942059677569847355292290883595981788233078081218044320009199852119666460771501751941223741321323205247024397233557832652120425348321313516314280449935238509752650324437375771729394978283168506485611578696780300923072245776521818126594331435195003437602166149045807835934512281911922765460415714395627326849714124942325220791192113273933485103592441057542573694396964386243569643213089248243227606684866854236983831190010309064697991873298343982319733247434001751503599099935592399980340520005513476999677070196493094558374076050536644538546444454619123285024123679809797247003866162611419979489623271655578298703120978874982382182335111821299869073397900764639233746276098776722942365853464051442845055205445337218557671280693078398156861284528248735605189799833699959048225124175638154942481680470522804749588252551241348621096754178791323102988943817182973179228853401683209092576079126741835251016926939431465784368044312440366527015649566211559554737357542895197996250479183641283414085259265913028893683185263790470148739081471273372380079510996664288606975603752824486208409492583171263287871347747376856776112822317160820684286661386801561125078015000713916506913122162520733544796872797936085701847616629240315585452077288507399475558531079953243569363880166017989969836765415214923170700251637651079630209494120311677141037585235310997563122816084900038135792742103594923819878883089953478947962037097055121696233853784496183139710253785726683627216276773731287384817334573073834496029225814201273168633379381910155019034768156676089603201391347651219866552409474972009401422765585926872993773569007191042921079212365855260475014096662302903589148973029129824078445199628693452047418875463860093363624129067326608964443937364718261709715086704975633804152970149239192944126104195981883514083144218041054612300306926521104977602623343198610583445214348068771922765092895466127099884023328499810777320656775616368299866816049839761035585916619908687531559464525050842086462117752270180533812195278966113879708256172857371602497058251676247849420740943739345233118320441276012887811342920246065283558771336745086018789169700932640050935908686456716806902056365645712550201034453573368029937860093345216577345120485408422392348981555117946945358312235095297642474613180885780837783035930271081982522292786841981122063122494610432006660727335573814842665997423527699618108264925081900115516297482038300524639594177721081291207872123307318582301386386310771938260564929965017160232755140200706658380227317125678969195284179564807496958013474471090556290305432322833247035636558174709593387189409858543218926979729751027855195912337854594041428624707079413498035664021657600104293304774949324942036143995800472310764394342723689157406361214095489197589051655600327200148083309795022156428540706878434422885002642964212863998974922399769110176476662405175930743857723475734007933283063699869531678832974352541893693919099855386353464999143574046051675439828685327678812729649126160613650045363170492515056152323978301829293036495037390759028099900495974963259948907185983574564302836241052633924383999944694951367799221921884715927580258777730423527869036750539162794757537243135791998997038738890969316619185709164452862746514829564900423576515602482391141358286968918096993147553413762340159166272717474333304566325819367394276018461165591781869705249385016715225751602237297649839346633002190724453721589497695764415546299785572682678754808682897199062122487553018370410185409578104506048187655586230479364257059533621847124718296866846790253815394454371772214151181142992773563319767272562033029257672705764664982578184645322570602419812714117357307624640087764633981268132217341933917295136063043400295749193452014007925163610812969279461446196441139653499969397962270541226596977632803110834232371069702454794293118198197754496949729156981488109592257525210840449812028702618816093287064088355126444116811597266255012696313284071970724669452810788889345160547914389110106123533065916567383838530337334125055601913540295586080269744321528955681871677388965348862581446978660911639276130930134257279823439442369040465432837454665661454047469122904080096931094735229963550719464577989115306415968707750916326465475998963121233182049981375496484168995914749690831909446892420200501861408751635093401438590940156313830993577203624690275065553148365793321357246396048970493251165043867588949021545287384186657410934041083864320781971335910221051447596879576328757162028112366496953308863842380770417687415594956380318631629527818597740375090897893427034501080793814980958582655051135576818714668492977919972639728971272878505464631269841277234226655026927486988683324283884501711931974523926812265481246839814755810513754292919916734946748897079771088513974942214710256364610626584434723688304706528289573415532936434447268630216558045503599327441228143256855414167674853269087880458453088473356260790568975044918991151002377635602639625604936923933475181635693231728377808566149853027049272271028650725778185362168992924646181857209663110947196831219899118477229913608913732129281192285138864479420819988699533452124551624102871257624866684826567832037247688601707063959052369810190504944934540255891156434775933386157641617657273767138379722451151791436988303671627139904937214229645007510665336182532022755856560107596187833511720463511945137904433033596406764221530153089211183125991206166287147902845016905460497057749312846495952112724385421942637273504011100228342267708460980639118476324244933686627279508379147341494308798159722113872530866005338492457060363058628104274154741800825076565033476919862901522246995049114244153123044384033827290107584235958413140390396087233581270006920332291800920282680831037688596064716572092172801615546610744552687121714321191091685114434590128094593705812324823798514428593856700069176092773919508685119204889228534363934894683305991886762630172403384695938870378399788809965733266814746416267837292525138893282127777782744523219041769598492373590134009174998151137953489790447252393631472606053757011576222158789211851489345138835947264684673869319962356029964749997101050696818623369520762542344514305892069803017968313910009840815996326998104828707993872112654730879099373582768574072269038680982939356559240529986430239951729533557433156855705513761027754562403597812583981800414156353866883590933990489335555254590505152907103634592245750074334132272704569760068826839501037801113612678119001966274224248100920978282133726977688150882909560183105452992253802595782964406935895669930804915235836308119653940525260265552153539515884434488173289305423355513523531783638025559382213541204093647268908069330967951759759218021756307728618947048551194097348141320412295067802850430315970412994298093123038584384027628247465509320522678818121880901328124861567713489691490519784234742543644360393177653910103783359645246918967340040660787940583350515467227657609812450667163939978979501662087223796418825378578198380339925318284710948587553343299919612218158689816786237782711847456546493148624210467305294385407100488342110965122042555306446278579327323138144179900470853875911331512224818665900606077096602637831436980131977328171541533712576209259356401502212551976714179938453442991418387369524976859313764911886172481958015023023006085048348517516579780672533693490631784893170660936995209567379567601564018897567795070082626277330756663600339570467994015681137851659309627409762983150476543180228958519334461755169372866782985267152026774329065255575281347694954473772431329281047856757979579203836078598156278715984253008271779844951256135626832421365257372633739118231992786470170462124924925255751073940694568742896984770606669249913624428650881752377064659130636976752549711431009536400157136905573958061401058925451657223082399800978198499715774862421808935379756692778929730181450063769282884563121817356604233705929680853427687310141787652525748400841744282211011502442669469076845985962759857203570096908538389867503289905355185051202646743837065625025845499857823828497565464324843515440256448490830806971648058435768036146741133101693668984373220071845716425913265100643994900607267981779619786357165933300016721487510076123556511273013894822908142142177549512765958030915714606650050314088438777614658040078375981446037541834427158334341060427719380334149095172771479935171016269908359573063137368868869382855270121105652430914201580137024982991506032173715122014994026547240573996091654391307223258418755582082246373177485557028474031091486479105977959261461893721170164508320518426212230005339422005372904176187069870794323953893006473688975418564037048424884852788112236529083315733912462856767287432065356310568290320434626372497058902884446555438058883688315426231398907834246008466037259819869082662455682581123618239564676296601446566322175925222845272418601734985541686827758580466513927457680298917755778582749356248307031605817960766465550277288355676733569856653696901611909628070317873441682199096778482419586289088156542956595659795979487340020069845208556865540282502833259590580588638830294148952959246146603381462482749300045391067350577989646854104814187377704624791157548788875986845119189116257311409050582011964354477399220881190442174085614813458078573876037456006479178521595439036306620904970086854684217111214780409395458498242444681222042893098871447611224589773398856317752807329676936242449072822871766870403048502949157972089727669705618659515630729867027613871612687187970276704333183072604790412998676171867310359434192351453889787269101156308285792400915817336019311630968392579103024164661941721943597830706883918151891512954802166296264586048558434183841317067861671712129146193360322957929277012786091244945207533553301996377975648779956447579548531580726403720243918328546474402696484741630063473307601112607222177648283612527239730960157928440247669323714441495520105926830802687033795066831094941686851010853788050353283662007851492100246180383427494164666180047027014219460039496125030474652219982162870007996161948192053962911628474076085412975181680602907314864743442065054647243541241740374902487938389243915792498985368854497821361515798926302294720102100047698637848077998071307343835902677454332048180190836117071813666016250946671071490146158942099283120710142004255765820088592279757024466779071182500421396213734999832351622804465068266763749019264777423443899902545685815323951154570966153473010981667291900628716772866186682711203592210498684657592468122753915530908013018582823372965447225634983889057093635700215973120306155970019617344474880759111067723335495434394132864442377232967881536604862786695069569639457478713603613032972130947355451805107758936600683982987111714503811809713259770027397117107958478567678844515116721096892660895804982073064009127908651906265546232216096264476313241534391420256796436071611189649020363443212130318325893562822317747534561982191631043384818130128673984251100557092519293986161552996799408987045708703259140485225454137447501741903759141560183832875577673866276881589822131622020557654988008873469366801691853835215281649384671409081929847864385275299521485660239454413661487192292627553859061744829559538216074063660689906641016822716867536727980820814939127880042099799724794351370411159621190017121735373565829741659163964277721749878504531429883104927931002576172046587597494426652542135965118995642508132566325522324010139419650253385438405782860575071180925445788225180201393386936040061238168831676888004859809840774973863314431817438236897526194755807081900331047386874443496534263872735104998711797728061402778138820895205778903889789853343832057132746734126629835260353924943367243769890792459871271878213530392448302543158694861824031589780513313192660736151485035680506432447537825384303099475190501349970454806293577684116760167497848512625100304515241495666813537857352934399302732612441952713947621805097116525651460259381419629509603107156980295340459922655461134984546551322067696413207958845562199056130837707835213108533403848196363311814031805686573655493979077635102650931461508560327040879143739972428194071754593652065870538656360563978098296829980852322001393208819800680419527066043100565149229898535471464375120263177592667861551759397366595877532070592672244189854784339412364833082518648862312819788338275554911012715731433959820701648356069338346405896692335436654413490136418565210313909274537585352565346209783433901839252104333484655303243365078757716738177972324704957814424393279824884293385797102033871999448272524257460091336774688318656721033263341664065266015758427840606838212943951411377886321353152774585031267804264385633413615791223112098834064815615284915621921546537710710729719202725597700450401779390869094296219094959014841308998794977355469602576021239369923785404166225875124288935027040739946531883533043063448573586186949090218184204140986294830191586185589849191620194960966314212882859722749264009222825736086358467577323052087836185605699859859845984861686080439902287859367726013684008489858824436311955327403075769483465992775483071428693140473674648198027326495626495247207935098645348355210333379917662099285588218416006088597284070639250253023270758970047524788440627051225486785017158777687405001326497352203367899986397472618914581426617739492234611731639193983682719944793271826674300115724416553970850285773359876523964194348334000998565060959987100778227445688465349895880184131092412717169062140476689508169534723985488646529676637686903731757521574137326227648265387755905720627626999934397252359595067966588539082111626875847352789574973730359729681005130958326565295248437095055053469391781697443979166991602886626092357550930093832656683337005986961931426185203808625259516923425985628334598298629314401985291859730806249607315526435500219372334109716565737215230540039941142489962419332478067339443089040806061756506378795925362466191017564308488603348163193040446719595157949702806058866076009452163932607698854260848309555584983723181510231351930540520156719802101340787376366835948875835760110176356815838199402869262643217914283344658409239199899511651626894569740457098599024192043365287727681426780051400556050331672034290518295322155488620814192648585899207740924078288610790861643721232830582258918517806922702022354198552196744236736870470802909735039057949461204137394627899203516884517283083419375341556223824859470804446711596184631475039804772138678293605747990821227744300903891393395580189929124774727209285449402322025674628901229939025641120656611194780416544218526027424522705769335067798346151166761556593731457008901057602995562356325880689950981478528241522364419063533893061259699535075900115095385943940346547363419657680404799048118570238428205551360914489817517483920726193468182619768888115670440195535255554501306287146688055102962291741451732997026057265850558377630875986665899212179871525170292451030394520002374889120249354012564886518659489221000542866411760494073369854597744363926683818275832976805688943460190301899096420024864418837345543605123677684142045844905319797819965383124127303538882559024269676044273062972886484670702679334945864819194775497329338891103300992582679816995746155283167371248050364285071457561261685136272814429779183979107352893857208501723906010928584839705779704499572248120226778081067278133136715859659274271317683783768284031520784266080242539368551686826986825555720219103530992960973987987864960418233315383305786459250728524216067908819103714755989111261713971636951818630497589627490030835303334632355321285920835153717428591946771961577005220369658323758043124308443295475364840834076284442814730011732524488764556415356525912798352858111639481755686899322478186887520764935446028733594841559314494837160786132543685892903962707167819382975252456829983155435486119994938711771858634109896731952874745743280651546932354601146098052382134842285435309200359765595574164846682695181577400893353948175689744391949449236317720805250447119483854592818803943811166519678572553579757287851751265450514571365188664142662074122690784934265319770354555670117793180878033065402909306219681202117191742543659804212857516753722992978295551338911011224109288977008661737524328959236916346938734324029456721654324105898743886180813118077973511641119509184906723040232126955632984214318681161641330687868350611891137107336784463159066180141850358931212849187320084596474847798559052249382509559025606158723276091009232032051761479748504278119520790059419298729955882432085889132637865242434873772884597936554035905131684504622411738358409453466080090555598254508022908325995123893673710620747600944212361048712234287843272908774512711438649055423774082782879940747275239603749655609950110911964785497660163174955587791534423599090765561358906108614508056308482158026891677151963219171405474569347750685739998817933908010603397970506005321554602823170344111455460068054443201791159633796515260184354688879926558887504160047444246713312968813334806197202034050004899129715973441672301905720303773040151029543276198042376747653987255560977495995261061478338989517230925758191997542612545026495574703883104253814109178782727262995742082297425738566570457259216392307182700416292389856505486802854326677398554971270008146505840847110732173251564679552765368831498685534072786965713282738934404410988807159011360270849570319179848296859099155308849892603607618915489671419829488102700169975428813090066257016907751195491159003696808746043488037458787145843039932282242546040622052704432859321434060189823474670065337776838549619448316330403497671529984468394132542459779811516740083874026124140518261351399085335465715887707763086253366328902005952044808186076932356588896729810050785927109600303467549502826252638506339950765354229534299782999925476425341440666849711050384908010855092405289895436357286750118096419225432077980018689067190422689975378738724694722669131429177810917027126444071680915635384077834761560463665847111015051474766447224108356347586859387012071758501349383880683530091275637578080276031478020068074701899329272578431547015990095410602021373314179423325475392494126216900135984277933061330299600721059450316467386332050916007944075087235025139900113184414737473420928363011705718284923026018162126893123378243402079976219851559637504959067894494643693044103432579206706560770152487046685370811511831730878567362444827954899235420402695187305100388457597573053631274350884872306509857415250217856971231100654064190990707987618003517410165377055464913883348299944945763486930945939926091512859149302967480704757881180659507827362234599450218799532211639557339669748320591766907967159518682438109972919563140657192176818534383471306693820184050330857169845213167724933122199057952605243862312693060560224251441783291900596162879724836469091801520823796578803732562750152703082431248180894246397188470221365669084105262406040927935663869851353483633793899803064343362210700604812616959345493565581546964930915432527745763954358039933336650529057039743393925860588517994401729952326843347369177669685433217574347118716098370133046288600398274702229883305423731451080080071080324405104823410809529195495090770277600786946818816939162481247979678575179715906589088266998960395142243536830486779479504197361762099067693408161518299070985828810512097087308608219180060335799076328533946248780358548275503337966654046877309791337792884967453743655987311383064630292232746754426643001140759516027066642358948628552000885677431460523188912339260630595599878480454095890039142950651129909321720827709553164775389521403686355930045157374968088783937564511333085345716964410107823285380034061956363611236398123243356852896203139477025939347833536952114482522026688851311811303603638702154037251928528832680895962626087816767493120265547844161283746872584791980707936719759445645012242256133592623886636902958596668321412036418835823404573999239785192668617980290265320179512153247542432073852483154757718130957526232875984717444391899070119603793576473300552026967895627325618021580731775558592674833598832664188016854454711007869647866777220587998043292708252068178868164352218537521272310927478268776091406681819096707477100597396329657009335151926152436861970152981528625889574615311378071024041392075028922300226246093951740762255372803910169414038619027962150737038673463231143336301817289100170263492393981191640591761631167676909199544636510342644892437960988594511286787783816195385459707566679971961725986274877952867550310495300130990300064323647510123026280524079911350890270993229330077930977280700953369450526460199387410370453618229550474883180736467854448861093144216649654792827781420971227232655598591259062990602151493000386148131260444271148971463828307178211244241598447940683247213035557527249760561913024083714450377811499356498767293673537925312760121478791537967635508433122905284460930432952675894394184834321899065519711629932875590882776594134678758854937400255334068300429218391490281166052807434707214267483015771921209733806014664036398270750050405140486879654826007619431956506516949370138167941197276356627442346951304258979136765738466189979598575539525984562291807685417852443980236194198140665875919065597398710733169736372191908150925625913714030898834818618016264869580164661827501368882362959808738175033872022746476788057176306428117864248855898108486138617820053476817707171733855003891932155938054806528790051828348058463349559682435348108514096912314242943556613131351335348847613178130666239702990114778676006487239680858404869449263068371206431133343325787623427104374390273932896941593976032336270495913224613273593162473312272894825820318154045874291178930336353207970535924004348941706849810473958231726329548129785516747572324517593938915478788882438363757569738793848371170882905319566725214725480448013160730764635640388133390462064893282218074512563479195197789197638990098625990408332923926400978121680259906476608975737593094651821028378084798493645481963774565298907843134753455543232937817611141712505586114712700317236371435296231363247475796585088879681035933169361130798896189858925716125724033308760034456298908760995493453737529787288229950995342859645054482947541364605771655549282788964526699736689812066250863044641430313131931484650473925962267667315261114259454158363444317714062512822886448812420791920151865045410441534741952991341576813219274622671274347565997083698393064515372341412567167349695619129127702388955603152667269244469696358478383203542042098675570652134756098207675948810150631020498179276855878889486374492765764617536909763745483890714073972655377709673327555989324623284077046440759388244376040138618310873214378608017184710440543019268220128238737188992746027553338398281778277460642539041199912530592372755174638402983038680391844202826799354900782123928162889700660643720219552118482931435673294887389213365044999762077278615674682394854883860165920747950097837851997704646512270551307776358544832857110365299135956964055582037210061501646251244727509124139246496062502374346583908008414434681187830528999195679322699998680306418314396619878988338216616507033504709546789050502726009918113012707717347179844287097715903408331015884683231036315601086621304518345197102049284457193080084761189528061017923994553937443829697899604218425230119002038268472518697663592894711584094029002073529070221882736369944998445591074303908002292091377869440999298827617324015733057576620648372732303101397676607827122833331657944502067384696304256782760962376244845913291371742624314413097406483823413246055163409760091856544248770609692766863142668195883057947298376368399333315770475652581425491680349136889238259931669431643571177656052095146460833264377248486705001572699519688651820220704181636091824262541150570552035825735981828431076864963572560953157504983486817569820745010451748000710205053717943457793015644493162513147001247491236539744570040570969466880480331762241085620168730314894141046027438475677898586712909818149735277398085488625217065548724557704322205051033315540398497990444015350288394970826305646324317596828489374620127824504089246847418313820000146224797210574492263965386063410440535840266179815034338459667898298674151743292901928896183184394483923220000820076415646134056108146361548642233328236061707780967943736798965913494553262563302049515042429518847039386192886480414235625232030319857964271057541676256309686040284625627754935869277929206723848166018088610533088632736021477462445638805091420215895940176478313698720867936984990469367665275127235260258633096686365330579940601728325094552398466153894837167366771498575350687926700176859265082940689820102341593351387113508244373930649414992823567385435755992987391952403089899511316805985582753043088477301617157178361926975740616366597546641711508039884212114053891336931773908127080152945561482620466573008606284923229787019575167585160641729668177241008804996995191451341125209482599562917395474303437216447664459407786003066820361182434703128917963227544255166898430031076966832929713754523661714648187447942409660222603914193242560952885633469896500799673060608454623884573846607601727666053216420234072674872702808824025581140163953158000387051000043345050576126800100725653975842734994495196100478248224062118856670896366074758617221667999438935558021217249480160493681811451486637406463622372145355411918417609837954553176978304991153225802791992486830712548125569094838396454608708314982589042350784393411121321800529244767350610617069738562354735074192252421586072904452295285879856893714177148911576197197629827247746908018104047112831901408237783468137837474053492799463662501321511342981422952652392461557085033139825420806568708573305328781048079378101506393198736823609938254557633442531991649872154526060140271109185566808331437900339875835338669122076090764908584171277912543202303279502045298851293241633891230880016281534302386398978584605231418716778845802606014039583105352023221709580644849877428722971852612681034272985711555279468663879866535098566883689699872121013605890710630815040293736658884169041264087924518999818218611318657029855776409557293874607921336773602028201641950096206633459918043365840942430843800947193128658990678531609406088421125942450795331970634738372790440202812190061556614474151436154676064677071026598629554780368848213230959409413587491214268014260000733059672916958876063548205563813026385272343411625288818815060384641305594563772029293655256637007318807659596109649029874548256058175734873477941184435701163168355336399798767740562592923898489602678690111171489948497900217272325379146331589233780939403154208201783755689501020792158836295146067266897621763810742662183888705396457763085752744320990822576208672860933542294470001436642736314739616227585139104022153864640319747574459730032005877823474913129665804116186866226300541433530038327371547686046054163168898508613245230049235110947952304082535223790988170134942069491488429816363592705494744485924830609489466288667047164618432283493577687466442690358185895147047710256314655420701763183467339071756618253487523629512330504141948732338015167891255403145586533802572543388721331783364043742828814325876482092147204899952674316407445636419214769866934418224752848614976010728744866353343664956467161989136494417527351407442652489323044646992022034689339551469585394607315550634844193160809988473653340849181694498788706911510550447228242805606178553029700036608721644763731321856625275378692543005529517745736430523583843865047478176710498246530011489743914735429794473148012640341507534920795111978219984880322457621584982877346766871412739190507546471103081151600625058725477481885320807178303300119086854959042525393184809925475639084265278137124565621710533393362475097367416445987524794274573145409203401465578876332252248798084136249797940793621864457343403532074559323899340227804264564196955580839239607226573123838516449538002557182546342526665173876856335301201903013231726593827643420820818239374286477158014402734067698715021391069143021546696909687038009803555590869647284437480169980923817869282943255254690911031431297939665538897933290348782873933365819967787659645125131290413643553097194023946383702484422555862316718591711389615887266428381908850861489886688197763484810186214656322361945333073251123851205062880378516158201786532948951625180758326326405036779902802416782171168184708984031207194163741001532942044008567931875753027061404572492737800082216328655626499499790784360598473605064106277862051033798588053780387687679909015755655727781844405466837773686806597406694863464900680371761120530076382551278836508697684746198328599081832929302630120889692107050224267763992600021062114969194623020632330119216058961301357136027876765014978457592001792583053469769332667444527841111770399297030580788918926210165012822140038889858464209140483063670304054834169649002316755075131011819034720251364050047466277596684730947430310469333276603590909682398783150348638342967214604411531256372188940735753228412005861851234015388478689170543398505346694472534030804427643155127421771578123506604343332618718899235667740311716341588453744377542722834815020566445045416336444274229152372125642896674167657345803130477223515872014728416501578052850127415987554500986241776869353469506680946185381995313599852362934295192688026161192661028498189081791025874559210246405298195636838984752082673199201823070437959321321707998022759879416187675747189137388396215758899060792236267779006330798047606571426776752315191045204234329980242343714650322598829867132815583101679792479844176909819536264216232534886192266239866190311883798655796770876224126660810472823326687739901091419613490308151315795689570567282431485916009151445807723034177529227494764833275774552896580047677967498896323047251625937010454201090796982015329026143641253108825582589374040868672191406179600737541075752262336794642735549257065336240570404401853166250425003234872518562174947561r = 233exponent = (r - 1) / (r + 1)^2bound = floor(N.n()^exponent)a = e1 * e2b = (e2 - e1)
R.<x> = PolynomialRing(Zmod(N)) f = a*x - bsolutions =  f.monic().small_roots(beta = r*(r-1) / (r+1)^2)ans = int(solutions[0])print(ans)ans = 62858674425900860829478797208045955732860272464480153581913102116715665463005752196325311449180070917831141151489464997358695645410738581683043594031192g = gcd(a*ans - b,N)p = gmpy2.iroot(g,r-1)[0]flag = 'flag{' + md5(str(p).encode()).hexdigest() + '}'print(flag)from hashlib import md5
flag{fed177cf9f68e191a1dc46089788aa0e}

酒泉关卡-勒索软件入侵响应:



1.攻击者ip地址
2.攻击者的webshell文件名
3.攻击者的恶意软件文件名
4.恢复flag.encrypt中的指定内容

5.提交flag格式为:flag{攻击者ip地址-攻击者修改webshell文件名-攻击者的恶意软件文件名-恢复flag.encrypt中的指定内容}

将勒索镜像导入lovelymemluex

看定时任务/etc/crontab

通过RS导入镜像-使用flag.encrypt解密
flag{192.168.85.128-error.php-U98ab8a1-0cc91e6dad77}
需要交流或者培训可以联系小编加群交流!
排版创作不宜如果对你有帮助,可以支持一下小编!

关注我们



#artContent h1{font-size:16px;font-weight: 400;}#artContent p img{float:none !important;}#artContent table{width:100% !important;}