#!/usr/bin/env python3

import requests
import hashlib
from bs4 import BeautifulSoup

url = "http://docker.hackthebox.eu:32453"

newSession = requests.session ()
resp = newSession.get (url)
soup = BeautifulSoup (resp.text, "html.parser")
inputStr = soup.h3.string
print ("\033[31m Received String:\t" + inputStr)

MD5hash = hashlib.md5 (inputStr.encode()).hexdigest()
hashObj = { 'hash' : MD5hash }
resp = newSession.post (url, hashObj)
soup = BeautifulSoup (resp.text, "html.parser")

print ("\033[32m HTB Flag:\t" + soup.p.string + "\033[0m")