Rating:

![image](https://user-images.githubusercontent.com/87527216/214193330-566570ce-65e7-4c76-801a-b9d500c0297f.png)

I checked the contents of the encode_mania.txt file and found that it was encoded with base32.

![image](https://user-images.githubusercontent.com/87527216/214193355-f3e1eb2b-b882-489b-8b06-96521cd86ff5.png)

I tried to decode through cyberchef, but I found out that there was a different base encoding, and I programmed the code to decode it in Python.

```python
from base64 import *

base16 = set("0123456789ABCDEFabcdef")
base32 = set("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=")
base64 = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=")
base85 = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&()*+-;<=>[email protected]^_`{|}~")

enc = open("artifacts/encode_mania.txt","r").read().encode()

while True:
string = enc.decode("UTF-8")

if all(x in base16 for x in string):
enc = b16decode(enc)

elif all(x in base32 for x in string):
enc = b32decode(enc)

elif all(x in base64 for x in string):
enc = b64decode(enc)

else:
enc = b85decode(enc)

if "KCTF{" in enc.decode("UTF-8"):
print(enc.decode("UTF-8"))
break
```

I got FLAG through the above code

FLAG : ```KCTF{dfs_0r_b4u7e_f04c3}```