lifeofal3af@home:~$

Exploit3rs.ae Open Practice Prove Me Wrong Forensics Challenge

Cryptography Challenge Writeup: Prove Me Wrong

Challenge Description

Your quiet day takes an unexpected twist when an encrypted message suddenly appears on your screen. It’s from an old friend, someone you haven’t heard from in years. The message is cryptic and challenging, just like your friend used to be, and it’s apparent they want to settle an old score. As you delve into the message, you realize that this isn’t just a casual chat. It’s a cryptic challenge, a gauntlet thrown down to test your skills in the realm of cryptography. Your friend seems to be claiming that they are still the better cryptographer, and they want you to prove them wrong.

The flag you need to retrieve is cunningly hidden within the message your friend sent. But deciphering it won’t be easy. Your friend has always had a penchant for riddles and complex ciphers. They’ve taken control of your communication channels and left you with this enigmatic task.

This challenge isn’t just about solving ciphers; it’s about settling a friendly rivalry and rekindling the thrill of competition. Are you ready to accept the challenge and show your friend who the true cryptographer is? Good luck!

Initial Analysis

Upon opening the provided file, I was greeted with a string of text that immediately caught my attention:

dit-dah-dah dit-dah dah-dit-dah dit dit-dit-dah dit-dah-dah-dit dit-dah-dah dit-dah dah-dit-dah dit dit-dit-dah dit-dah-dah-dit dit-dah-dah dit-dah...

The pattern of “dit” and “dah” was a clear indicator that I was dealing with some form of Morse code. The message used “dit” for dots and “dah” for dashes.

Let’s solve this.

Decryption Process

Step 1: Morse Code Conversion

To tackle this challenge, I wrote a Python script to convert the “dit-dah” notation to standard Morse code:

with open("logs.txt", "r") as file:
    string = file.read()

s2 = string.replace("-", "")  # Remove hyphens
s3 = s2.replace("dit", ".")   # Replace "dit" with dots
s4 = s3.replace("dah", "-")   # Replace "dah" with dashes
print(s4)

Running the program gave me output that looked like this:

.-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--.

Step 2: Morse to ASCII Conversion

With the Morse code now in a standard format, the next step was to convert it to ASCII text. For this, I adapted a Morse code translation function from GeeksforGeeks, which uses a dictionary to map Morse code sequences to their corresponding characters.

I added this, giving me my complete code:

MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
                    'C':'-.-.', 'D':'-..', 'E':'.',
                    'F':'..-.', 'G':'--.', 'H':'....',
                    'I':'..', 'J':'.---', 'K':'-.-',
                    'L':'.-..', 'M':'--', 'N':'-.',
                    'O':'---', 'P':'.--.', 'Q':'--.-',
                    'R':'.-.', 'S':'...', 'T':'-',
                    'U':'..-', 'V':'...-', 'W':'.--',
                    'X':'-..-', 'Y':'-.--', 'Z':'--..',
                    '1':'.----', '2':'..---', '3':'...--',
                    '4':'....-', '5':'.....', '6':'-....',
                    '7':'--...', '8':'---..', '9':'----.',
                    '0':'-----', ', ':'--..--', '.':'.-.-.-',
                    '?':'..--..', '/':'-..-.', '-':'-....-',
                    '(':'-.--.', ')':'-.--.-'}

def decrypt(message):
    message += ' '
    decipher = ''
    citext = ''
    for letter in message:
        if (letter != ' '):
            i = 0
            citext += letter
        else:
            i += 1
            if i == 2:
                decipher += ' '
            else:
                decipher += list(MORSE_CODE_DICT.keys())[list(MORSE_CODE_DICT
                .values()).index(citext)]
                citext = ''
    return decipher

# File reading and initial conversion
with open("logs.txt", "r") as file:
    string = file.read()

s2 = string.replace("-", "")
s3 = s2.replace("dit", ".")
s4 = s3.replace("dah", "-")
print("Converted Morse code:", s4)

# Decryption
decrypted_message = decrypt(s4)
print("Decrypted message:", decrypted_message)

Results and Flag Extraction

When I ran this script, I got the output:

Converted Morse code: .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--. .-- .- -.- . ..- .--.
Decrypted message: ...WAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPWAKEUPL4UGHT3RISTH3B3ST3NCRYPTEONWAKEUPWAKEUP...

The decrypted message revealed a repeating pattern of “WAKEUP” surrounding what could be the flag. I removed the “WAKEUP” parts and got this:

L4UGHT3RISTH3B3ST3NCRYPTEON

Flag Submission

Based on the challenge format, I determined that the flag should be submitted in the following format:

Tri-tech{L4UGHT3RISTH3B3ST3NCRYPTEON}

I submitted it and successfully solved it. Thanks for reading!