> 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/password-attacks/brute-force-openssh-.enc.md).

# Cassage de clé OpenSSH chiffrée

> Le **.enc** l’extension indique généralement un **chiffrement** fichier (chiffré). Elle est utilisée pour indiquer que le contenu du fichier est protégé par un algorithme de protection des données, permettant aux données d’être illisibles sans le code ou le mot de passe approprié. Ces fichiers peuvent contenir différents types de données (texte, images, vidéos, etc.) et sont utilisés pour sécuriser des informations sensibles.

Le `.enc` le fichier est chiffré avec un **AES-256-CBC** algorithme et codé en **Base64**.

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

**Étape 1 : Décodage Base64**

```bash
cat .drupal.txt.enc | base64 -d > file_decoded.enc
```

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

**Étape 2 : Déchiffrement avec OpenSSL**

Pour déchiffrer le fichier, nous utilisons un mot de passe. Exécutez la commande pour tenter un déchiffrement manuel :

```bash
openssl enc -aes-256-cbc -d -in .drupal.txt.enc -out .drupal.txt -base64
```

<figure><img src="/files/7635ce7db008da989d69d2684ff2cc316c7cbee6" alt=""><figcaption></figcaption></figure>

**Étape 3 : Script d’automatisation pour force brute**

Nous utilisons un script Bash pour tester une liste de mots de passe (exemple : `rockyou.txt`).

```bash
#!/bin/bash

function ctrl_c(){
    echo -e "/n/n[!] Sortie.../n"
    tput cnorm; exit 1
}

# Ctrl+C
trap ctrl_c INT

tput civis
for password in $(cat /usr/share/wordlists/rockyou.txt); do
    openssl aes-256-cbc -d -in drupal.enc -out drupal.decrypted -pass pass:$password &>/dev/null

    if [ "$(echo $?)" == "0" ]; then
        echo -e "/n[+] Le mot de passe est : $password/n"
        exit 0
    fi
done; tput cnorm
```

**Résultat :**

Le mot de passe trouvé est : **amis**

<figure><img src="/files/59e0edf9dea8582511d1c6719d219119846b504a" alt=""><figcaption></figcaption></figure>

#### **Message déchiffré**

Le fichier déchiffré contient un nouveau mot de passe :

```bash
openssl enc -aes-256-cbc -d -in .drupal.txt.enc -out .drupal.txt -base64

amis
```

* **PencilKeyboardScanner123**

<figure><img src="/files/6a7fb3763f457532e6a2740fbdc72cf3114b59b7" 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/password-attacks/brute-force-openssh-.enc.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.
