XCTF的新手逆向题
题目是pyc的后缀,反编译得到python源码
#!/usr/bin/env python # encoding: utf-8 import base64 def encode(message): s = '' for i in message: x = ord(i) ^ 32 x = x + 16 s += chr(x) return base64.b64encode(s) correct = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt' flag = '' print 'Input flag:' flag = raw_input() if encode(flag) == correct: print 'correct' else: print 'wrong'
根据源码逆出flag
#!/usr/bin/env python # encoding: utf-8 import base64 correct = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt' def decode(message): s='' for i in message: x=ord(i) x=x-16 x=x^32 s+=chr(x) return s print decode(base64.b64decode(correct))