def encode1(ans): s = '' for i in ans: x = ord(i) ^ 36 x = x + 25 s += chr(x) return s
def encode2(ans): s = '' for i in ans: x = ord(i) + 36 x = x ^ 36 s += chr(x) return s
def encode3(ans): return base64.b32encode(ans)
flag = ' ' print 'Please Input your flag:' flag = raw_input() final = 'UC7KOWVXWVNKNIC2XCXKHKK2W5NLBKNOUOSK3LNNVWW3E===' if encode3(encode2(encode1(flag))) == final: print 'correct' else: print 'wrong'
根据代码,写出解密脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/env python # encoding: utf-8
import base64
a = 'UC7KOWVXWVNKNIC2XCXKHKK2W5NLBKNOUOSK3LNNVWW3E===' b = base64.b32decode(a)
s = '' for i in b: s += chr((ord(i) ^ 36) - 36) l = '' for i in s: l += chr((ord(i) - 25) ^ 36) print ('flag is ',l)