点击此处获得更好的阅读体验
WriteUp来源
https://dunsp4rce.github.io/csictf-2020/reversing/2020/07/22/pydis2ctf.html
by raghul-rajasekar
题目描述
I learnt Python in school but I have no clue what this is!
题目考点
解题思路
The contents of C1cipher
and C2cipher
appear to be Python disassembly. Manually converting this to Python code, we would have something like:
1 | def C1cipher(text): |
The first cipher replaces each character i
in the input text with chr(2*ord(i) - len(text))
, while the second cipher XORs every character in the input text with 'S'
. To reverse the first cipher, I wrote the following function:
1 | def C1rev(text): |
To reverse the second cipher, xor(inpString, 'S')
is sufficient (xor
function from the pwn
library is used). However, only C1rev
was enough to get the flag; seems like C2cipher
wasn't used at all.
Flag
1 | csictf{T#a+_wA5_g0oD_d155aSe^^bLy} |