val = bytes.fromhex('646566207265636375722869293a200a20202020206966286e6f742069293a0a20202020202020202072657475726e20310a202020202069662869203d3d203 1293a0a20202020202020202072657475726e2020330a202020202076616c5f32203d2032202a72656363757228692d31290a202020202072657475726e2076616c5f32202b20332a207 2656363757228692d3229200a2020202020657869742829200a656e635f666c6167203d205b3130322c37352c3136332c3233392c3135362c3135382c372c3134332c39322c3132302c3 02c35342c3138332c36352c3139392c3235332c36302c3138322c3230345d200a666f72206920696e2072616e6765283230293a0a20202020666c61675f76616c203d20656e635f666c6 1675b695d0a202020206374725f76616c203d20726563637572282869202a2069292b312925203235360a2020202076616c203d20666c61675f76616c205e206374725f76616c200a202 020207072696e742820290a202020207072696e74286368722876616c292c656e643d222229202020875a6ff8d42f51b0') with open('fin_file.py', "wb") as f: f.write(val)
This the resulting python file(ignore the redundant random bytes at the end)
Now what is left is to optimize it, and the simplefied optimization is :-
1 2 3 4
enc_flag = [102,75,163,239,156,158,7,143,92,120,0,54,183,65,199,253,60,182,204] for i in range(len(enc_flag)): val = (3 ** ((i ** 2)+1)) % 256 print(chr(enc_flag[i] ^ val),end="")