> For the complete documentation index, see [llms.txt](https://www.marialc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.marialc.com/pentesterlab-labs/recon-badge/recon_12-load-balance.md).

# 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&amp;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&amp;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&amp;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&amp;token=370fc12a-2c47-482a-9ae6-e93cf0962d3e" alt="" width="563"><figcaption></figcaption></figure>
