corCTF2021 复盘 Posted on 2021-08-28 babyrev memfrob函数:将字符串的每个字符与42进行异或实现加密。 解密脚本: 1234567891011121314151617181920212223242526272829303132333435def is_prime(n: int) -> bool: if n <= 1: return False i = 2 while i <= n // 2: if n % i == 0: return False i += 1 return Truedef rot_n(c, n): ASCII_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ASCII_LOWER = 'abcdefghijklmnopqrstuvwxyz' if c in ASCII_UPPER: return ASCII_UPPER[(ASCII_UPPER.index(c) + n) % 26] elif c in ASCII_LOWER: return ASCII_LOWER[(ASCII_LOWER.index(c) + n) % 26] else: return ccheck = [0x5f, 0x40, 0x5a, 0x15, 0x75, 0x45, 0x62, 0x53, 0x75, 0x46, 0x52, 0x43, 0x5f, 0x75, 0x50, 0x52, 0x75, 0x5f, 0x5c, 0x4f]# memfrobcheck = [c ^ 42 for c in check]flag = []for i in range(len(check)): p = 4 * i while not is_prime(p): p += 1 print(rot_n(chr(check[i]), -p), end='')