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

# Взлом зашифрованного OpenSSH-ключа

> У **.enc** расширение обычно указывает на **шифр** (зашифрованный) файл. Этот термин используется для обозначения того, что содержимое файла защищено алгоритмом защиты данных, что делает данные нечитаемыми без кода или соответствующего пароля. Эти файлы могут содержать объём данных любого типа (текст, изображения, видео и т. д.) и используются для защиты конфиденциальной информации.

У `.enc` файл зашифрован с помощью **AES-256-CBC** алгоритма и закодирован в **Base64**.

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

**Шаг 1: Декодирование Base64**

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

<figure><img src="/files/593da0758491440fae8680323b5d25100a4ccc32" alt=""><figcaption></figcaption></figure>

**Шаг 2: Расшифровка с OpenSSL**

Чтобы расшифровать файл, мы подбираем пароль. Введите команду, чтобы попытаться выполнить ручную расшифровку:

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

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

**Шаг 3: Скрипт автоматизации для перебора**

Мы используем Bash-скрипт для проверки списка паролей (пример: `rockyou.txt`).

```bash
#!/bin/bash

function ctrl_c(){
    echo -e "/n/n[!] Завершение.../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[+] Пароль: $password/n"
        exit 0
    fi
done; tput cnorm
```

**Результат:**

Найденный пароль: **friends**

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

#### **Расшифрованное сообщение**

Расшифрованный файл содержит новый пароль:

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

friends
```

* **PencilKeyboardScanner123**

<figure><img src="/files/d10f7c943ac5d0e85c08392566e6b1bb2b13a9eb" 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/ru/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.
