> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/penetorshontesuto/configure-a-pentest/setting-up-authenticated-testing/handling-files-for-authentication.md).

# スクリプト経由で認証

これは **スクリプトによるログイン** のフローです。認証に、エージェントが実行・署名・読み取りできるファイルが必要な場合に使用します。たとえば、ログインスクリプト、クライアント証明書、またはログインを導く参照ドキュメントなどです。

**次の場合にこの機能を使用してください：**

* あなたは **スクリプト** を持っており、それがログインを実行し、セッショントークン、Cookie、またはヘッダーを出力します。
* 認証は次の方法で行います： **クライアント証明書または署名付きリクエスト** (`.pem`, `.crt`, `.key`, `.p12`, `.pfx`, `.csr`, `.pub`).
* エージェントには **参照資料** で認証するための`.pdf`, `.md`, `.txt`, `.csv`, `.json`, `.yaml`, `.yml`) が必要です。例：KYC書類、GraphQL の信頼済みドキュメント、またはアカウント一覧。

{% hint style="info" %}
のみ `.py` ファイルは **実行されます** （Python 3、サンドボックス環境内で）。他のサポート対象ファイルタイプは、参照入力としてエージェントに提供されます。エージェントはそれらを読み取り、あなたの指示に従うために使用します。
{% endhint %}

### セットアップガイド

{% stepper %}
{% step %}
**テストユーザーを追加**

評価ウィザードで、次をクリックします： **テストユーザーを追加** → **カスタム** → **スクリプトによるログイン**.

<figure><img src="/files/5af465c3968d0042d8430552f5173b7dcf5a61d2" alt="Add Test User menu - the Login via Script option lives under Custom"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**認証手順を書く**

Aikido は次の **認証手順** フィールドに初期テンプレートを自動入力します：

ファイルに対してエージェントが何をすべきかを正確に記述するように編集してください。 **成功基準** の行は曖昧にせず、ログイン後ページに表示される文字列や特定のステータスコードなどが有効です。そうすれば、エージェントが自動で検証できます。
{% endstep %}

{% step %}
**ファイル、鍵、またはスクリプトをアップロード**

ファイルをアップロードボックスにドロップしてください。テストユーザー1人につき1ファイル、最大 **2 MB**。拡張子は上記の一覧に限定されます。

Pythonスクリプトをアップロードする場合、エージェントは必要に応じてそれを調整し、 `python3`.

<figure><img src="/files/f89abd4fc30ded62d38bcd64853ba719f6d0ab09" alt="Login via Script modal"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**保存してテスト**

クリック **保存してテスト**で実行します。プレフライトがエージェントを起動し、エージェントはあなたの指示に従って（スクリプトを実行するか、アップロードされたファイルを参照するかして）ログイン後の状態に到達したことを確認します。プレフライトが成功すると、セッションは本番のペンテスト用にキャプチャされます。

<figure><img src="/files/726ecb94de086b9f6e89ac02a9b6f7c822bf8512" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### ヒントとベストプラクティス

* **スクリプトは自己完結型にしてください。** 可能な限り Python 3 標準ライブラリのみを使用してください。 `pip install` するステップは実行時にありません。
* **証明書の場合は、** 指示の中でファイル名とパスの規則を明記してください。例： *「アップロードした `client.p12` に次のパスフレーズを付けて `<password>` を使い、 `/api`."*
* **パスキー** はまだサポートされていません。この機能が必要な場合は、こちらで把握できるようご連絡ください！


---

# 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://help.aikido.dev/docs/docs-ja/penetorshontesuto/configure-a-pentest/setting-up-authenticated-testing/handling-files-for-authentication.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.
