본문 바로가기
리버싱

[6주차] 리버싱 문제

by rlo_zll 2024. 5. 21.

< "SWING_JJANG" is not plaintext >

rev6.exe
0.01MB

 

 

< 문제 풀이>

해당 파일을 다운 받고 ollydbg를 열어본다.

해당 부분을 보면 맞는 pw를 입력해야 correct가 출력된다.

그러면 pw를 구하는 문제다.

코드에 이러한 문장이 있어서 이게 pw가 아닐까 할 수도 있지만, 이건 암호화된 문장이다.

IDA를 보면서 어떻게 암호화가 된 건지 확인해주고, 이를 참고하여 복호화 코드를 짜주면 된다.

import string

def decrypt(encryptstr):
    result = ""
    for char in encryptstr:
        if char.isupper():
            result += chr((ord(char) - ord('A') + 21) % 26 + ord('A'))
        elif char.islower():
            result += chr((ord(char) - ord('a') + 16) % 26 + ord('a'))
        elif char.isdigit():
            result += chr((ord(char) - ord('0') + 7) % 10 + ord('0'))
        else:
            result += char
    return result

encrypted_password = "SWING_JJANG"
decrypted_password = decrypt(encrypted_password)
print("Decrypted password:", decrypted_password)

 

이렇게 작성하면 된다.

 

Decrypted password: NRDIB_EEVIB

 

이렇게 나온 password를 입력하면, 아래와 같이 correct!가 나온다.