import sys import xdis.std as dis # esq8y43nYgdk+b2QS0W7jLi5cvf16uGXCMBHw9moZNJREaDpAx/tITKOzhVPFlUr= b64 = '' def test(a,b,c): global b64 code = a.f_code if 'ctf.py' in str(a): print(code.co_name) # print(code.co_names) # print(code.co_consts) print(dis.dis(code)) # print('##', a.f_locals) if 'My_base64_encode' in a.f_globals: for i in range(64): res = a.f_globals['My_base64_encode']('\x00\x00'+chr(i)) print('good:', res) b64 += res[-1] b64 += '=' print('b64_table', b64) print('b64_res_test', a.f_globals['My_base64_encode']('so good man')) exit(0) # 绕过反调试 sys.gettrace = lambda :None sys.settrace(test) import PYC
运行后得到正确的base64编码表
esq8y43nYgdk+b2QS0W7jLi5cvf16uGXCMBHw9moZNJREaDpAx/tITKOzhVPFlUr=
6: 16 LOAD_CONST ('63356268') 7: 18 LOAD_CONST ('75344678') 8: 20 LOAD_CONST ('75386c6c') 9: 22 LOAD_CONST ('2b69755a') 10: 24 LOAD_CONST ('53546c57') 11: 26 LOAD_CONST ('31396c34') 12: 28 LOAD_CONST ('35547376') 13: 30 LOAD_CONST ('36546c73') 14: 32 LOAD_CONST ('3038736f') 15: 34 LOAD_CONST ('2b4f6167')
CyberChef套用上面得到的b64表
asyt_1t?}1ghC_Rn_E_PYs_AD0g3{I
是乱序的flag,排列组合得到正确的flag
D0g3{It_1s_An_Easy_PYC_R1ght?}