Weird Code
Description
Level: 2 Score 15 Category coding
I've found a weird piece of code in the internet. That looks strange....but there is a flag inside. I believe that! Help me, plz.
Link: SecurityValley/PublicCTFChallenges/coding/weird_code
Analysis
We are given what seems to be a disassambled code.
Its not Assembly
Searching around we can find that this is a python byte code using
dis
modulek\\PbYUHDAM[[VJlVAMVk[VWQE
seems to be encrypted password
Solution
After fiddling around with dis.dis()
I came to solution which looks like this. A standard XOR (as well seen in previous challenges)
import dis
def enc():
flag = "k\\PbYUHDAM[[VJlVAMVk[VWQE"
key = "8934"
out = ""
for i in range(len(flag)):
out += chr(ord(flag[i]) ^ ord(key[i % len(key)]))
print(out)
print(dis.dis(enc)) # Debug
# enc() # Uncomment for flag
Last updated