학회_공부해요/워게임

[SuNiNaTas(써니나타스)] Write up - 19번

yenas0 2024. 8. 27. 00:54
반응형

18번이랑 비슷한 늒김..

이번에는 바이너리로되어있는거같아서 바이너리를 아스키코드로 변환했다.

 

https://www.rapidtables.org/ko/convert/number/binary-to-ascii.html 

 

바이너리에서 텍스트로 변환기 | 바이너리 번역기

바이너리-텍스트 번역기 접두사 / 접미사 / 구분 기호와 함께 이진수를 입력하고 변환 버튼을 누릅니다 (예 : 01000101 01111000 01100001 01101101 01110000 01101100 01100101) : 이진 변환기 텍스트 ► ASCII 텍스트

www.rapidtables.org

요 사이트이용했음

 

 

역시나 암호화된것처럼 보이는 문자열이 보임.

 

18번이랑 동일한가 해서 base64돌려보니 안나온다.

 

다시보니 뭔가 쉬프트 암호일거같음. 띄어쓰기도 있고 중간중간 ZJ가 반복되는데 동일한 문자열에 대해 치환한거인거같음.

NVCTFDV KF JLEZERKRJ REU KFURP ZJ R XFFU URP REU RLKYBVP ZJ GCRZUTKWZJMVIPYRIU 

 

툴 찾기 귀찮아서 전에 내가 짜둔 코드 이용해서 해봤다.

 

코드 돌려보니 말이 되는 문장은 이거 하나다. 저게 키인갑다.

 

혹시 사용할 사람이 있으려나 해서..

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>

void decryptCaesarCipher(char cipherText[], int shift) {
    int length = strlen(cipherText);

    for (int i = 0; i < length; i++) {
        char currentChar = cipherText[i];

        if (isalpha(currentChar)) {
            char baseChar = (islower(currentChar)) ? 'a' : 'A';
            char decryptedChar = (currentChar - baseChar - shift + 26) % 26 + baseChar;
            cipherText[i] = decryptedChar;
        }
    }
}

int main() {
    char cipherText[100];
    char originalCipherText[100];
    int shift;

    printf("암호문: ");
    fgets(cipherText, sizeof(cipherText), stdin);

    cipherText[strcspn(cipherText, "\n")] = '\0';

    strcpy(originalCipherText, cipherText);

    for (shift = 0; shift < 26; shift++) {
        strcpy(cipherText, originalCipherText);

        decryptCaesarCipher(cipherText, shift);
        printf("%d 평문: %s\n", shift, cipherText);
    }

    return 0;
}

 

해독하려고 짠 코드입니다.. C언어가 빠르고 편해서,...

 

 

아무튼 풀었음

반응형