Admin | Write | GuestBook
[공지] 해당 블로그에 용건이 있으신 분께서는 http://blog.fore.kr/ 의 방명록(Guestbook)으로 부탁드립니다.
네○파라 vol.0 암호화 루틴
Category : Programming/Programming Talk | URL : | Written by 포레 ( 2015. 8. 20. 20:58 ) | 신고

 

 

 

 

"""

 Python 2.7 pseudo-code

 Present by FORE

 http://foreblog.tistory.com/

"""

class neko(Structure):

 _fields_ = [ ('Signature',c_uint), # "neko"

 ('ullStructSize',c_ulonglong),

 ('dwAdlr32',c_uint),

 ('wFileName',c_ushort),

 ('FileName',c_wchar_p) ]

 

def get_key(adlr):
 adlr ^= 0x1548E29C
 first_one_byte_key = adlr & 0x000000FF
 default_key = ((adlr) ^ (adlr>>0x18) ^ (adlr>>0x10) ^ (adlr>>0x08)) & 0x000000FF
 if first_one_byte_key == 0:
  first_one_byte_key = 0x9C
 if default_key == 0:
  default_key = 0xD7
 return first_one_byte_key, default_key

 

def decode(buf,adlr):
 first_key, def_key = get_key(adlr)
 buf = list(struct.unpack('B'*len(buf),buf))
 buf[0] ^= first_key
 for i in range(len(buf)):
  buf[i] ^= def_key
 buf = struct.pack('B'*len(buf),*buf)
 return buf

 

 

이전이랑 달라진게 몇개 있다면

 

1. Signature 이 바뀜.

2. 첫 바이트를 두 번 XOR 암호화시킴.

 

정도인 덧 . . . . . . ?

 

 

Category
분류 전체보기 (605)
Notice (6)
Programming (79)
DISKER (1)
FSCH (7)
Caption (0)
Rest Time ! (443)
Hobby (64)
Tour (5)
Blind Post (0)
Recent Post
Recent Comment
Link
Calender
«   2024/05   »
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 31
Total :
Today :
Yesterday :