Krypton
https://overthewire.org/wargames/krypton/
Level 0 -> Level 1
1
2
3
4
5
6
7
| Level Info
Welcome to Krypton! The first level is easy.
The following string encodes the password using Base64:
S1JZUFRPTklTR1JFQVQ= -> KRYPTONISGREAT
You can find the files for other levels in /krypton/
|
1
| password : KRYPTONISGREAT
|
Level 1 -> Level 2
1
| ssh krypton1@krypton.labs.overthewire.org -p 2231
|
1
2
3
| krypton1@krypton:~$ cd /krypton/krypton1
krypton1@krypton:/krypton/krypton1$ ls
krypton2 README
|
README를 읽어보면 아래와 같음.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| The first level is easy.
The password for level 2 is in the file 'krypton2'.
It is 'encrypted' using a simple rotation called ROT13.
It is also in non-standard ciphertext format.
When using alpha characters for cipher text
it is normal to group the letters into 5 letter clusters,
regardless of word boundaries.
This helps obfuscate any patterns.
This file has kept the plain text word boundaries and carried them to
the cipher text.
|
1
2
| krypton1@krypton:/krypton/krypton1$ cat krypton2
YRIRY GJB CNFFJBEQ EBGGRA
|
ROT13이란?
1
2
3
4
5
| [위키백과]
ROT13은 단순한 카이사르 암호의 일종으로 영어 알파벳을 13글자씩 밀어서 만든다.
흔히 ROT-13 혹은 rot13이라고도 쓴다.
예를 들어서 'I LOVE YOU'를 ROT13으로 암호화하면 'V YBIR LBH'가 된다.
|
따라서 tool을 사용하지 않고 코드를 짜서 풀꺼임.
1
2
3
4
5
6
7
8
9
10
11
12
13
| import string
case=list(string.ascii_uppercase)
cipher="YRIRY GJB CNFFJBEQ EBGGRA"
plain=''
for i in cipher:
if i in case :
index=case.index(i)
plain+=case[index-13]
else :
plain+=i
print(plain) # LEVEL TWO PASSWORD ROTTEN
|
Level 2 -> Level 3
1
| ssh krypton2@krypton.labs.overthewire.org -p 2231
|
level info는 생략.. 너무 김
1
2
| krypton2@krypton:/krypton/krypton2$ ls
encrypt keyfile.dat krypton3 README
|
Caesar암호화 하였다고 함.
하지만 encrypt
실행파일을 통해 암호화를 해보면서 알아내면 가능함.
문제 설명에 있는대로 /tmp
를 만들고 ketfile.dat
을 링크 해준 뒤 실행.
1
2
3
| krypton2@krypton:/tmp/hhhh$ /krypton/krypton2/encrypt keyfile.dat
krypton2@krypton:/tmp/hhhh$ cat ciphertext
YZABCDEFGHIJKLMNOPQRSTUVWX
|
1
2
3
4
5
6
| krypton2@krypton:/tmp/hhhh$ cat > test
abcdefg ABCDEFG
^C
krypton2@krypton:/tmp/hhhh$ /krypton/krypton2/encrypt test
krypton2@krypton:/tmp/hhhh$ cat ciphertext
MNOPQRSMNOPQRS
|
그럼 이렇게 됨.
1
2
| mnopqrstuvwxyzabcdefghijkl
YZABCDEFGHIJKLMNOPQRSTUVWX
|
1
2
| krypton2@krypton:/krypton/krypton2$ cat krypton3
OMQEMDUEQMEK
|
1
2
3
4
5
6
7
8
9
10
11
| import string
cipher="OMQEMDUEQMEK"
encode="YZABCDEFGHIJKLMNOPQRSTUVWX"
decode="MNOPQRSTUVWXYZABCDEFGHIJKL"
plain=''
for i in cipher:
index=encode.index(i)
plain+=decode[index]
print(plain) # CAESARISEASY
|
1
| password : CAESARISEASY
|