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

# 暗号化 OpenSSH 鍵のクラッキング

秘密鍵ハッシュの抽出、パスフレーズのクラッキング、SSH 鍵認証の検証のための OpenSSH 暗号化鍵ブルートフォースメモ。

> その **.enc** 拡張子は通常、 **暗号** （暗号化された）ファイルです。これは、ファイルの内容がデータ保護アルゴリズムによって保護されており、コードまたは適切なパスコードがなければデータを読めないことを意味します。これらのファイルには、データの種類（テキスト、画像、動画など）の量が含まれている場合があり、機密情報を保護するために使用されます。

その `.enc` ファイルは、ある **AES-256-CBC** アルゴリズムで暗号化され、 **Base64**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-77572e2fba67e55b4df4c3749c2456cc145a8f52%2Fimage%20(2673).png?alt=media" alt=""><figcaption></figcaption></figure>

**手順1: Base64デコード**

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

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-34740e0bc19cc11b32d0b4805f6858227ce928e8%2Fimage%20(2674).png?alt=media" alt=""><figcaption></figcaption></figure>

**手順2: OpenSSLによる復号**

ファイルを復号するには、パスワードが必要です。手動での復号を試すために、次のコマンドを実行します:

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

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-af8cfefc7fe4531094d5fb8065e5a31c933a04fa%2Fimage%20(2675).png?alt=media" 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
```

**結果:**

見つかったパスワードは: **友達**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6ec3269c4f31949021332d09000d2ec83f02df83%2Fimage%20(2676).png?alt=media" alt=""><figcaption></figcaption></figure>

#### **復号メッセージ**

復号されたファイルには新しいパスワードが含まれています:

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

友達
```

* **鉛筆キーボードスキャナー123**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a6f128df7f5443d3f12a87a5104243cd032edf7c%2Fimage%20(2677).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/password-attacks/brute-force-openssh-.enc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
