crypto

Hsctf 2021

aptenodytes-forsteri

Solved by: Taz34

We are given 2 file: First is aptenodytes-forsteri.py

flag = open('flag.txt','r').read() #open the flag
    
assert flag[0:5]=="flag{" and flag[-1]=="}" #flag follows standard flag format
    
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    
encoded = ""
    
for character in flag[5:-1]:
    encoded+=letters[(letters.index(character)+18)%26] #encode each character
print(encoded)

second is output.txt

IOWJLQMAGH

I made a flag.txt file as the script takes in flag.txt file. According to the script the script only takes in the characters between the curly brackets of the flag format i.e flag{} And it also allows only capital letters.

So i made a flag.txt file with all charaters A-Z in the flag format.

flag{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

Now i got the perspective encoded values of each letter so now I can compare it with the output.txt string.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
    
I O W J L Q M A G H
Q W E R T Y U I O P

We can verify it by passing the flag we have in the flag.txt file and see if it matches with output.txt

It matches hence we have the right flag.

flag{QWERTYUIOP}
Published on : 20 Jun 2021