# recon\_12 (load balance)

View the exercise here: [PentesterLab: Recon 12](https://pentesterlab.com/exercises/recon-12)

### **OBJECTIVE**

For this challenge, your goal is to access a load-balanced application hosted at the address **`balancer.hackycorp.com`**.

### **LOAD BALANCING**

Serving requests for a single application can be done by multiple backends. It can pay off to send the same request multiple times to check if multiple backends are involved.

### **SOLUTION**

#### **Solution # 1:**

{% hint style="success" %}
Enter **`curl balancer.hackycorp.com`** in the terminal repeatedly until you get the flag
{% endhint %}

<figure><img src="https://290105472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F89FZKOizBQcf0e0Qdrp8%2Fuploads%2FgRDnOBXsNeg9Em56Oy52%2Fimage.png?alt=media&#x26;token=163b2f78-c979-434b-b1d5-49a4c690ceb1" alt="" width="563"><figcaption></figcaption></figure>

#### **Solution # 2:**

Create a Python code that will curl the site repeatedly:

```python
import subprocess

# URL to be fetched
url = "balancer.hackycorp.com"

while True:
    try:
        # Execute the curl command
        result = subprocess.run(['curl', url], capture_output=True, text=True)
        
        # Print the output
        print(result.stdout.strip())
        
    except KeyboardInterrupt:
        print("Stopped by user")
        break
```

<figure><img src="https://290105472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F89FZKOizBQcf0e0Qdrp8%2Fuploads%2Fo7YEmLdb3gzqjDDoNRKS%2FScreenshot_2024-08-22_at_11.00.18.png?alt=media&#x26;token=c16fa2e6-0322-4e87-84d4-91311890ce2c" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://290105472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F89FZKOizBQcf0e0Qdrp8%2Fuploads%2FNbysjFJcHukCjhTBePi3%2FScreenshot_2024-08-22_at_10.59.54.png?alt=media&#x26;token=8f2df5df-3e53-4ecb-a179-8c20fa607036" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="success" %}
Then run the python code:

```bash
python3 curlsite.py
```

{% endhint %}

<figure><img src="https://290105472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F89FZKOizBQcf0e0Qdrp8%2Fuploads%2F2aXEbwMDVYBfSdNWB9yN%2Fimage%201.png?alt=media&#x26;token=370fc12a-2c47-482a-9ae6-e93cf0962d3e" alt="" width="563"><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://www.marialc.com/pentesterlab-labs/recon-badge/recon_12-load-balance.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.
