TJCTF2020 - Titanic

Posted on mar. 02 juin 2020 in CTF

solves : 256

Points: 35 

Written by jpes707

I wrapped tjctf{} around the lowercase version of a word said in the 1997 film "Titanic" and created an MD5 hash of it: 9326ea0931baf5786cde7f280f965ebb.

We have all the informations to find the clear text:

  • A word from the Titanic movie script: (here)[https://www.imsdb.com/scripts/Titanic.html]
  • Wrapped with the flag format: tjctf{script_word}
  • Hash with MD5 algorithm
import hashlib

m = hashlib.md5()

filepath = 'Titanic.txt'
with open(filepath) as fp:
    line = fp.readline()
    while line:
        words = line.split(' ')
        for word in words:
            word = word.lower().replace('.', '').replace('\n','').replace(',','').replace(':','').replace('!','').replace('?','').replace(')','').replace('(','').replace('"','')
            if word == "":
                continue
            flag = "tjctf{" + word + "}"
            hex_result = hashlib.md5(flag.encode())
            ha = hex_result.hexdigest()
            if ha == "9326ea0931baf5786cde7f280f965ebb":
                break
        try:
            line = fp.readline()
        except Exception as e:
            continue

    print(flag)

Run the script and wait for the flag:

╰─ python titanic_mdf5.py
tjctf{end}