# Emdee five for life

Entramos en el host que nos proporcionan.&#x20;

<figure><img src="/files/TRmCEOnPlB7G0uKixkVl" alt=""><figcaption></figcaption></figure>

Encriptamos la cadena en MD5 tal como se nos pide.

```
echo -n "Mlji3Pbgj4zaofjOMDvu" | md5sum
```

<figure><img src="/files/mnJkbhzyYFda57R10UHj" alt=""><figcaption></figcaption></figure>

Pegamos el resultado.

<figure><img src="/files/wXaCSUz2jN6cIMDptmLs" alt=""><figcaption></figcaption></figure>

¡Demasiado lento! Parece que necesitamos hacer un script para conseguir la flag.

1. **Defino la URL del reto** en `URL`, que apunta a un servidor en la dirección `http://83.136.249.46:56367`.
2. **Inicio una sesión con `requests`**, lo que me permite mantener cookies o autenticaciones necesarias.
3. **Hago una petición GET a la URL** para obtener el contenido de la página web.
4. **Uso BeautifulSoup para analizar el HTML** de la respuesta y buscar elementos `<h3>`. Normalmente, dentro de estos elementos está el texto que necesito procesar.
5. **Extraigo el texto dentro de `<h3>`** y lo guardo en la variable `md5`. Este texto parece ser un valor que debo transformar.
6. **Aplico la función hash MD5** sobre ese texto usando `hashlib.md5()`, y luego convierto el resultado en un formato hexadecimal (`hexdigest()`). Este hash será la respuesta esperada por el reto.
7. **Creo un diccionario con el hash MD5** (`data = {'hash': md5_hash}`), que será enviado en una petición POST al servidor.
8. **Envió el hash de vuelta al servidor** con `request.post(url=URL, data=data)`, esperando que me responda con algún mensaje, como “¡Correcto!” o “Flag: …”.
9. **Imprimo la respuesta del servidor**, lo que probablemente contenga la flag o algún otro mensaje de confirmación.

```
from bs4 import BeautifulSoup
import requests
import hashlib

URL = "http://83.136.249.46:56367"
request = requests.session()
page = request.get(URL)

soup = BeautifulSoup(page.text, "html.parser")

for i in soup.findAll('h3'):
	md5 = (i.get_text())
	#print(md5)

hash_object = hashlib.md5(md5.encode())
md5_hash = hash_object.hexdigest()
#print(md5_hash)

data = {'hash': md5_hash}
output = request.post(url = URL, data = data)

print(output.text)
```

Ejecutamos.

```
python3 prueba.py
```

<figure><img src="/files/uPpkHn71PjOGTPZ0uY4P" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beafn28.gitbook.io/beafn28/writeups/hackthebox/challenges/emdee-five-for-life.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
