base64_enc = "YgNxAGMDawJjZQR6B2IGYANiYQVxAG8JYQhkawZ3AW8JagluYAN2Am4GbQRmZAR6AWwBbQNlZANxCWsCaAlhZQRxAm4CbgRkZgl1AWIIawhmYAh3B2MBaAJmaghwAWoEbwliYgBwCWkIbQNuawlyAW0FYAhuYgB1Am8CawRuYAJxCG8CbgRgZAF3BWgJYQlhZwFzAGsJbwFlagV0CW0FawhgawNyCGkAbQNjYQh3Bm4FbwNkYAJ6A2IDaANmYwl2A2sEaQRlaglyAm0HaARmYQZ7AWsIbwZhYwB0B2sIYAlvYgN2AWsHYQJiZAByAGgDYANmYQB0BmwJYABhZwl1CGkEaQlmZQJzBm0IYQdjYwh6A20BbwVhZQl3CGoIaABmYAN1AW0IbQFvYAN0B2gFYAVhZAF1BW8HYQZvagZ6A20CaAhjZAl6BWkCYQhvZAN1AGgDaQJhYQZzCW8BYABjZAN0AW8BbQViZwVyA28JagJiagd1CGgDawhvYQJwB28GagNvYwd6AG0BYQFuawVyBGoBaQFkZAV1A24HbgdlYgd1AWwIYQNkagV6BW0DbglvZAl0A2kFaAhjawB3AmwAbwZgZwV3BGMEaQllYAhzAGsEYAFhYAJ6Bm4GaQdkagl6A20DawdkZgd3BW0JbgRgYQZyB2kJbANnZgdwA2gFaQFnYAh7BW4GbAdhYgd7Bm4DawJmawN0CWMDbgJgYwh0AmwGYQRiYQN2BmIGaAVkYwh2BmsDbAFhaglzB2kAbQBjZwJ1BGkCaghiZgByAWkJaAhhagZ3AG0JaghiYQVwAmMIaAFjYgVzBGh0dHA6Ly80Ny4xMDkuMTA2LjYyOjkwOTB7Im5hbWUiOiJTQ1RGIiwicGFzc3dvcmQiOiI4ODg4ODg4OCJ9" base64_dec = base64.b64decode(base64_enc) basedecode_enc = bytearray(base64_dec[:base64_dec.index(b"http")])#截断http之后的内容 key = b"S0C0Z0Y0W" for i inrange(len(basedecode_enc)): basedecode_enc[i] ^= key[i % len(key)]
p = 106697219132480173106064317148705638676529121742557567770857687729397446898790451577487723991083173010242416863238099716044775658681981821407922722052778958942891831033512463262741053961681512908218003840408526915629689432111480588966800949428079015682624591636010678691927285321708935076221951173426894836169 q = 144819424465842307806353672547344125290716753535239658417883828941232509622838692761917211806963011168822281666033695157426515864265527046213326145174398018859056439431422867957079149967592078894410082695714160599647180947207504108618794637872261572262805565517756922288320779308895819726074229154002310375209 e = 65537 n = p * q phi = (p - 1) * (q - 1) d = inverse(e, phi) c = int(basedecode_enc) m = str(pow(c, d, n)) print(m)
tmp = "".join(chr(int(i)) for i in m.split("00")[:-1])
defanything(str): arr_c = list(str.encode()) to = len(arr_c) - 1 perfect(arr_c, 0, to, (to + 1) // 2) returnbytes(arr_c) defperfect(a, start, to, n): if start >= to: return if start == to - 1: a[start], a[to] = a[to], a[start] k = 0 p = n * 2 + 1 k_3 = 1 while(k <= p // 3): k += 1 p /= 3 k_3 *= 3 m = (k_3 - 1) // 2 rightCircle(a, start + m, start + n + m - 1, m) i = 0 t = 1 while(i < k): circle(a, start-1, t, m * 2 + 1) t *= 3 i += 1 perfect(a, m * 2 + start, to, (to - (m * 2 + start) + 1) // 2) defcircle(a, start, i, n2): k = i * 2 % n2 while(k != i): a[start + i], a[start + k] = a[start + k], a[start + i] k = k * 2 % n2 defrightCircle(a, start, to, n): m = n %(to - start + 1) reverse(a, to - m + 1, to) reverse(a, start, to - m) reverse(a, start, to) defreverse(a, start, to): while(start < to): a[start], a[to] = a[to], a[start] start += 1 to -= 1
original = tmp for i inrange(100): flag = tmp tmp = anything(tmp).decode() if tmp == original: print('SCTF{'+ flag + '}') break #12100119001160011500550010400117001090010600530010400540010300 #ywts7humj5h6g #SCTF{wshm56yt7ujhg}
BBox
b box b b BOO BOO BOO BOO。
最终flag请用SCTF{}包裹
SO 层的 checkflag 和 Java 层的 strange.encode ,Jadx 看不到 strange.encode,应该是有混淆
voidxxtea_encrypt(uint32_t *v, uint32_t len, uint32_t *k) { uint32_t n = len - 1; uint32_t y, z, sum = 0, e, p, q; q = 4 + 60 / len; while (q-- > 0) { sum += DELTA; e = sum >> 3 & 3; for (p = 0; p < n; p++) { y = v[p + 1]; z = v[p] += MX; } y = v[0]; z = v[n] += MX; } }
voidxxtea_decrypt(uint32_t *v, uint32_t len, uint32_t *k) { uint32_t n = len; uint32_t y = v[0], z, sum, e, p, q; q = 4 + 60 / len; sum = q * DELTA; while (sum != 0) { e = sum >> 3 & 3; for (p = n-1; p > 0; p--) { z = v[p - 1]; y = v[p] -= MX; } z = v[n - 1]; y = v[0] -= MX; sum -= DELTA; } }