ctf-writeup/2023/KnightCTF 2023/Xorathrust
daffainfo 6681d14d5d feat: added UofTCTF 2024 2024-01-15 16:09:43 +07:00
..
README.md feat: added UofTCTF 2024 2024-01-15 16:09:43 +07:00
decrypt.py feat: grouped the challs 2024-01-09 16:59:32 +07:00
encrypt.py feat: grouped the challs 2024-01-09 16:59:32 +07:00

README.md

Xorathrust

Read the script and solve the problem.

About the Challenge

We were given a python script to encrypt the flag and the encrypted file. And if we open the script, the script will be look like this

def main():

    flag_enc = ""

    with open("flag.txt", "r") as infile:
        flag = infile.read()
        flag = list(flag)

        for each in flag:
            each = chr(ord(each) ^ 0x66)
            flag_enc += each

    with open("flag.enc", "w") as outfile:
        outfile.write(flag_enc)

if __name__ == "__main__":
    main()

The program will applies bitwise XOR on each character using 0x66. (You can get the script here)

How to Solve?

Well, its very easy. You just need to re run the script to get the flag (You can get the script here)

def main():

    flag_enc = ""

    with open("flag.enc.txt", "r") as infile:
        flag = infile.read()
        flag = list(flag)

        for each in flag:
            each = chr(ord(each) ^ 0x66)
            flag_enc += each

    print(flag_enc)

if __name__ == "__main__":
    main()

And the flag will be printed in the terminal

KCTF{ju5t_4_b45ic_x0r}