본문 바로가기
CTF_/suninatas.com

[Suninatas] Forensic 19 풀이 _ Bin to string

by 낭람_ 2020. 11. 8.
반응형

[Forensic 19]

2진수를 문자열로 변경을 해보자.

 

string = """
0100111001010110010000110101010001000110010001000101
0110001000000100101101000110001000000100101001001100
0100010101011010010001010101001001001011010100100100
1010001000000101001001000101010101010010000001001011
0100011001010101010100100101000000100000010110100100
1010001000000101001000100000010110000100011001000110
0101010100100000010101010101001001010000001000000101
0010010001010101010100100000010100100100110001001011
0101100101000010010101100101000000100000010110100100
1010001000000100011101000011010100100101101001010101
0101010001001011010101110101101001001010010011010101
0110010010010101000001011001010100100100100101010101"""
string = string.replace('\n','')
hex_string = str(hex(int(string, 2)))[2:]
bytes_object = bytes.fromhex(hex_string)
print(bytes_object)

아직은 어떤 말인지 모르겠다.. 일단 기본적인 시저암호라 생각하고 돌려보자.

 

string = """
0100111001010110010000110101010001000110010001000101
0110001000000100101101000110001000000100101001001100
0100010101011010010001010101001001001011010100100100
1010001000000101001001000101010101010010000001001011
0100011001010101010100100101000000100000010110100100
1010001000000101001000100000010110000100011001000110
0101010100100000010101010101001001010000001000000101
0010010001010101010100100000010100100100110001001011
0101100101000010010101100101000000100000010110100100
1010001000000100011101000011010100100101101001010101
0101010001001011010101110101101001001010010011010101
0110010010010101000001011001010100100100100101010101"""
string = string.replace('\n','')
hex_string = str(hex(int(string, 2)))[2:]
bytes_object = bytes.fromhex(hex_string)
for i in range(26) :
      for word in bytes_object:
            if(word >= ord('A') and word <= ord('Z')):
                  if(word+i >= ord('A') and word+i <= ord('Z')):
                        print(chr(word+i), end='')
                  else :
                        print(chr(ord('A')-1+(word+i-ord('Z'))), end='')
            else :
                  print(chr(word),end='')
      print()

기본 문자열에서 +9 하면 AuthKey가 나온다.

 

반응형

댓글