First round need receive and sand hash with salt:```#!/usr/bin/pythonfrom pwn import *import hashlibimport Crypto.Hashfrom Crypto.Hash import *
host = '35.165.205.141'port = 5050
# Parse response for round 1 and round 2def parse(data):    data = data.split(', ')    parsed = {}    for item in data:        item = list(item.partition(': '))        item.remove(': ')        parsed.update({item[0].strip(): item[1].strip()})    return parsed
def findFunc(func_name):    if func_name == 'rmd160':        return Crypto.Hash.RIPEMD.RIPEMD160Hash    try:        func = getattr(hashlib, func_name)        return func    except AttributeError:        try:            func = getattr(Crypto.Hash, func_name.upper())            return func        except:            print('Error! Function %s not found' % func_name)
def round1(r):    while True:        data = r.readline().strip()        print(data)        if 'Round 2' in data:            return 2        parsed = parse(data)        func = findFunc(parsed['Type'])        answer = func(parsed['Pre-salt'] + parsed['Password'] + parsed['Post-salt']).hexdigest()        print('Answer: %s' % answer)        r.sendline(answer)        print(r.readline().strip())```And run it:```r = remote(host, port)r.readline()Round = 1r.readline()Round = round1(r)```
Next round need found "Film name" or "Director" or "Year". I used the imdbpy-5.1 library to do this:```from imdb import IMDb
def round2(r):    ia = IMDb('http')    while True:        data = r.readline().strip()        print(data)        if 'Final Round:' in data:            return 3        parsed = parse(data)        answer = ''        if parsed['Director'] == '??':            movies = ia.search_movie(parsed['Name'])            for item in movies:                if item['year'] == int(parsed['Year']):                    movie = ia.get_movie(item.getID())                    answer = movie['director'][0]['name']                    break        elif parsed['Year'] == '??':            movies = ia.search_movie(parsed['Name'])            for item in movies:                movie = ia.get_movie(item.getID())                for director in movie['director']:                    if director['name'] == parsed['Director']:                        answer = str(item['year'])                if answer:                    break        else:            persons = ia.search_person(parsed['Director'])            for person in persons:                movies = person.data['director']                for movie in movies:                    if movie['year'] == int(parsed['Year']):                        answer = movie['title']                if answer:                    break        # time.sleep(1)        print('Answer: %s' % answer)        r.sendline(answer)        print(r.readline().strip())```Run it:```Round = round2(r)```
In the last round, you just need to calculate the value of the expression:```def round3(r):    while True:        data = r.readline().strip()        print(data)        e = data.replace('What is ', '').replace(' ?', '')        answer = str(eval(e))        print('Answer: %s' % answer)        r.sendline(answer)        print(r.readline().strip())```Finaly run script:```r = remote(host, port)r.readline()Round = 1r.readline()Round = round1(r)Round = round2(r)Round = round3(r)print(r.readline().strip())```