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

# Quebra de chave OpenSSH criptografada

> O **.enc** extensão geralmente indica uma **cifra** (arquivo criptografado). Ele é usado para indicar que o conteúdo do arquivo está protegido por um algoritmo de proteção de dados, permitindo que os dados fiquem ilegíveis sem o código ou a senha apropriada. Esses arquivos podem conter diferentes tipos de dados (texto, imagens, vídeos etc.) e são usados para proteger informações sensíveis.

O `.enc` o arquivo é criptografado com um **AES-256-CBC** algoritmo e codificado em **Base64**.

<figure><img src="/files/4b836d79d797fefc4fd41d5ecd1c65c6955a837a" alt=""><figcaption></figcaption></figure>

**Etapa 1: Decodificação Base64**

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

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

**Etapa 2: Descriptografia com OpenSSL**

Para descriptografar o arquivo, precisamos de uma senha. Execute o comando para tentar a descriptografia manual:

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

<figure><img src="/files/78f13768b7e180a8c10d295161e061a7835a8428" alt=""><figcaption></figcaption></figure>

**Etapa 3: Script de automação para força bruta**

Usamos um script Bash para testar uma lista de senhas (exemplo: `rockyou.txt`).

```bash
#!/bin/bash

function ctrl_c(){
    echo -e "/n/n[!] Saindo.../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[+] A senha é : $password/n"
        exit 0
    fi
done; tput cnorm
```

**Resultado:**

A senha encontrada é: **friends**

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

#### **Mensagem descriptografada**

O arquivo descriptografado contém uma nova senha:

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

friends
```

* **PencilKeyboardScanner123**

<figure><img src="/files/8145602b82f6bc5c911e30aaf5b88ab2dfa35e0f" 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/pt-br/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.
