This challenge is Vigenère cipher, but make it to a cube.
Each level has a Vigenère table and rorate 1 alphabet for every floor.
Solve
This challenge needs two key, but they just reverse it.
1
main(sys.argv[1], sys.argv[2], sys.argv[2][::-1])
So, I try to decrypt it.
1 2 3 4 5 6 7 8 9 10 11 12 13
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}" t = [[_l((i+j) % len(s), s) for j inrange(len(s))] for i inrange(len(s))]
defdecrypt(c,k) : i = 0 p = "" k2 = k[::-1] for a in c : for level inrange(len(s)) : if a == t[level][s.find(k[i])][s.find(k2[i])] : p += s[level] i = (i + 1) % len(k) return p
Test every possible key which can get the SECCON{ header.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
cand_khead = '' cand_ktail = '' known = 'SECCON{'
for i inrange(len(known)) : cipher = 'POR4dnyTLHBfwbxAAZhe}}ocZR3Cxcftw9' for p in s : for q in s : k = ( cand_khead + p ).ljust(7,'?') k += ( q + cand_ktail ).rjust(7,'?') out = decode(cipher,k) if out[:i+1] == known[:i+1]: cand_khead += p cand_ktail = q + cand_ktail print(out) print(p,q) break break