> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/fr/post-exploitation/escaping-python-to-normal-bash-linux.md).

# Sortir d’un Python vers un Bash normal

Nous avons maintenant accès au serveur comme vous l’utilisez `daniel` avec un mot de passe associé à la base de données (par exemple, **drupal4hawk**). Énoncez la commande pour vous connecter :

```bash
ssh daniel@10.10.10.182
```

Mot de passe : **drupal4hawk**

Une fois connecté, nous nous retrouvons directement dans un interpréteur Python.

<figure><img src="/files/9e90896bf2f279c9b5e813ba8f84fe331ae87827" alt=""><figcaption></figcaption></figure>

Pour revenir à un shell Bash normal, nous pouvons utiliser le `os` pour exécuter une commande Bash. Voici les étapes :

1. Importer le module `os` :

   ```python
   import os
   ```
2. Exécutez un shell Bash :

   ```python
   os.system('/bin/bash')
   ```

Cela vous permettra d'accéder à un shell Bash normal depuis l'interpréteur Python.

<figure><img src="/files/a3b4870938893c15fb978ba1e99962bb4cb423b3" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/fr/post-exploitation/escaping-python-to-normal-bash-linux.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.
