> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/packer.md).

# packer

First, I used the `file` command to identify the type of file. It turned out to be an ELF 64-bit binary. Since it is an executable, I gave it permission using `chmod +x` and ran it. When executed, the program asked for a password.

Next, I used the `strings` command to inspect the binary. Towards the end of the output, I noticed the presence of “UPX”, which indicates that the binary is packed using UPX (a tool used for compressing executables).

Since the binary was packed, I used the `upx -d` command to decompress it.

After unpacking, I opened the binary in Ghidra and analyzed the `main` function. I noticed several hex strings in the decompiled output. On closer inspection, I found the following condition:

<img src="https://github.com/user-attachments/assets/b3e78d13-bc4f-4120-b185-bc7fdf02ff20" alt="image" height="743" width="1416">

```
if (iVar3 == 0) {
    puts("Password correct, please see flag: 7069636f4354467b5539585f556e5034636b314e365f42316e34526933535f35646565343434317d");
}
```

The program prints a hex-encoded string when the correct password is entered. To decode this hex string, I used the following command:

```
echo "7069636f4354467b5539585f556e5034636b314e365f42316e34526933535f35646565343434317d" | xxd -r -p
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/packer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
