2.re2

def rc4_decrypt(key, ciphertext):
    # 初始化状态向量S
    S = list(range(256))
    key_bytes = [ord(k) for k in key]

    # 密钥调度算法(KSA)
    j = 0
    for i in range(256):
        j = (j + S[i] + key_bytes[i % len(key_bytes)]) % 256
        S[i], S[j] = S[j], S[i]

    # 伪随机生成算法(PRGA)和解密
    plaintext = bytearray()
    i = j = 0
    for byte in ciphertext:
        i = (i + 1) % 256
        j = (j + S[i]) % 256
        S[i], S[j] = S[j], S[i]
        k = S[(S[i] + S[j]) % 256]
        plaintext.append(byte ^ k)

    return plaintext

# 要解密的十六进制数据
hex_data = "C3 82 A3 25 F6 4C 36 3B 59 CC C4 E9 F1 B5 32 18 B1 96 AE BF 08 35"
# 移除空格并转换为字节
encrypted_bytes = bytes.fromhex(hex_data.replace(" ", ""))

# 正确的密钥
key = "[Warnning]Access_Unauthorized"

# 解密
decrypted_data = rc4_decrypt(key, encrypted_bytes)

# 转换为字符串并打印结果
flag = decrypted_data.decode('utf-8', errors='ignore')
print("解密后的flag:", flag)

mcp大法