> 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/wierdsnake.md).

# wierdsnake

After downloading the file, I realized it was an `objdump` of a Python script. When we open the file, we can see a lot of constants defined in it. These constants are loaded to build a list called `input_list`.

Then, a `key_str` is defined, which eventually becomes `t_Jo3`.

Looking further down, we can see that the program performs an XOR operation between the values of `input_list` and a repeating key.

Above that section, there are many `LOAD_CONST` values — these are actually the ciphertext stored in decimal form:

```
4 54 41 0 112 32 25 49 33 3 0 0 57 32 108 23 48 4 9 70 7 110 36 8 108 7 49 10 4 86 43 102 126 92 0 16 58 41 89 78
```

At first, I tried converting these decimal values directly to characters, but it produced random output.

Then I tried XORing them using a UTF-8 approach, which required a key. I initially used `j_o3t`, but it still gave incorrect results.

So instead, I used a known flag prefix `picoCTF{` as the key for XOR. From the output, I was able to recover the correct repeating key, which turned out to be:&#x20;

```
t_Jo3
```

Finally, I used this key to XOR the ciphertext properly and successfully recovered the flag.

***

If you want, I can also make this into a **perfect CTF writeup (GitHub/Medium level)** with code + explanation.


---

# 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/wierdsnake.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.
