본문 바로가기

[Wargame Write-up]/Wixxerd

[wixxerd] [Cryptography] I came, I saw, I encrypted

암호문이 주어져 있다.


Caesar 암호부터 시도해보자.




늘 쓰던 그 소스코드를 변형시켜서 구성하고


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
import os
import string
 
ciphertext = "Qjoqxxqzf iadw tmowqd! Ftue ime mz qmek azq. Ftq bmeeiadp ue \"ndmzpkngow\".".lower()
 
os.system("cls")
print "[*] Generate Candidate of Plaintext as \"candidate[key]: plaintext\""
 
for key in range(26):
    plaintext_candidate = ""
 
    for char in ciphertext:
        tmp_char_ascii = ord(char) + key
 
        if char in list(string.lowercase):
            if tmp_char_ascii > ord('z'):
                tmp_char_ascii -= 26
 
            plaintext_candidate += chr(tmp_char_ascii)
 
        else:
            plaintext_candidate += char
            continue
 
    print "\tcandidate[%d]: %s" % (key, plaintext_candidate)
 
print "\n[*] Finish Brute Forcing"
 
 
cs



실행 후, 제대로 된 영단어만으로 구성된 문장이 정답이다.