ȳϼ. ȣ ͵ Ǫµ ʾƼ øϴ٤
ȣ
[Oņq, Ɂ s WD. n O , ӽ ϴ k φq. T pk pk, u A Tŝsq. ȴL Oŋs iI pW. Z δ uީK u ʛS pW. nţk ْV Tţk. e ܛS OW ƈm. Rݍ , WV ©P R hm . Oņq, Ɂ s. f. nS TAŋs, nS ŋs. O e A T hB ŋs. ӚS رoDq. O sDq. ϋ, . O n T n Qn, n TA , O e A T, hB ŋs. ӚS رoŅD, O ŅD. . O ͆, O IG eXk] ̰
翬 ġȯȣϰŶ ϰ Ǯϴ.
http://blog.cozyu.org/289 << Ʈ ߽ϴ.
# -*- coding: utf-8 -*-
# -*- coding: euc-kr -*-
'''
ʼ ̺ (19)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18
,,,,,,,,,,,,,,,,,,
,̺ (21)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20
,,,,,,,,,,,,,,,,,,,,
,̺ (28)
0, 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
,,,,,,,,,,,,,,,,,,,,,,,,,,,
'''
def divide_char(char):
num = ord(char) - 0xac00
if num<0:
return None
cho = num / (21*28)
jung = (num % (21*28))/28
jong = num % 28
return cho, jung, jong
def join_char(cho,jung,jong):
num = 0xac00 + cho*21*28 + jung *28 + jong
return unichr(num)
unicoder = lambda x:unicode(x.decode('utf8'))
#unicoder = lambda x:x
original_table = [map(unicoder,
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",""]), map(unicoder,
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",""]), map(unicoder,
[" ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "","", "", "", "", "", "", "", ""])]
replace_table = [map(unicoder,
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",""]), map(unicoder,
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",""]), map(unicoder,
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "","", "", "", " ", "", "", "", ""])]
encrypted = "Oņq, Ɂ s WD. n O , ӽ ϴ k φq. T pk pk, u A Tŝsq. ȴL Oŋs iI pW. Z δ uީK u ʛS pW. nţk ْV Tţk. e ܛS OW ƈm. Rݍ , WV ©P R hm . Oņq, Ɂ s. f. nS TAŋs, nS ŋs. O e A T hB ŋs. ӚS رoDq. O sDq. ϋ, . O n T n Qn, n TA , O e A T, hB ŋs. ӚS رoŅD, O ŅD. . O ͆, O IG eXk."
unicoded = unicoder(encrypted)
decrypted = u""
stat = {'cho':{}, 'jung' : {},'jong' :{}, 'char' :{} }
for i in unicoded:
ret = divide_char(i)
if not ret:
decrypted+=i
continue
if i in stat['char']:
stat['char'][i]=stat['char'][i]+1
else:
stat['char'][i]=1
cho = original_table[0][ret[0]]
jung = original_table[1][ret[1]]
jong = original_table[2][ret[2]]
if cho in stat['cho']:
stat['cho'][cho]=stat['cho'][cho]+1
else:
stat['cho'][cho]=1
if jung in stat['jung']:
stat['jung'][jung]=stat['jung'][jung]+1
else:
stat['jung'][jung]=1
if jong in stat['jong']:
stat['jong'][jong]=stat['jong'][jong]+1
else:
stat['jong'][jong]=1
new_ret=list()
for i in range(3):
new_item = replace_table[i][ret[i]]
new_ret.append(original_table[i].index(new_item))
decrypted+=join_char(new_ret[0],new_ret[1],new_ret[2])
print decrypted.encode("euc-kr") <<<<<<<<<<<<<<<<<<<
print '\n[+] [+]'
for x,y in sorted(stat['char'].items(),key=lambda x:x[1], reverse=True):
print "%c:%d\t" % ( x,y),
print '\n[+] ʼ [+]'
for x,y in sorted(stat['cho'].items(),key=lambda x:x[1], reverse=True):
print "%c:%d\t" % ( x,y),
print '\n[+] [+]'
for x,y in sorted(stat['jung'].items(),key=lambda x:x[1], reverse=True):
print "%c:%d\t" % ( x,y),
print '\n[+] [+]'
for x,y in sorted(stat['jong'].items(),key=lambda x:x[1], reverse=True):
print "%c:%d\t" % ( x,y),
print ''
whitehat 2014 ؼ ڵ µ ںκп
python main.py
Traceback (most recent call last):
File "main.py", line 90, in <module>
print unicode(decrypted,'euc-kr').encode("euc-kr")
TypeError: decoding Unicode is not supported
.
ذؾ ϴ ÿ÷ο µ ʽϴ..
Ź帳ϴ