Table of contents
Intro
It’s been a while since I started learning about cryptography. And I came across OverTheWire community - good-looking hackers.
They have built wargames as fun games to learn security concepts. Today, I will be solving Krypton Wargames.
Krypton (as the name suggests) is all about cryptography and cryptanalysis.
So let’s get started!
Level 0
There are so many ways to solve this level - you can use online tools, write your own python script, or simply write a terminal command (which ever comfortable you feel with). I am going to decode this string using python scirpt.
import base64
decoded_string = base64.b64decode('S1JZUFRPTklTR1JFQVQ=')
print(decoded_string.decode('utf-8'))
KRYPTONISGREAT
At this point we are done with level 0.
Level 01
To solve level 01, we have to login on a remote server using ssh.
ssh [email protected] -p 2231
Password is KRYPTONISGREAT.
Once we are logged in successfully. we will cd to /krypton/ directory and then into /krypton1/.
cd /krypton/krypton1/
Type ls
and you’ll see 2 files in the /krypton1/ directory: krypton2
and README
.
You can read both files in the terminal by using cat
command.
cat README
It tells you about the password which is encrypted in the file krypton2
. It also tells about the encryption algorithm used in the file krypton2
, ROT13.
cat krypton2
It gives us encrypted password.
Now, let’s decrypt the file krypton2
and get the password.
def rot13(message):
result = []
for char in message:
if 'A' <= char <= 'Z':
result.append(chr((ord(char) - ord('A') + 13) % 26 + ord('A')))
elif 'a' <= char <= 'z':
result.append(chr((ord(char) - ord('a') + 13) % 26 + ord('a')))
else:
result.append(char)
return ''.join(result)
message = "YRIRY GJB CNFFJBEQ EBGGRA"
decoded_message = rot13(message)
print(decoded_message)
LEVEL TWO PASSWORD ROTTEN
Here we go. We got the password for level 2.